recover-spec
Skill4 starsChanged 2 months agoMITView on GitHub
Work backwards from an existing codebase to the specification nobody wrote. Fixes the system boundary, inventories every surface, traces the core data path end to end, recovers the data model and its unenforced invariants, and reads the tests as the only stated requirements the system has. Grades every statement observed, inferred, intended, undecided, or contradiction, and returns the undecided list as the questions to put to whoever owns the system. Use when saying "work backwards to a spec", "there's no spec for this", "write the spec from the code", "what does this system actually do", "document this before we change it", or before planning work on a codebase you didn't build.
In this repository27 other files it gives its agents.
- ai-contract-auditSkill
- anonymizeSkill
- compose-from-interviewSkill
- compose-scoreSkill
- coverage-gapsSkill
- create-specSkill
- create-ticketSkill
- design-printed-partSkill
- find-dead-codeSkill
- generate-readmeSkill
- generate-svgSkill
- implement-specSkill
- plan-specSkill
- repo-auditSkill
- review-intakeSkill
- review-principlesSkill
- review-skillSkill
- review-specSkill
- review-ticketSkill
- run-gatesSkill
- secret-scanSkill
- stress-test-planSkill
- tech-doc-reviewSkill
- test-firstSkill
- third-party-complianceSkill
- triage-alertSkill
- verify-doneSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Run it with --questions-only first if you have a conversation with the system's owner coming up
- Distinctive: line 62
A run with zero undecideds has failed: No real system is fully specified by its source.
- Distinctive: line 74
Changing the system: write the change with create-spec, citing the recovered spec as its baseline, and plan that.
- Distinctive: line 83
Read the Limitations section in SPEC.md.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
recover-spec
Most skills that work from a spec assume the spec exists. Most inherited systems arrive without one. This skill recovers the specification from the artifact, and grades every statement by what it rests on, so a description of the code never gets mistaken for a statement of what the code must do.
It reads. It never changes the code, never fixes what it finds, and never decides which behaviour was intended.
Quick start
- Read SPEC.md for the grades, the procedure and the rules
- Follow CUSTOMIZE.md to bind the output location, the grade markers and who answers the questions
- Run it with
--questions-onlyfirst if you have a conversation with the system's owner coming up
Arguments
$1: repository path (required)--as-spec: writeSPEC.mdinto the repo, where it will govern future work--as-reading: write a dated reading outside the governed tree, recording what you found. This is the default when neither flag is given--subsystem <name>: recover one subsystem. With--as-specit goes todocs/specs/{name}.md; as a reading it goes beside the whole-system reading (docs/readings/{name}-spec-{YYYYMMDD}.md). Run after a whole-system pass, never instead of one--against <ref>: pin the reading to a branch, tag or SHA. Defaults toHEAD, recorded either way--questions-only: skip the document and return the undecided list alone
What it does
- Pins the reading to a commit and records whether the tree was clean
- Fixes the system boundary: what's in, what's out, what nobody has declared
- Inventories every surface where work enters, leaves or persists
- Traces the core data path end to end, one hop at a time
- Recovers the data model and the invariants the code assumes but doesn't enforce
- Reads the tests as the system's only stated requirements
- Finds behaviour nobody owns, and promises nothing implements
- Writes the spec per references/spec-skeleton.md, grades every statement, and hands it to a document quality review
The grades
| Grade | Means |
| Observed | The path was read end to end, or exercised by a test |
| Inferred | One reading says this. Nothing exercises it |
| Intended | A comment, README, ticket or contract says so. The code may disagree |
| Undecided | The code makes a choice and nothing records whether it was a decision |
| Contradiction | Two parts of the system disagree, or code and docs disagree |
A run with zero undecideds has failed. No real system is fully specified by its source. A clean question list means the run stopped at description.
Downstream
The recovered spec is not yet a plan. Answer the undecideds with the owner first: plan-spec won't plan a requirement still graded undecided or contradiction. Then one of two routes:
- Bringing the system into line with its spec (fixing the contradictions
and candidate defects the owner ruled on): run plan-spec on the root
SPEC.mdby path. It writesPLAN.mdandTASKS.mdbeside it. - Changing the system: write the change with create-spec, citing the recovered spec as its baseline, and plan that.
Either way, implement-spec works the tasks forward and review-spec checks the result.
Before you rely on it
Read the Limitations section in SPEC.md. The grades are only as honest as the discipline behind them, and nothing in the output will look different if a grade was promoted to make the document read better.
See CUSTOMIZE.md to adapt this skill for your organization.
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.

