← docsDocumentation

/document

Read code, write contracts.

Reads a codebase using evidence-driven analysis and writes documentation contracts. Outputs SKILL.md contracts for discovered patterns. Does not guess — reads actual code and documents what is there.

Category

Documentation

Execution

Codebase scan → contract drafts

Goal

Document an existing codebase by reading code and producing evidence-based documentation contracts.

Scope

Applies to

  • +Undocumented codebases
  • +Partially documented projects
  • +Onboarding new team members

Does not cover

  • Writing new code
  • Modifying existing code

Triggers

"Document this codebase""Analyze project structure""Create docs for this code"

Inputs

  • Project root path
  • Existing docs (if any)
  • Target documentation format

Invariants

  • 01Evidence-driven: every claim cites a file:line
  • 02No guessing — read the code
  • 03Output follows the contract format (Goal..Review gate)

Procedure

  1. Step 1Scan project structure (directories, entry points, configs)
  2. Step 2Read key files: main modules, routes, models, tests
  3. Step 3Identify patterns and architecture
  4. Step 4Draft documentation contracts for each pattern
  5. Step 5Verify each claim against source code

Outputs

  • Documentation contracts (SKILL.md format)
  • Architecture overview
  • Pattern catalog

Review Gate

  • [ ]Every claim has a file:line citation
  • [ ]Contracts follow the standard format
  • [ ]No undocumented public interfaces