agentleFS
mfbarimfbari/claude-skill-generate-docs/generate-docs/SKILL.md

generate-docs

Skill5 starsChanged 4 months agoMITView on GitHub

Generates a complete, verified documentation suite for a codebase and wires it into AI-agent context files. Runs a multi-phase explore → generate → verify loop: scans the repo, writes ~15 docs in docs/ (architecture, API reference, database schema, services, glossary, error catalog, security, and more) with Mermaid diagrams, grades every doc A–F on 5 dimensions against the actual source code, and regenerates failing docs until all pass. Then updates CLAUDE.md (progressive-disclosure section) and creates AGENTS.md for cross-tool compatibility. Use when the user asks to document a codebase, generate or refresh project documentation, create a docs/ suite, or bootstrap/update CLAUDE.md or AGENTS.md context files. Harness-agnostic — works with or without subagents.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use commit and code-review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Completion: when ALL docs score A across ALL dimensions, or max retries is reached.

    line 40
  2. Distinctive:

    When the loop ends, print a summary to the console:

    line 86
  3. Distinctive:

    Never invent information: Document only what actually exists in the codebase.

    line 121
  4. Distinctive:

    Never delete human-written CLAUDE.md content: Only manage the marked auto-generated section.

    line 130

“Common” is measured: kept by at least 6 in 10 of the 16 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

generate-docs

You are the orchestrator for a documentation-generation pipeline. Coordinate five phases — Bootstrap → Explore → Generate → Verify → Context Update — in an iterative loop until every document meets grade A on every rubric dimension, or the retry budget is exhausted.

Detailed instructions for each phase live in references/. Read the relevant reference file when you reach that phase (progressive disclosure — don't load them all up front).

PhaseWhat it doesRead
0 — BootstrapDetect/back-up/create CLAUDE.md; note AGENTS.mdreferences/context-files.md
1 — ExploreScan the codebase across 8 domains → docs/_exploration_report.mdreferences/exploration.md
2 — GenerateWrite ~15 docs in docs/ with Mermaid diagramsreferences/generation.md
3 — VerifyGrade every doc A–F against the source → docs/_verification_report.mdreferences/verification.md + references/grading-rubric.md
4 — Context UpdateUpdate CLAUDE.md + write AGENTS.md (progressive disclosure)references/context-files.md

Configuration

  • Max retries: the first argument, if given (e.g. generate-docs 5). If blank or non-numeric, default to 3.
  • Output directory: docs/ at the project root.
  • Passing grade: A on every document and every rubric dimension.
  • Completion: when ALL docs score A across ALL dimensions, or max retries is reached.

How to run the phases (any harness)

This skill is harness-agnostic. Each phase is a batch of independent work that parallelizes cleanly:

  • If your harness supports subagents / parallel tasks (e.g. a Task tool, an agent-spawn primitive, or a workflow engine): dispatch the phase's work as parallel subagents — 8 explorers in Phase 1, up to 15 writers in Phase 2, 1 verifier in Phase 3. Give each subagent the matching references/ file as its instructions, plus its specific brief/doc. Prefer read-only tools for explorers and verifiers.
  • If your harness has no subagents: perform each phase's work yourself, sequentially, following the same references/ files. The output is identical; only the wall-clock time differs.

Whichever mode you use, the phase boundaries, working files, and grading are the same.

Iteration loop

Phase 0: Bootstrap (run once)

iteration = 0
max_retries = first argument or 3

WHILE iteration < max_retries:
    iteration += 1

    IF iteration == 1:
        Run Phase 1 (Explore)
        Run Phase 2 (Generate ALL docs)
    ELSE:
        Run Phase 2 ONLY for docs that scored below A,
        using the verifier's feedback (revision mode). Preserve passing docs.

    Run Phase 3 (Verify)

    IF verdict == PASS:
        Run Phase 4 (Context Update); BREAK → success
    IF iteration == max_retries:
        Run Phase 4 (Context Update, even on partial pass); BREAK → partial success

Print the summary table.

Final output

When the loop ends, print a summary to the console:

📚 Documentation Generation Report
Iteration:  {n} / {max_retries}
Verdict:    {PASS ✅ | FAIL ❌}
CLAUDE.md:  {Created ✨ | Updated 🔄 | Unchanged ─}
AGENTS.md:  {Created ✨ | Updated 🔄 | Unchanged ─}

Document                     CMP ACC CLR DIA COV  Overall
README.md                    ...
architecture.md              ...
tech-stack.md                ...
api-reference.md             ...
database-schema.md           ...
frontend-backend.md          ...
services.md                  ...
workflows-and-triggers.md    ...
devops.md                    ...
glossary.md                  ...
error-catalog.md             ...
testing-strategy.md          ...
environment-setup.md         ...
coding-conventions.md        ...
security.md                  ...

Docs generated:  docs/ (15 files)
Context updated: CLAUDE.md, AGENTS.md
SpecKit-ready:   docs/ structure compatible with /speckit.analyze

On FAIL, also list the specific failing dimensions and the verifier's feedback for each doc.

Critical rules

  1. Never invent information. Document only what actually exists in the codebase.
  2. Always include Mermaid diagrams where the doc table marks them "Required".
  3. Verify against code, not just the exploration report. The verifier reads actual source files.
  4. On retries, only regenerate failing docs — never the whole set.
  5. Preserve passing docs across iterations — do not overwrite docs that already scored A.
  6. The exploration and verification reports are working files (docs/_*.md) — don't delete them.
  7. Be honest about gaps. Flag uncertainties with ⚠️ rather than guessing.
  8. CLAUDE.md stays under ~200 lines total; the auto-generated section under 80. Use progressive disclosure — point to docs, don't duplicate their content.
  9. Never delete human-written CLAUDE.md content. Only manage the marked auto-generated section.
  10. AGENTS.md is tool-agnostic — no Claude-specific syntax; keep it under 120 lines.
  11. Structure for AI agents. Explicit headings, tables, and "Read when" triggers so SpecKit, Cursor, Copilot, and other tools can extract context efficiently.

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.