agentleFS
chatquillchatquill/claude-code-websites/.claude/skills/reverse-document/SKILL.md

reverse-document

Skill1 starsChanged 22 days agoMITView on GitHub

Generates studio documents (PRD, feature specs, architecture, data model, API contract, ADRs) from an existing codebase by spawning specialist agents in parallel, marking every inferred statement. Use after /adopt on a brownfield project, or when code exists without docs.

18 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never overwrite an existing doc: if the path exists, write <name>.reverse.md beside it and say so.

    line 34
  2. Very specific:

    Use bash .claude/scripts/next-number.sh docs/architecture/adr for ADR numbers.

    line 52

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Reverse-document an existing codebase

Reads the code and writes the documents the rest of the studio expects, so /feature-spec, /dev-story and the gates have something to work from. Every statement the code does not prove is marked [inferred], and every gap is marked [TO CONFIRM]. It never changes application code.

Inputs

  • project.yaml (run /adopt first if stack keys are empty: stop and say so)
  • paths.code_root, the routes, handlers, schema/migrations, tests, README
  • git log for decision archaeology
  • Templates: prd, feature-spec, architecture, data-model, adr, api-contract.yaml
  • Argument: limit to one document family (default all)

Phases

Phase 1: Plan

Inventory with Glob: route files, API handlers, schema files, integration SDK imports, test files. Show the plan: which documents will be generated, by which agent, at which path. Under modes.automation: ask, ask "Generate these?" once for the whole set (paths listed); the agents then write the named paths.

Never overwrite an existing doc: if the path exists, write <name>.reverse.md beside it and say so.

Phase 2: Generate in parallel

Spawn independent agents together (one message, several Agent calls):

AgentOutput
lead-backend (+ configured backend specialist)docs/architecture/api/openapi.yaml (or a ## API Contract per spec for server-action/RPC stacks)
data-engineer (+ configured data specialist)docs/architecture/data-model.md: entities, relations, constraints, indexes, from schema/migrations
technical-directordocs/architecture/architecture.md + ADRs for decisions evident in code (framework, DB, auth provider, hosting) as docs/architecture/adr/NNNN-<slug>.md with Status: Accepted (reverse-documented)
product-managerdocs/specs/features/<slug>.md per user-facing feature area found in routes

Brief each with: the code paths to read, the template, the exact output path, "mark unproven claims [inferred] and unknowns [TO CONFIRM], cite file paths for every behaviour", and "do not modify code".

Use bash .claude/scripts/next-number.sh docs/architecture/adr for ADR numbers.

Phase 3: PRD (after Phase 2)

Spawn product-manager with the feature specs and README to draft docs/product/prd.md. The problem, audience and metrics usually cannot be read from code: leave them [TO CONFIRM] and list them as questions.

Phase 4: Review

Report: documents written, the number of [inferred] and [TO CONFIRM] markers in each, contradictions found (e.g. tests asserting behaviour the routes no longer have), and the top questions for the user. Append a line to production/session-state/active.md.

Output

Docs under docs/product/, docs/specs/features/, docs/architecture/.

Rigor

  • minimal: architecture + data model only unless asked.
  • full: also a threat model draft (security-lead) for auth, payments and uploads.

Next step

Answer the [TO CONFIRM] questions, then /project-stage-detect and /help.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.