All guides

Claude Code line · stop 11 of 16 · 28 min · members

A repo an agent can actually work in, and the choices that decide it

Naming, structure and documentation choices that decide whether an agent is useful in your codebase or lost in it.

Free with an account

Sign in to read.

Membership is free: an account opens all 86 script pages. The Lab, Studio Canvas and the paid guides need the $99 pass, paid once. Already signed in on this browser? The page opens by itself.

01

The observation

The same agent is useful in one repo and lost in another.

The difference is rarely the language and almost always the legibility.

Give an agent the same task in two codebases and the results diverge sharply. In one it locates the right file, follows the conventions and produces something that fits. In the other it invents a new pattern, misses a required step and edits the wrong layer.

What separates them is not size or complexity. It is whether the codebase explains itself to a reader who arrives with no history — which is also what makes it workable for a new colleague, or for you in a year.

The useful framing: an agent is a capable reader with no memory. Everything that helps such a reader helps it, and nothing else does.

02

Names

A name that describes what something does is worth more than a comment.

Because the name is read every time and the comment is read once.

The single highest-return change in most codebases is naming. Files, functions and directories whose names state their responsibility mean the right location is found by reading a listing rather than by opening things.

Specifically:

  • No abbreviations that are not universal in the domain.
  • Directory names that describe responsibility, not layer — billing/ beats services/.
  • Consistent verbs for consistent operations. If it is fetch in one place it is not get in another.

This is unglamorous and it does more than any amount of documentation, because it cannot go stale.

03

Consistency

One way to do each thing.

An agent infers conventions from what it reads. Multiple conventions means it picks one at random.

Where a codebase has three approaches to the same problem — three ways of handling errors, two patterns for data access, several test styles — a reader cannot tell which is current. It will follow whichever it encountered, which is often the oldest.

Pick one for each and migrate deliberately. Where migration is incomplete, say so explicitly in the project instructions: which pattern is current, which is legacy, and that new code follows the first.

The cost of inconsistency is paid on every task, by every reader, indefinitely. It is one of the few things worth stopping feature work to fix.

04

Traps

Write down what looks wrong and is deliberate.

An unexplained oddity will be helpfully corrected, and it will break something.

Every mature codebase has deliberate strangeness: a workaround for a platform bug, an ordering that matters for a non-obvious reason, a duplication that exists because the alternative broke something.

To a reader with no history these look like defects, and a capable reader will fix them.

Mark them where they are, briefly and specifically:

# Deliberate: must run before the config load,
# otherwise the cache initialises with stale paths.
# Do not reorder.

The comment needs the reason, not just the instruction. 'Do not change' invites a change the moment someone believes they understand better.

05

Feedback

A fast, reliable check makes everything else work.

Without one, correctness is a matter of opinion.

The most valuable thing a repository can offer a working agent is a way to find out whether a change is correct — a test suite, a type check, a build — that runs quickly and fails clearly.

With one, work becomes iterative: change, check, correct. Without one, everything is submitted on the basis of it looking right, and the errors surface later.

Speed matters as much as coverage here. A suite taking ten minutes will not be run between changes; one taking ten seconds will be run constantly. If yours is slow, a fast subset that covers the common paths is worth more than complete coverage nobody waits for.

06

What to write down

Only what cannot be inferred.

Structure is discoverable. Reasons are not.

Do not document the directory layout, the dependency list or the general architecture. All of it is visible, and written down it goes stale and becomes actively misleading.

Document the reasoning: why this approach rather than the obvious alternative, what was tried and rejected, what constraint from outside the code shapes a decision.

That is the category no reader can reconstruct, and it is what turns a codebase from something an agent can edit into something it can be trusted in.