change-a-command-contract
Skill1 starsChanged 3 months agoMITView on GitHub
Change a vat command's output, exit code, or flags without breaking a published contract.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-a-lint-ruleSkill
- cut-a-releaseSkill
- add-a-lint-ruleSkill
- change-a-command-contractSkill
- cut-a-releaseSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Write the failing test first.
- Very specific: line 32
Update the command's Usage string so it names every flag the command registers, and no flag it does not.
- Very specific: line 34
Update the ## vat <name> section in docs/COMMANDS.md.
- Very specific: line 35
If the change alters a file vat writes, update docs/SPEC.md in the same commit.
- Distinctive: line 37
If a subcommand was added or removed, update the command table in README.md.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Change a command contract
When to use this
A change touches what a command prints, what it exits with, which flags it
accepts, what its --json emits, or what it writes to disk. All five are
contracts somebody else may already depend on, including scripts nobody in this
repository can see.
The --json shape is the easiest to change by accident, because it is usually a
struct in another package with no test naming the command it serves. Adding a
field is safe. Renaming or removing one is not, and neither is adding rows to a
list a consumer filters — if the new rows need different handling, give them a
field that says so rather than leaving a consumer to guess from the others.
The rule this implements
A change to a command's output, exit code, or flags needs, in the same commit:
the code, its test, and the matching row in docs/COMMANDS.md. Split across two
commits, the reference describes a program that does not exist yet.
Steps
- Write the failing test first. For CLI behaviour that means a real command
against a real temporary workspace — see the fixtures in
internal/cli. - Make the change.
- Update the command's
Usagestring so it names every flag the command registers, and no flag it does not. - Update the
## vat <name>section indocs/COMMANDS.md. - If the change alters a file vat writes, update
docs/SPEC.mdin the same commit. It is normative and other tools may already read what it describes. - If a subcommand was added or removed, update the command table in
README.md. make check.
What catches you if you skip a step
TestEveryTopLevelCommandHasASectionInTheReference— a new top-level command with no## vat <name>heading.TestTheReferenceDocumentsNoCommandThatDoesNotExist— a heading left behind after a removal.TestEveryFlagACommandRegistersAppearsInItsUsageLineandTestEveryUsageLineAdvertisesOnlyFlagsThatExist— theUsagestring and the registered flags, compared in both directions.TestTheReferenceStatesTheExitCodesTheCodeUses— the documented exit codes against the ones the code can return.
Shell completion is generated by walking the command tree, so a new subcommand needs no completion edit.
When it must stop
An exit code is the loudest part of the contract, because CI reads it and a human does not. Changing what a code means — rather than adding a new one — is a decision about everybody's pipelines, not a refactor. Report it and let a human choose.
The same applies to removing a flag. Deprecating it in the help text costs nothing; removing it breaks a script silently.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

