Documentation
Author, audit, and maintain project documentation across every surface that matters: the agent hot path (CLAUDE.md, AGENTS.md, .claude/rules/), the human entry point (README.md), and the narrative tier (docs/).
This is the single home for "make our docs good" work — bootstrapping a new project, refreshing docs after a sprint, writing a README that converts readers into users, or auditing the whole estate for drift.
This SKILL.md is a thin index. Detailed authoring rules live in
rules/*.md and load on demand. Worked examples are in
references/*.md. Literal scaffolding skeletons are in templates/*.md.
Do not preload everything — load only what the current phase asks for.
Mode Detection
Parse $ARGUMENTS (first token) and route to one of four modes.
A second token of --auto is a cross-cutting modifier (see below).
| Mode |
Default |
Trigger |
init |
|
"init", "bootstrap", "scaffold", or $ARGUMENTS == "init" (no existing CLAUDE.md). |
update |
yes |
Default when a CLAUDE.md already exists. "update", "sync", "refresh", "drift". |
readme |
|
"readme", "write a README", "audit the README", or $ARGUMENTS == "readme". |
audit |
|
"audit", "review the docs", "doc health check", or $ARGUMENTS == "audit". |
--auto modifier — append to any mode token to enable the autonomous-workflow guardrails.
Always passed by autonomous-workflow Phase 5 as Skill("documentation", "update --auto").
When --auto is present, also load auto-update-loop.md before executing the mode's phases.
Disambiguation rule when no mode token is passed:
- If
./CLAUDE.md does not exist → init.
- Else if
./README.md does not exist and the user mentioned "README" → readme.
- Else →
update.
State the detected mode in one line before continuing:
Mode: update
Target: this repo
Shared Foundations (every mode loads these)
Regardless of mode, every run is governed by three rule files.
Load them once on first need; do not reload them per phase.
| File |
What it gives you |
rules/content-routing.md |
The Content Routing Rubric — which surface owns which kind of content, and why. |
rules/placement-resolver.md |
The innermost-wins algorithm for picking the specific file (root vs nested CLAUDE.md, .claude/rules/ with paths:, etc.). |
rules/writing-style.md |
Google + Microsoft style highlights, plain-language rules, and the agent-readable docs pattern. |
Then add the rule files specific to the mode:
When invoked from a non-interactive caller (autonomous-workflow Phase 5) — passed as --auto — also load auto-update-loop.md.
That rule adds four non-negotiable gates (hot-path budget, recurrence threshold ≥ 2, removed-rules ledger, optional ablation) plus the JSON run-summary contract the caller logs.
Mode: init — bootstrap docs from scratch
Use when a project has no Claude configuration and (optionally) no documentation.
Produces a tiered setup sized to the project's complexity.
Phases
- Detect existing config. Check for
CLAUDE.md, .claude/, AGENTS.md,
README.md, docs/. If any exist, ask via AskUserQuestion:
Overwrite / Merge missing / Skip / Abort.
- Triage complexity. Count source files, directories, monorepo
packages, CI/CD presence. See
references/archetypes.md
for the small / medium / large thresholds and the per-tier file matrix.
- Detect tech stack. Package manager (pnpm / npm / yarn / bun / poetry /
cargo / go.mod), test framework, linters, monorepo signal (
nx.json,
turbo.json, pnpm-workspace.yaml).
- Scaffold the tier's files. Use
templates/claude-md.md,
templates/readme.md, and the docs/* templates listed in
rules/docs-folder.md.
- Wire
.gitignore. Add .claude/settings.local.json idempotently.
- Summarize. Print a table of created files with line counts and
audience.
Hard rules during init
- Route by kind, not by file pattern. Rules go to
CLAUDE.md /
.claude/rules/; narrative goes to docs/; marketing goes to README.md.
See rules/content-routing.md.
- CLAUDE.md ≤ 200 lines. Anthropic's own threshold — beyond it,
adherence drops measurably.
- README first viewport must answer what is this, does it solve my
problem, can I trust it? See
rules/readme.md for the
above-the-fold checklist.
- Never duplicate content between
CLAUDE.md, README.md, and docs/.
Pick one owner; link from the others.
Mode: update — sync docs with the codebase
Use after work has landed on a branch.
Detects drift, applies targeted fixes, and pushes new rules to the innermost-ancestor destination so the hot path does not bloat over time.
Argument parsing
| Argument |
Default |
Effect |
branch |
yes |
Compare current branch vs the default branch. Default for update. |
recent [N] |
|
Diff the last N commits (default 10). |
paths <glob> |
|
Limit the diff to <glob>. The Placement Resolver still decides destinations. |
nested <dir> |
|
Route all updates for changes under <dir> to <dir>/CLAUDE.md (scaffold if missing). |
pattern <glob> |
|
Discovery-driven — scan files matching <glob> for shared structure, emit one rule. |
holistic |
|
Run holistic-analysis refactor on each affected area before drafting docs updates. |
dry-run |
|
Preview only. Print proposed changes; do not write. |
all |
|
Full audit against the current codebase (no diff). Equivalent to audit mode for sync only. |
Phases
- Detect changes (see
rules/drift-detection.md §1 for git diff
commands and the area-classification table).
- Read current docs — every
CLAUDE.md, .claude/rules/*.md,
docs/**/*.md, AGENTS.md. Build a map of what's documented today.
- Drift analysis. Run deterministic checks first (dead paths,
removed commands, broken
@imports); then semantic checks (architecture
claims, style claims, stale gotchas). See rules/drift-detection.md.
- Holistic analysis (if
holistic was passed) — see
rules/drift-detection.md §4.
- Generate updates. Each proposed change is classified by content
kind, routed via
content-routing.md, and
placed via placement-resolver.md.
Priority tiers: P0 stale fixes apply immediately; P1 new patterns ask
for confirmation; P2 polish skips unless requested.
- Apply (or dry-run report).
- Summarize. Per-file table of changes plus a list of areas
intentionally skipped because Claude can infer them.
Sub-modes inside update
Mode: readme — write or audit a README
Use when the README is the asset under work.
Two sub-modes detected from context:
- No README exists or user says "write a README" → scaffold mode.
- README exists and user says "audit / review / improve" → audit mode.
Scaffold sub-mode
- Detect tech stack and project type (library / app / monorepo root /
CLI tool).
- Render
templates/readme.md with the structure from the standard-readme
spec — see rules/readme.md for the mandatory section
order and the badge selection rules.
- Apply the above-the-fold checklist before declaring done — the
first viewport must carry name, one-line tagline, hero visual or
demo, primary CTA badges, and one install line.
Audit sub-mode
- Read the README.
- Run the README audit rubric in
rules/readme.md §4.
Score each item PASS / WARN / FAIL with one line of evidence.
- End with a prioritized Top 3 fixes list — biggest reader-time
wins first.
Mode: audit — comprehensive documentation health check
Read-only by default.
Produces a structured report covering every doc surface.
Phases
- Inventory. List every documentation file across the repo.
- Per-surface audits:
- Drift checks — full set from
rules/drift-detection.md §3 (dead paths, removed commands, broken @imports, hot-path leakage).
- CI lint coverage — see
rules/maintenance.md for the recommended markdownlint / Vale / alex / lychee stack.
- Prioritized report. P0 (stale / wrong) → P1 (missing high-value content) → P2 (polish).
If the user asks to apply fixes, route to update mode with the audit findings as the input.
Definition of Done
Each mode has a closing gate. Treat any unchecked item as a defect.
init
update
readme
audit
Core Principles
- Right surface, right cost.
CLAUDE.md is auto-loaded — every
line is a recurring token cost. README.md is read once by humans
evaluating the project. docs/ is loaded on demand. Route by these
costs, not by what feels natural to write.
- Innermost-wins. Nested
CLAUDE.md files load only when the agent
is in that subtree. A rule about packages/foo/** placed in
packages/foo/CLAUDE.md costs zero tokens for someone in
packages/bar/. The same rule in root costs everyone, every turn.
- Be prescriptive, not descriptive. Tell the agent what to do; do
not explain concepts. Decision tables and numbered lists beat prose.
- Each document serves exactly one Diátaxis quadrant. Tutorial or
how-to or reference or explanation. If a doc serves two, split it.
- Never duplicate facts across surfaces. Pick one owner; link from
the others. Duplicates always drift.
- Test the docs by removal. "Would removing this cause Claude or a
reader to make a mistake?" If no, delete it.
Anti-patterns (one-liner — full list in rules/ per surface)
CLAUDE.md over 200 lines (Anthropic's own threshold — adherence drops).
- Pattern-scoped rule placed in root
CLAUDE.md instead of .claude/rules/
with paths:.
- README wall-of-badges (>10 badges); TOC for a 60-line README.
docs/ files unreferenced from anywhere (orphans).
- Same fact written in
CLAUDE.md and docs/ — one will drift.
- Narrative paragraphs ("we picked X because Y, the system grew as Z…") in
CLAUDE.md instead of docs/.
- Marketing prose ("blazingly fast," "simply," "easily") with no benchmark.
- README API reference dump — move to
docs/.
- Backslash paths anywhere.
- Time-sensitive claims ("after August 2025…") in any surface.
Cross-tool note: AGENTS.md
agents.md is the cross-tool open spec read by
Codex CLI, Cursor, Aider, Devin, GitHub Copilot, Gemini CLI, and others.
Claude Code reads CLAUDE.md, not AGENTS.md directly.
Two interop options:
- Symlink —
ln -s CLAUDE.md AGENTS.md (simplest; one source of truth).
@import — keep both files but have CLAUDE.md start with @AGENTS.md and put shared content in AGENTS.md.
For mixed-tool teams, prefer the symlink.
For Claude-Code-first teams with cross-tool readers as secondary, prefer the @import.
See rules/claude-md.md §6 for the trade-offs.
Source: mthines/agent-skills — distributed by TomeVault.
1---2name: mthines-agent-skills-documentation3description: Documentation4---56# Documentation78Author, audit, and maintain project documentation across every surface that matters: the **agent hot path** (`CLAUDE.md`, `AGENTS.md`, `.claude/rules/`), the **human entry point** (`README.md`), and the **narrative tier** (`docs/`).9This is the single home for "make our docs good" work — bootstrapping a new project, refreshing docs after a sprint, writing a README that converts readers into users, or auditing the whole estate for drift.1011> **This `SKILL.md` is a thin index.** Detailed authoring rules live in12> `rules/*.md` and load on demand. Worked examples are in13> `references/*.md`. Literal scaffolding skeletons are in `templates/*.md`.14> Do not preload everything — load only what the current phase asks for.1516---1718## Mode Detection1920Parse `$ARGUMENTS` (first token) and route to one of four modes.21A second token of `--auto` is a cross-cutting modifier (see below).2223| Mode | Default | Trigger |24| --------- | ------- | -------------------------------------------------------------------------------------- |25| `init` | | "init", "bootstrap", "scaffold", or `$ARGUMENTS == "init"` (no existing CLAUDE.md). |26| `update` | **yes** | Default when a `CLAUDE.md` already exists. "update", "sync", "refresh", "drift". |27| `readme` | | "readme", "write a README", "audit the README", or `$ARGUMENTS == "readme"`. |28| `audit` | | "audit", "review the docs", "doc health check", or `$ARGUMENTS == "audit"`. |2930**`--auto` modifier** — append to any mode token to enable the autonomous-workflow guardrails.31Always passed by `autonomous-workflow` Phase 5 as `Skill("documentation", "update --auto")`.32When `--auto` is present, also load [`auto-update-loop.md`](./rules/auto-update-loop.md) before executing the mode's phases.3334Disambiguation rule when no mode token is passed:35361. If `./CLAUDE.md` does not exist → `init`.372. Else if `./README.md` does not exist and the user mentioned "README" → `readme`.383. Else → `update`.3940State the detected mode in one line before continuing:4142```43Mode: update44Target: this repo45```4647---4849## Shared Foundations (every mode loads these)5051Regardless of mode, every run is governed by three rule files.52Load them once on first need; do not reload them per phase.5354| File | What it gives you |55| --------------------------------------- | ---------------------------------------------------------------------------------------------- |56| [`rules/content-routing.md`](./rules/content-routing.md) | The Content Routing Rubric — which surface owns which kind of content, and why. |57| [`rules/placement-resolver.md`](./rules/placement-resolver.md) | The innermost-wins algorithm for picking the *specific* file (root vs nested CLAUDE.md, `.claude/rules/` with `paths:`, etc.). |58| [`rules/writing-style.md`](./rules/writing-style.md) | Google + Microsoft style highlights, plain-language rules, and the agent-readable docs pattern. |5960Then add the rule files specific to the mode:6162| Mode | Additional rules to load |63| -------- | ------------------------------------------------------------------------------------------------------------------------- |64| `init` | [`claude-md.md`](./rules/claude-md.md), [`readme.md`](./rules/readme.md), [`docs-folder.md`](./rules/docs-folder.md) |65| `update` | [`drift-detection.md`](./rules/drift-detection.md), [`claude-md.md`](./rules/claude-md.md) |66| `readme` | [`readme.md`](./rules/readme.md) |67| `audit` | All of the above, plus [`maintenance.md`](./rules/maintenance.md) for CI lint stack guidance. |6869When invoked from a non-interactive caller (`autonomous-workflow` Phase 5) — passed as `--auto` — also load [`auto-update-loop.md`](./rules/auto-update-loop.md).70That rule adds four non-negotiable gates (hot-path budget, recurrence threshold ≥ 2, removed-rules ledger, optional ablation) plus the JSON run-summary contract the caller logs.7172---7374## Mode: `init` — bootstrap docs from scratch7576Use when a project has no Claude configuration and (optionally) no documentation.77Produces a tiered setup sized to the project's complexity.7879### Phases80811. **Detect existing config.** Check for `CLAUDE.md`, `.claude/`, `AGENTS.md`,82 `README.md`, `docs/`. If any exist, ask via `AskUserQuestion`:83 **Overwrite** / **Merge missing** / **Skip / Abort**.842. **Triage complexity.** Count source files, directories, monorepo85 packages, CI/CD presence. See [`references/archetypes.md`](./references/archetypes.md)86 for the small / medium / large thresholds and the per-tier file matrix.873. **Detect tech stack.** Package manager (pnpm / npm / yarn / bun / poetry /88 cargo / go.mod), test framework, linters, monorepo signal (`nx.json`,89 `turbo.json`, `pnpm-workspace.yaml`).904. **Scaffold the tier's files.** Use `templates/claude-md.md`,91 `templates/readme.md`, and the `docs/*` templates listed in92 [`rules/docs-folder.md`](./rules/docs-folder.md).935. **Wire `.gitignore`.** Add `.claude/settings.local.json` idempotently.946. **Summarize.** Print a table of created files with line counts and95 audience.9697### Hard rules during `init`9899- **Route by kind, not by file pattern.** Rules go to `CLAUDE.md` /100 `.claude/rules/`; narrative goes to `docs/`; marketing goes to `README.md`.101 See [`rules/content-routing.md`](./rules/content-routing.md).102- **CLAUDE.md ≤ 200 lines.** Anthropic's own threshold — beyond it,103 adherence drops measurably.104- **README first viewport must answer** *what is this, does it solve my105 problem, can I trust it?* See [`rules/readme.md`](./rules/readme.md) for the106 above-the-fold checklist.107- **Never duplicate** content between `CLAUDE.md`, `README.md`, and `docs/`.108 Pick one owner; link from the others.109110---111112## Mode: `update` — sync docs with the codebase113114Use after work has landed on a branch.115Detects drift, applies targeted fixes, and pushes new rules to the innermost-ancestor destination so the hot path does not bloat over time.116117### Argument parsing118119| Argument | Default | Effect |120| ----------------- | ------- | -------------------------------------------------------------------------------------------- |121| `branch` | **yes** | Compare current branch vs the default branch. Default for `update`. |122| `recent [N]` | | Diff the last N commits (default 10). |123| `paths <glob>` | | Limit the diff to `<glob>`. The Placement Resolver still decides destinations. |124| `nested <dir>` | | Route all updates for changes under `<dir>` to `<dir>/CLAUDE.md` (scaffold if missing). |125| `pattern <glob>` | | Discovery-driven — scan files matching `<glob>` for shared structure, emit one rule. |126| `holistic` | | Run `holistic-analysis refactor` on each affected area before drafting docs updates. |127| `dry-run` | | Preview only. Print proposed changes; do not write. |128| `all` | | Full audit against the current codebase (no diff). Equivalent to `audit` mode for sync only. |129130### Phases1311321. **Detect changes** (see `rules/drift-detection.md` §1 for `git diff`133 commands and the area-classification table).1342. **Read current docs** — every `CLAUDE.md`, `.claude/rules/*.md`,135 `docs/**/*.md`, `AGENTS.md`. Build a map of what's documented today.1363. **Drift analysis.** Run deterministic checks first (dead paths,137 removed commands, broken `@imports`); then semantic checks (architecture138 claims, style claims, stale gotchas). See [`rules/drift-detection.md`](./rules/drift-detection.md).1394. **Holistic analysis** (if `holistic` was passed) — see140 [`rules/drift-detection.md`](./rules/drift-detection.md) §4.1415. **Generate updates.** Each proposed change is classified by content142 kind, routed via [`content-routing.md`](./rules/content-routing.md), and143 placed via [`placement-resolver.md`](./rules/placement-resolver.md).144 Priority tiers: P0 stale fixes apply immediately; P1 new patterns ask145 for confirmation; P2 polish skips unless requested.1466. **Apply (or dry-run report).**1477. **Summarize.** Per-file table of changes plus a list of areas148 intentionally skipped because Claude can infer them.149150### Sub-modes inside `update`151152- `update nested <dir>` — see [`rules/placement-resolver.md`](./rules/placement-resolver.md) §4.153- `update pattern <glob>` — see [`rules/placement-resolver.md`](./rules/placement-resolver.md) §5.154155---156157## Mode: `readme` — write or audit a README158159Use when the README is the asset under work.160Two sub-modes detected from context:161162- **No README exists or user says "write a README"** → scaffold mode.163- **README exists and user says "audit / review / improve"** → audit mode.164165### Scaffold sub-mode1661671. Detect tech stack and project type (library / app / monorepo root /168 CLI tool).1692. Render `templates/readme.md` with the structure from the standard-readme170 spec — see [`rules/readme.md`](./rules/readme.md) for the mandatory section171 order and the badge selection rules.1723. Apply the **above-the-fold checklist** before declaring done — the173 first viewport must carry name, one-line tagline, hero visual or174 demo, primary CTA badges, and one install line.175176### Audit sub-mode1771781. Read the README.1792. Run the README audit rubric in [`rules/readme.md`](./rules/readme.md) §4.180 Score each item PASS / WARN / FAIL with one line of evidence.1813. End with a prioritized **Top 3 fixes** list — biggest reader-time182 wins first.183184---185186## Mode: `audit` — comprehensive documentation health check187188Read-only by default.189Produces a structured report covering every doc surface.190191### Phases1921931. **Inventory.** List every documentation file across the repo.1942. **Per-surface audits**:195 - `CLAUDE.md` and `.claude/rules/` — see [`rules/claude-md.md`](./rules/claude-md.md) §5.196 - `README.md` and any per-package READMEs — see [`rules/readme.md`](./rules/readme.md) §4.197 - `docs/` tree — see [`rules/docs-folder.md`](./rules/docs-folder.md) §3.1983. **Drift checks** — full set from [`rules/drift-detection.md`](./rules/drift-detection.md) §3 (dead paths, removed commands, broken `@imports`, hot-path leakage).1994. **CI lint coverage** — see [`rules/maintenance.md`](./rules/maintenance.md) for the recommended `markdownlint` / Vale / alex / lychee stack.2005. **Prioritized report.** P0 (stale / wrong) → P1 (missing high-value content) → P2 (polish).201202If the user asks to apply fixes, route to `update` mode with the audit findings as the input.203204---205206## Definition of Done207208Each mode has a closing gate. Treat any unchecked item as a defect.209210### `init`211212- [ ] Tier picked and the per-tier files matrix matches the output.213- [ ] `CLAUDE.md` ≤ 200 lines.214- [ ] `README.md` first viewport (~600 px) carries name, tagline, hero,215 primary badges, install line.216- [ ] `docs/` tree (medium / large only) has `README.md`, `architecture.md`,217 `contributing.md`, and (large only) per-package nested folders.218- [ ] `.gitignore` contains `.claude/settings.local.json`.219- [ ] No content is duplicated across `CLAUDE.md`, `README.md`, and `docs/`.220221### `update`222223- [ ] Every P0 drift item from `drift-detection.md` §3 either fixed or224 explicitly skipped with reason.225- [ ] Every new rule placed via `placement-resolver.md` — no pattern-scoped226 rule landed in root `CLAUDE.md`.227- [ ] Every `@import` added resolves to a real file.228- [ ] No content moved into `docs/` while a duplicate remains in229 `CLAUDE.md` (or vice versa).230- [ ] Summary table delivered.231232### `readme`233234- [ ] All mandatory standard-readme sections present in correct order.235- [ ] Above-the-fold checklist passes.236- [ ] Badge count between 0 and 10, and every badge represents signal237 (build / version / license / coverage / security / contributors),238 not noise (stars / forks / "made with love").239- [ ] Every relative link resolves.240241### `audit`242243- [ ] Every file in the inventory has a row in the report (PASS / WARN /244 FAIL or N/A).245- [ ] Top 3 fixes list at the end, ordered by reader-time impact.246- [ ] No file mutations — `audit` is read-only.247248---249250## Core Principles2512521. **Right surface, right cost.** `CLAUDE.md` is auto-loaded — every253 line is a recurring token cost. `README.md` is read once by humans254 evaluating the project. `docs/` is loaded on demand. Route by these255 costs, not by what feels natural to write.2562. **Innermost-wins.** Nested `CLAUDE.md` files load only when the agent257 is in that subtree. A rule about `packages/foo/**` placed in258 `packages/foo/CLAUDE.md` costs zero tokens for someone in259 `packages/bar/`. The same rule in root costs everyone, every turn.2603. **Be prescriptive, not descriptive.** Tell the agent what to do; do261 not explain concepts. Decision tables and numbered lists beat prose.2624. **Each document serves exactly one Diátaxis quadrant.** Tutorial *or*263 how-to *or* reference *or* explanation. If a doc serves two, split it.2645. **Never duplicate facts across surfaces.** Pick one owner; link from265 the others. Duplicates always drift.2666. **Test the docs by removal.** "Would removing this cause Claude or a267 reader to make a mistake?" If no, delete it.268269---270271## Anti-patterns (one-liner — full list in `rules/` per surface)272273- `CLAUDE.md` over 200 lines (Anthropic's own threshold — adherence drops).274- Pattern-scoped rule placed in root `CLAUDE.md` instead of `.claude/rules/`275 with `paths:`.276- README wall-of-badges (>10 badges); TOC for a 60-line README.277- `docs/` files unreferenced from anywhere (orphans).278- Same fact written in `CLAUDE.md` *and* `docs/` — one will drift.279- Narrative paragraphs ("we picked X because Y, the system grew as Z…") in280 `CLAUDE.md` instead of `docs/`.281- Marketing prose ("blazingly fast," "simply," "easily") with no benchmark.282- README API reference dump — move to `docs/`.283- Backslash paths anywhere.284- Time-sensitive claims ("after August 2025…") in any surface.285286---287288## Cross-tool note: AGENTS.md289290[`agents.md`](https://agents.md/) is the cross-tool open spec read by291Codex CLI, Cursor, Aider, Devin, GitHub Copilot, Gemini CLI, and others.292Claude Code reads `CLAUDE.md`, not `AGENTS.md` directly.293294Two interop options:295296- **Symlink** — `ln -s CLAUDE.md AGENTS.md` (simplest; one source of truth).297- **`@import`** — keep both files but have `CLAUDE.md` start with `@AGENTS.md` and put shared content in `AGENTS.md`.298299For mixed-tool teams, prefer the symlink.300For Claude-Code-first teams with cross-tool readers as secondary, prefer the `@import`.301See [`rules/claude-md.md`](./rules/claude-md.md) §6 for the trade-offs.302303---304> Source: [mthines/agent-skills](https://github.com/mthines/agent-skills) — distributed by [TomeVault](https://tomevault.io).305<!-- tomevault:4.0:skill_md:2026-05-22 -->