Files
claude-config/skills/comprehension-panel/SKILL.md
T

251 lines
17 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: comprehension-panel
description: Judge how hard a project is to understand by running a panel of nine independent simulated readers — juniors, mid-levels, seniors and architects taking a helicopter view — each reporting what defeated them, then comparing their consensus against whatever metric, guardrail or claim is being weighed. Use when asked to evaluate readability, maintainability or "is this code hard to understand", when choosing a complexity or size threshold, when a metric-driven refactor is proposed, or when the user asks for a comprehension panel, a reader panel or architect review of a whole project.
---
# comprehension-panel — what readers find hard, versus what a metric says
Words: `~/.claude/CLAUDE.md` → "Vocabulary".
Where readers and a metric disagree, the readers win.
Seven seats read at the level of a single unit and answer "which places defeated me"; two read at
the level of the whole and answer "can I hold this project's shape in my head". The two halves fail
independently, so every seat's report counts.
## What makes the result trustworthy
Hold all of these or the comparison proves nothing.
- **One variable.** Every panelist runs the same model with the same brief and the same report
shape. Only the persona differs. A cheaper model for the juniors turns persona into a confound.
- **One depth.** Pick a reading depth below, name it in every brief, and give every seat the same
one. Seats that read different amounts produce numbers nothing can compare.
- **Blind.** Deny the project's own conclusions — the plan, a decision log, prior review
output — and never show a panelist the metric under test. An anchored reader is a wasted one.
- **Check what the harness pre-loads, before launching.** `CLAUDE.md` may be nothing but
`@AGENTS.md`, and an `@file` import lands in a subagent's context ahead of its first tool call.
That is harmless for a reader who was going to read the charter anyway, and fatal to the
architects' README-and-tree-only step. Read the project's `CLAUDE.md` and resolve its imports
first; name every pre-loaded file in the architects' brief and require them to mark each map
entry that file could have fed, so the contaminated entries are discountable instead of
invisible.
- **Isolated and read-only.** Launch each with `isolation: "worktree"`, and forbid edits, test
runs and builds. Entering a worktree yourself mid-run strands a non-isolated subagent.
- **Parallel.** Launch them in one message. Nine agents reading a few thousand lines is minutes,
not hours; a full sweep is not, which is what the depths below are for.
- **Forced choices.** Each panelist ranks, names one single worst thing, and lists what they
expected to be hard and found easy. The negative control is where the sharpest evidence comes
from: a unit the metric flags that readers volunteer as clear.
- **Addressable findings.** Every place is named as the smallest unit the language addresses —
function, method, closure, component — with `path/to/file:line`. Never a bare file.
## How much they read
**1. The whole project.** Every non-test source file, plus the templates, migrations, schema and
configuration that carry behaviour. The default wherever the project still fits one sitting.
**2. Sampled, where it does not fit.** Not fitting is itself the first finding, recorded before any
seat opens a file: nobody working here reads the project whole either, so the layout is the only
map anyone gets, and what Navigation and Shape report decides the number. Size adds no penalty of
its own; it removes the excuse for a structure that has to be learned from a person. A sample still
indicates soundly — the README and charter, the entry points, and from every top-level area a
handful of units with the files around them.
- Draw by rule, not by taste, so the panel can be accused neither of touring the worst parts nor of
avoiding them: per area the largest unit, the most-churned by `git log`, and one taken blind.
- Fix the sample before launching and hand it to every seat verbatim.
- Every report says it sampled and lists what it opened. What the seats found is real; a place
nobody opened is not evidence that it is clear.
**3. Full sweep, on request.** Every line, tests included, in as many passes as it takes. Slow and
expensive, and the only depth that can say a place is clear because somebody read it. Reserve it
for a deliberate in-depth audit — a number about to be published, a handover being priced, a
sampled score under dispute.
## The seats
Nine by default. Add a seat where it would see something these cannot — a UI, an operator-facing
CLI, a schema other teams write against.
| Seat | Brief the background as |
| --- | --- |
| Junior A | ~2 years in the project's mainstream language, first codebase of this kind; no domain exposure at all |
| Junior B | ~18 months, arriving from a different language; the project's type discipline, or its absence, is new to them; the domain is a half-remembered course |
| Mid A | ~5 years, fluent in the idioms, no experience of the problem domain and has never read its specification |
| Mid B | ~5 years, has used systems of this kind from the outside — as a consumer, an API client or an operator — and never seen the internals |
| Senior, domain native | ~12 years including having built this kind of thing; knows the reference algorithm, standard or business rules; reading to judge whether they could take over maintaining it |
| Senior, maintainability | ~12 years in a neighbouring discipline, reviews others' code daily, no experience of this domain; cares whether the next person can change it safely |
| Senior, extender | ~12 years, new to the project, handed its actual next milestone; reading what exists as the template to mirror and partly reuse |
| Architect, greenfield | ~15 years laying systems out from scratch; asks what they would build today for these requirements, and what this layout costs everyone who comes after |
| Architect, inherited | ~15 years taking over other people's systems; has been paged at 3am about something like this, and asks where it rots first |
The domain-native seat and the extender seat earn their places for opposite reasons: the first
tells you what an expert still pays for, the second is the only one reading with a task in hand.
Shared brief: read the README, the agent/contributor charter, the spec where there is one, and
whatever the chosen depth prescribes; no plan documents; no running anything; no edits. May open a
test or fixture when the code does not answer a question, and must say when they did.
Tell the seniors and the architects that understanding most of it is expected, and that the value
of their report is precision about where the reading cost was highest even where they got there in
the end. Tell everyone not to manufacture confusion.
## The scoring run
A scoring run needs four seats — Junior A, Mid A, the maintainability senior and the inherited
architect — plus the calibration seat ("The score") when more than one project is in play. Build
the four seats' prompts from `seat-prompts.md`, filled in from the project's `AGENTS.md` → "Scoring
run". Change neither between runs, or the scores are not comparable. A project without that
section gets it at its first scoring run or paired ruling.
## The paired ruling
A paired ruling asks whether a change makes a project read better, the same or worse. Each seat
reads both versions, so what the two versions share cannot move the ruling. Check out the older
version as a detached worktree in a folder you make under the chunk's review folder
(`~/.claude/bin/larv-review review-folder` prints it), and remove the worktree and that folder
afterwards. Build each seat's
prompt from `seat-prompts.md` → "Paired ruling"; the seats and the rule for adding one are the
caller's.
## What the seven report
Identical shape for all seven:
1. Ranked 5–8 hardest places, hardest first. Each gives `path:line` and the unit's name, one to
three sentences on what *specifically* defeated them — branches to hold at once, length, a
misleading name, an algorithm they had no context for, state mutated out of sight, a rule they
had to hunt for elsewhere — and whether anything resolved it (a comment, the charter, the spec,
a test) or it stayed opaque.
2. The single unit they would least want to be asked to modify, and why.
3. What they expected to be hard and found easy.
4. Prose debt: which documentation they needed, what it cost to find, and — separately — which
prose they read that told them nothing the code was not already saying. Both halves matter.
Panels reliably find that the answers exist and are unfindable, which is a different defect
from prose that should not exist at all, and the fixes are opposite: index the first, delete
the second.
5. The four dimension scores, the overall, and one sentence per number naming the anchor it sits
against and the concrete thing that holds it there. A score with no named cause is discarded.
Vary only the extender's ranking: *hardest to understand well enough to mirror, extend or reuse*,
and the unit they would least want to have to mirror.
## What the two architects report
The standard is *Code That Fits in Your Head*: at the top level a bounded number of areas, few
enough to hold at once; pick one, descend, find again a bounded number. Guidelines, not rules —
an architect who says a break is justified is giving you a finding too.
The method is what makes these seats work, so enforce the order:
1. **README and the file tree only.** No source file yet. Write down the top-level areas they
believe exist and what each does, what they expect inside each source directory, anything whose
purpose the name does not give, and anything the README led them to expect and does not hold.
That map goes in the report verbatim, before they learn how right it was.
2. **Descend breadth-first**, one level at a time, forming an expectation before opening each
directory, recording how many distinct things each level demanded.
3. **Read enough implementation to check the map** — not to understand every unit. Under a sampled
depth that is the sample; under a full sweep it is still "enough to check the map", because
these two seats judge shape.
Report: the verbatim map; where it was wrong and how costly each correction was; level-by-level
fan-out with the worst level named; names that mislead, concepts with two names, one name over two
concepts, areas they could not name; what they would restructure, ranked, with files and costs;
what the structure gets right. Give the greenfield seat a week-one question (could a new senior
ship in a week, what would they break first, would the structure have warned them) and the
inherited seat a 3am question (a real bug shape from this project — walking in cold, how long to
the right file) plus where it rots first and where the next two features would land. Both close
with the same four dimensions and overall as the other seven.
## The score
Every panelist ends with a comprehension score, 1 to 10, for the project as a whole. The scale is
absolute, so two panels run on two projects produce comparable numbers — a panelist scoring against
their own expectations of *this* codebase has produced a number that means nothing next to
another. Put these anchors in every brief, verbatim.
- **1 — Spaghetti.** No boundary holds. Finding where a behaviour lives is grep archaeology;
changing it safely is guesswork, and the reliable technique is to change it and see what breaks.
No map the reader builds survives contact with the code.
- **3 — Navigable only by the initiated.** The map lives in people's heads, not in the layout. A
newcomer needs a guide and a wrong guess is normal. Weeks to a first safe change.
- **5 — Honest middle.** Legible where somebody cared, absent where nobody did. A competent reader
takes an area in a day or two with rereads and some wrong turns. Some names lie; some state is
shared and unowned.
- **7 — Predictable.** The layout answers "where does this live" without asking a human. The hard
parts are hard because the problem is hard, and they are few, localized and marked. A cold
senior is productive in a week and knows which corners to fear.
- **9 — Near duress-proof.** Symptom to file to unit with no detour. Each piece states or
enforces its own invariants; nothing needs a second document open beside it. What remains is the
problem's own difficulty.
- **10 — Duress-proof.** Hungover, stressed, production down, gun to your head: you land in the
right place first try, and the code tells you what it guarantees before you have finished
reading it. Reserve it; few real codebases earn it.
Even numbers mean between the neighbours. Alongside the overall, each panelist scores four
dimensions on the same scale:
- **Navigation** — from a symptom to the right file and unit, cold.
- **Locality** — understanding and changing one piece without holding the rest: hidden state,
order dependence, action at a distance.
- **Shape** — bounded fan-out level by level, and names that tell the truth.
- **Self-sufficiency** — whether the code stands without a document open beside it.
**The worst dimension caps the overall**: the overall may not exceed the lowest dimension plus
one. A single catastrophic dimension is not averaged away, because that is the one that bites at
3am.
Score the reading experience, not the ambition — a hard problem earns no bonus, or the gate
becomes unfalsifiable ("our domain is hard"). Panelists note the problem's intrinsic difficulty
separately: it changes what floor is fair to demand, never the score.
**Comparing projects needs a calibration seat.** Independent panels drift, however absolute the
anchors. When scoring more than one project, run one extra panelist who reads *all* of them —
shallowly, because its job is ranking and gap size, not depth — and reports the order and how far
apart they sit. Where it disagrees with the per-project panels' ordering, its ordering wins and the
absolute numbers shift to match, because a rank across three projects read by one reader is more
reliable than three absolutes read by different ones.
**But weight the calibrator's ordering below the deep panels, and expect its error to grow with
project size.** It over-scores the best-laid-out project, because a shallow read sees the
Navigation and Shape that good layout advertises and never reaches the Locality cost. It
under-scores the largest, which gets the shallowest read. Use the calibrator to align two runs onto
one scale; use the four-seat panels for each project's number. Where they disagree, say so and
give both.
**Tying two runs together: give the calibrator the anchor project, never the anchor's score.** A
second run needs one project the first run already scored, read by the new calibrator so the two
scales can be aligned. Hand it that project as an ordinary target and compute the offset yourself
by comparing its number to the old one. Telling it "the previous run scored this 7.5" destroys the
measurement — it is a stronger contaminant than reading order, tool access or persona.
## The comparison
Aggregate first, then compare. Never present a single reader as the finding.
- Consensus table: each place, how many readers named it and at what ranks, and the metric's
numbers for it beside them.
- The metric's own worst, and what the panel said about each — including silence, which is a
result.
- The forced-choice tally for "least want to modify".
- Look hardest for **contradiction**: something the metric ranks worst that readers call clear is
worth more than any agreement. Look also for a **pair the metric cannot separate** — two units
with identical numbers, one unanimously hard and one named clearest, ends the argument on its
own.
- Name the hardness drivers the readers used in their own words. Expect them to be things no
per-unit metric sees: state shared across unit boundaries, order dependence between steps,
correctness whose proof lives in another file or in what a downstream reader does to this unit's
output, a rule recorded only in an unindexed wall of prose, and a silent failure mode. That last
one is usually why a small unit outranks a large one.
State the honest limit: a panel measures what is hard *now*, while a gate ratchets what gets
written *next*. Their verdict refutes using a metric to rank existing code or to justify breaking
it apart; it does not by itself prove a ceiling worthless against future drift.
## After
Panelists also surface real defects in passing — dead values, unstated invariants, doc gaps.
Verify each in the code yourself before reporting it; a panelist's incidental claim is a lead, not
a finding. Everything that survives lands per `~/.claude/CLAUDE.md` → "Working loop".