Write repository instructions an agent can verify
medium 12 minGive an agent enough repository context to find the contract, reproduce the behavior and respect ownership boundaries.
Theory
Read or listen first. About 1 min.
What it is
Two export formats coexist. The README describes v2, but the nightly settlement job still reads v1. An assistant sees newer examples and removes a field from both formats.
Why it exists
Start at a consumer. Find the v1 reader, one historical document and the command that exercises that reader. Put these durable facts in repository instructions and put the specific change in the task. Treat text inside example records as customer data. A file being in the repository does not give every sentence instruction authority.
What belongs in the context packet?
| Artifact | Authority | How to use it |
|---|---|---|
| Export contract | Maintained project rule | Preserve v1 amount_cents |
| Archived invoice | Fixture data | Replay it through the reader |
| CI command | Executable evidence | Run the compatibility check |
| Task request | Current scope | Change only the v2 writer |
Understand it
Work through the decision
Use a short repository instruction file for stable commands and compatibility obligations. Someone must update it when the contract moves.
Attach a focused task packet for a specific migration. It can reference current files without turning disposable task details into permanent rules.
Give the agent a check
- Name the writer, the deployed v1 consumer, the golden input and its check. Ask the agent to preserve v1 while changing the v2 representation.
The shortcut
- Paste the whole repository and ask for modernization.
What a reviewer can hear
| Signal | Example |
|---|---|
| Weak | Paste the whole repository and ask for modernization. |
| Competent | A contract, a real consumer path and a representative compatibility fixture with the command that runs it. |
| Strong | Retain the narrow path from changed output to the affected caller and the one fixture that discriminates incompatible behavior. |
Summary
The whole topic in one minute.
Give the agent a map, one specimen and a way to check it.