agentleFS
Mi9-LLCMi9-LLC/agent-skills/skills/document-generate/SKILL.md

document-generate

Skill2 starsChanged 5 months agoMITView on GitHub

Write documentation FILES — Diataxis tutorials, how-to guides, reference pages, and explanations — for a named feature, module, file, or whole project, grounded in end-to-end code research done before a word of prose; also adds a short cross-link line in the README or docs index. Use whenever the user wants docs produced or refreshed: "write docs for this", "generate documentation", "document this feature / module / project", "create a tutorial for X", "write a how-to for X", "add reference docs", "update the docs to match the code". Do NOT trigger for: answering a how-does-X-work question in conversation (just answer it — no files are wanted), authoring CLAUDE.md or AGENTS.md agent context, designing a feature that is not built yet (new-feature), or decomposing an approved plan into feature specs (convert-plan-to-feature).

  • Commits and pushes

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ios-clean, ios-fix and 9 more.

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.
  • Saqlain-811Skill

    ios-clean

    Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)

    Also in 5 projects that use this

  • Saqlain-811Skill

    ios-fix

    Autonomous iOS bug fixer. (gstack)

    Also in 5 projects that use this

  • bastosSkill

    ios-design-review

    Review iOS app UI/UX design quality using Apple's design principles and the Liquid Glass-era design language from WWDC25/26. Use when asked for a design review, UX critique, visual design assessment, or evaluation of an app's interface quality, design intent, alignment with the new Apple design system, or usability. Triggers: "design review", "UX review", "visual design critique", "review the UI", "does this design work", "evaluate this interface", "design feedback", "Liquid Glass review".

    Also in 5 projects that use this

  • ShreyRaviSkill

    sync-gbrain

    Keep gbrain current with this repo's code and refresh agent search guidance in CLAUDE.md. Wraps the gstack-gbrain-sync orchestrator with state probing, native code-surface registration, capability checks, and a verdict block. Re-runnable, idempotent. Use when: "sync gbrain", "refresh gbrain", "re-index this repo", "gbrain search isn't finding things". (gstack)

    Also in 5 projects that use this

  • ShreyRaviSkill

    setup-gbrain

    Set up gbrain for this coding agent: install the CLI, initialize a local PGLite or Supabase brain, register MCP, capture per-remote trust policy. One command from zero to "gbrain is running, and this agent can call it." Use when: "setup gbrain", "connect gbrain", "start gbrain", "install gbrain", "configure gbrain for this machine". (gstack)

    Also in 5 projects that use this

  • seek888Skill

    open-gstack-browser

    Launch GStack Browser — AI-controlled Chromium with the sidebar extension baked in. Opens a visible browser window where you can watch every action in real time. The sidebar shows a live activity feed and chat. Anti-bot stealth built in. Use when asked to "open gstack browser", "launch browser", "connect chrome", "open chrome", "real browser", "launch chrome", "side panel", or "control my browser". Voice triggers (speech-to-text aliases): "show me the browser".

    Also in 4 projects that use this

  • +2 more from Saqlain-811
  • +1 more from ShreyRavi

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every example and factual claim in the docs meets one of three evidentiary classes, in strict preference order:

    line 54
  2. Distinctive:

    Never used where execution was feasible.

    line 66
  3. Very specific:

    Read the entry points: README, the manifest (package.json / pyproject.toml / *.csproj / go.mod), main entry files, existing docs.

    line 115
  4. Distinctive:

    Read the target's implementation end-to-end — not just signatures.

    line 117
  5. Distinctive:

    Read the target's tests — they encode intended behavior and edge cases.

    line 118
  6. Distinctive:

    Read what the target depends on and what depends on it.

    line 119
  7. Very specific:

    Whole-project scope — discovery may be delegated: When the target is the whole project and it spans many modules, steps 1–6 above MAY be …

    line 136
  8. Distinctive:

    Iron-law tensions surface here: If a matrix-prescribed quadrant cannot be produced to the evidence standard (execution infeasible and the …

    line 178
  9. Very specific:

    Update the docs index / sidebar when one exists (a doc framework's nav/sidebar config counts).

    line 221
  10. Distinctive:

    Every new doc reachable within 2 clicks from the README.

    line 224
  11. Distinctive:

    Read it when an illustration of the whole workflow would help.

    line 276

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

document-generate

Research the whole, then write the parts. Take one named feature, module, or project, read its implementation and its tests end-to-end, decide what a reader needs in each of the four Diataxis quadrants, get the partition plan approved, and only then write the documentation files — every example verified, every claim traceable to code read this session.

Write surface: documentation files in the resolved docs home, plus minimal cross-link lines in the README and any existing docs index or sidebar — nothing else. CLAUDE.md and AGENTS.md are never edited. Nothing is committed or pushed. And no doc file is written before the partition plan is approved.

Bash is for read-only research and side-effect-free example execution only — never git commit, never git push, never anything that mutates the repo.

Why this skill exists

Documentation written without research describes half the feature — the half that happened to come up. Documentation written without structure mixes a tutorial's hand-holding into the reference table and buries the API surface inside a narrative. And examples typed from imagination don't run. Each failure mode has a specific counter here: archaeology before prose, one Diataxis quadrant per reader mode, and an evidence class for every example.

The four quadrants:

  • Tutorial — learning-oriented: takes a newcomer to a working result.
  • How-to — task-oriented: accomplishes one specific goal.
  • Reference — information-oriented: the complete, factual surface.
  • Explanation — understanding-oriented: why it works the way it does.

The iron law — no unverified example, no untraceable claim

Every example and factual claim in the docs meets one of three evidentiary classes, in strict preference order:

  1. Executed — the example actually ran, side-effect-free, during this run.
  2. Traced — every identifier, signature, type, default, and constraint in it was read at a real file:line this session. API claims in prose always meet at least this bar.
  3. Illustrative — concrete values are synthesized (a sample API response, the state a multi-file tutorial reaches mid-way, a simplified diagram), but the shape is traced: every field and identifier in it verified at a file:line, and the doc labels the example illustrative. Never used where execution was feasible.

The law binds anything presented as copy-pasteable code or literal API surface. Explicitly-labeled pseudo-code and ASCII/Mermaid diagrams are exempt from execution, but their identifiers must still be real (traced). An example that meets no class gets rewritten until it does, or cut — and if cutting it would gut a quadrant the partition matrix prescribes, surface that tension at the approval gate; never silently thin an approved plan. Verification notes go in the completion report, not the doc files.

Workflow

Step 0 — Scope, artifact, and docs home

Which artifact is wanted. A bare "document this project / this repo" with no signal about the artifact means one clarifying question before any research: human-facing docs (this skill), a CLAUDE.md / agent-context file, or a session handoff (session-handoff)? Ask once, then proceed on the answer.

Diff- and PR-anchored asks. "Update the docs for this PR" / "document the changes I just made" — don't auto-proceed from the diff. Ask the user to name the features or modules to document, and say why: documentation describes the code as it exists now; a diff can point at targets, but it is not the documentation source.

The target. A named feature, module, or file — or the whole project on an explicit whole-project ask. Never silently widen scope: documenting the named target completely beats documenting the project thinly.

Docs home resolution, first match wins:

  1. Target-local convention — the target's package/module tree or its siblings already keep docs somewhere (a per-package docs/, a references/ pattern): mirror the nearest sibling.
  2. Repo-level docs/ — follow its existing layout and naming.
  3. Doc-framework config (Docusaurus / MkDocs / VitePress / Nextra — identification table in the references file): follow its format and register new pages in its sidebar/nav.
  4. None of the above → plain Markdown under a new root docs/.

Genuinely ambiguous — two live conventions, or an unclear target — ask.

Step 1 — Codebase archaeology (never skipped)

The quality of the docs is bounded by this step, and no documentation prose is written before it completes.

  1. Map the structure with Glob (works on every platform; no shell piping).
  2. Read the entry points: README, the manifest (package.json / pyproject.toml / *.csproj / go.mod), main entry files, existing docs.
  3. Read the target's implementation end-to-end — not just signatures.
  4. Read the target's tests — they encode intended behavior and edge cases.
  5. Read what the target depends on and what depends on it.
  6. Harvest design-intent comments: NOTE:, WHY:, DESIGN:.
  7. Build the concept map:

    Target: [feature/module name]
    Purpose: [one sentence — what problem it solves]
    Key concepts: [the 3–5 things a reader must understand]
    Public surface: [functions, commands, options, endpoints]
    Dependencies / dependents: [what it needs; what relies on it]
    Edge cases: [from tests and error paths]
    Design decisions: [non-obvious "why" choices]
  8. Close with: "Researched N files, K public-surface items, M concepts, J design decisions."

Whole-project scope — discovery may be delegated. When the target is the whole project and it spans many modules, steps 1–6 above MAY be run in parallel subagents (Agent), one per module or module group, each returning that module's concept map and file inventory — file paths, public surface, test files, design-intent comments — which this run merges into the single concept map above.

Delegation covers DISCOVERY ONLY — per-module concept maps and file inventories. The writer still personally reads, at a real file:line in this session, every identifier it puts in a doc. Citation evidence never comes from a subagent.

Step 2 — Diataxis partition and the approval gate

Classify each entity to document and apply the decision matrix:

Entity typeTutorial?How-to?Reference?Explanation?
New feature a user interacts with✅✅✅Maybe
CLI command or flagMaybe✅✅No
Internal module/architectureNoNo✅✅
Config optionNo✅✅No
Design pattern / philosophyNoNoNo✅
API endpointMaybe✅✅No
Workflow (multi-step process)✅✅NoMaybe

Emit the partition plan — one row per entity-quadrant pair the matrix prescribes, with the action and the exact file path:

Partition plan:
  entity        quadrant     action  file
  csv parser    reference    new     docs/reference-csv-parser.md
  csv parser    how-to       new     docs/how-to-parse-large-files.md
  csv parser    explanation  extend  docs/design.md (exists — merge)

Collisions are extend rows. A planned file that already exists — from a previous run or under a different name — becomes an extend row, not a new file. Merge mechanics live in references/quadrant-templates.md §8, "Collision policy detail".

Iron-law tensions surface here. If a matrix-prescribed quadrant cannot be produced to the evidence standard (execution infeasible and the shape untraceable), flag that row in the plan with the proposed resolution — illustrative-labeled examples, or dropping the quadrant — and let the user decide at the gate. Never silently thin the plan after approval.

The gate. One AskUserQuestion, batched: approve as-is / adjust / cancel. "Adjust" gets one follow-up asking which rows to drop, re-quadrant, or re-path. Split into more calls only if the tool's four-question limit forces it. If the question cannot be asked or goes unanswered, stop: write nothing, and report exactly what was blocked. There is no doc-count threshold below which the gate is skipped.

A re-run after an interruption is just a normal run: partially-written files surface as extend rows in the new plan and are regenerated to standard.

Steps 3–6 — write, in this order

Read references/quadrant-templates.md now — the four templates, per-quadrant rules, and the anti-mixing table live there. Write reference first: it establishes the vocabulary every other quadrant links to. Then explanation, then how-to, then tutorial. The completion report states the order actually followed.

  • Step 3 — Reference. Covers 100% of the target's public surface, with types, defaults, and constraints at the grade of "accepts a string (max 256 chars, ^[a-z-]+$)" — never just "accepts a string". No why; that belongs in explanation.
  • Step 4 — Explanation. Leads with the problem, names trade-offs explicitly ("chose X over Y because Z"), and links to reference instead of repeating it.
  • Step 5 — How-to. Title starts with "How to", every step is actionable, a Verification section always, Troubleshooting whenever the task can fail.
  • Step 6 — Tutorial. Visible result within 3 steps, every step shows a change, exact commands the reader types, ends with "What you built".

Step 7 — Cross-link and discoverability

  • Cross-quadrant links: reference ↔ how-to both ways; tutorial links to both.
  • One link line per new doc in the README's documentation section. If the README has no such section, append a minimal ## Documentation section — heading plus link lines, nothing else — and say so in the report.
  • Update the docs index / sidebar when one exists (a doc framework's nav/sidebar config counts).
  • CLAUDE.md and AGENTS.md: never.
  • Every new doc reachable within 2 clicks from the README.
  • Broken-link check: every ](path) target in the new and extended docs exists on disk. A ](path) target is resolved relative to the directory of the doc file containing the link, not the repository root.

Step 8 — Quality gates

Fix failures before reporting — don't report them as caveats.

  • Accuracy — every example appears in the report's verification list with its evidence class; every API description matches code read this session; no stale names from renamed or removed entities.
  • Completeness — reference covers 100% of the named target's public surface; how-tos cover the top tasks a reader would attempt; the tutorial reaches a working result in ≤3 steps.
  • Voice — written for a smart reader who hasn't seen the code; jargon glossed on first use; active voice; "You can now…", never "The system provides…".

Step 9 — Report; never commit

End with a structured summary. Read references/example-and-report.md §1 now and follow that report skeleton exactly.

Secrets. Examples never contain live-format credentials — placeholder format only (sk-...EXAMPLE, AKIA...EXAMPLE). A live-format string found in source while documenting is never copied into a doc: put a placeholder in the doc and note the finding in the report.

Never commits, never pushes — staging included. No git add, no git commit, no git push. This skill needs Edit and Bash to do its job, so unlike this catalog's read-only skills there is no disallowed-tools belt enforcing its never-rules — they are workflow discipline, and they bind exactly as written.

When NOT to use this skill

  • "How does X work?" asked in conversation — answer it in the conversation. No files are wanted; produce none.
  • CLAUDE.md / AGENTS.md / agent context — not written by this skill.
  • Designing a feature that doesn't exist yet — new-feature; this skill documents code as it exists.
  • Splitting an approved plan into feature specs — convert-plan-to-feature.
  • An automated stale-docs sweep across a diff — not in this catalog; Step 0 redirects a diff-anchored ask to named targets.

Worked example

An end-to-end run — archaeology, partition, gate, report — is in references/example-and-report.md §2. Read it when an illustration of the whole workflow would help.


Adapted from the /document-generate skill in garrytan/gstack (MIT, © 2026 Garry Tan). Rebuilt for this catalog: the commit / push / PR-body-update tail is dropped (this skill never commits); the gstack-redact binary becomes the placeholder-credentials rule; the confirm-only-above-5-docs threshold becomes an always-on partition-plan approval gate; the accuracy checkbox becomes the executed / traced / illustrative evidence rule; the boil-the-ocean default narrows to complete-for-the-named-target; upstream's recommended inline-summaries-plus-standalone-files output narrows to standalone files plus minimal link lines; and the gstack machinery (preamble, telemetry, brain sync, question tuning, learnings, checkpoint mode, context recovery, /document-release chaining) is dropped.

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.