skills/doc-manager/SKILL.md
Generate or update docs to match the code, citing each claim to path:line and asking on ambiguity; runbook docs also get a check-only validation script. Don't use for API-reference autogen (JSDoc/Sphinx), landing pages, or CLAUDE.md/AGENTS.md.
npx skillsauth add luongnv89/skills doc-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Keep a project's Markdown documentation true to the code. Every run ends with each doc updated, verified-current, or flagged — and every non-obvious claim traced to a source. Scope is Markdown only (README.md, docs/*.md, per-component READMEs); docstrings and comments are read as source-of-truth but not rewritten.
Prime directive — never invent. If the code does not show it and the user has not stated it, do not write it. When a fact is unclear or docs conflict with code, ask the user, then record the resolution in docs/DECISIONS.md. A guess is a defect here, not a convenience.
Before creating/updating/deleting any file in the repo, sync the current branch:
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
If the tree is dirty: git stash push -u -m "pre-sync" → sync → git stash pop. If origin is missing, or rebase/stash conflicts occur, stop and ask before continuing.
Validate before starting; if any fails, stop and surface it:
git --version ≥ 2.30. Working tree clean or stashable.git remote get-url origin resolves (needed for sync). If absent, ask before any pull/rebase.command -v mmdc.Work one doc at a time. For each doc in the inventory, pick the path:
| Situation | Path | |---|---| | A needed doc does not exist | A. Generate | | A doc exists but may not match the code | B. Reconcile | | A doc or a section of one covers deploy / release / setup / operational process | also run C. Runbook add-on |
A single run usually mixes A and B across the inventory. C is additive — it layers onto whichever of A/B produced runbook content. Classify at the section level: a doc that mixes a runbook section with reference content gets C applied to the runbook section only, not the whole file.
git branch -r | head -20 (feat/, feature/, …).feat/doc-manager (or the repo's convention).Read the codebase to establish ground truth, then build the doc inventory.
README.md, docs/*.md, per-component README.path | purpose | status(unknown) | is-runbook?. Also list needed-but-missing docs implied by the code (e.g. code has a deploy/ dir but no docs/deployment.md).Present the inventory to the user and confirm scope before editing. Do not silently expand beyond confirmed scope.
For each doc, run its path. Cite as you write — do not defer citation to a review pass.
A. Generate — create from code analysis. Include only what the code (or a user answer) supports. Structure by relevance to project type; skip categories that don't apply.
B. Reconcile — diff doc against code:
path:line still resolves to the claimed fact (line numbers rot when code above them shifts — repoint or FLAG stale cites).<!-- FLAG: unverified — {what} -->) and ask the user; never silently keep or delete.verified-current, touch nothing.Citation rule (checkable). Every non-obvious factual claim carries an inline source. Forms, in order of preference:
src/server.ts:12 (a specific value: port, default, flag).src/retry.ts:8-24 or config.ts:4, env.ts:11 for an emergent fact that spans lines/files (e.g. "retries 3× with backoff", "config merges env > file > defaults"). This is a real citation, not a FLAG — FLAG is only for facts the code cannot confirm.src/router.ts when the fact is the file's overall behavior and no line is more authoritative.The server listens on port 8080 (
src/server.ts:12).
Cite unless trivially obvious. Default to citing; the burden is on treating a claim as obvious, not on citing it. Section intros and definitions of common terms are obvious. Anything a reader could get wrong — ports, commands, paths, env vars, versions, endpoints, defaults, behavior — is not. This coverage check is a judgment pass (grep can't verify it), so err toward over-citing: an uncited factual claim is the exception you must be able to justify.
Decisions log. Every ambiguity you ask about gets appended to docs/DECISIONS.md:
## YYYY-MM-DD
- Q: {the ambiguity}
- A ({who}): {resolution}
- Source: `path:line` (if code-derived)
Use the run date; never fabricate one. Get it from the environment context, not a guess.
For any deploy/release/setup/operational doc, produce a check-only validation script and keep a troubleshooting log. Read references/runbook-validation.md for the script contract, template, and the fix→document loop. In short:
scripts/validate-<name>.sh) is check/dry-run by default. It verifies preconditions and asserts expected state idempotently. Every destructive or outward-facing step is gated behind --run-destructive or a MANUAL: marker — never auto-run.scripts/, and the runbook section links to it. On a read-only tree, emit the script inline and run it once so you can report its --check outcome.--check). Classify each failure: if the doc/check is wrong, fix it; if it is an operator env/tool/network prerequisite the agent cannot satisfy here, document it as a runbook prereq or MANUAL: step (do not weaken or drop the check just to force green). Append only real fix findings to docs/troubleshooting.md, cited.FLAG. Grep for stray FLAG: markers — none may remain unaddressed.[text](path) resolves.docs/*.md is reachable from README.md or another doc within one hop.updated, verified-current, or flagged (with the flag surfaced to the user). None left unknown.validate-<name>.sh (run --check to confirm — on a writable tree it's committed; on a read-only tree it's emitted inline and run once). Agent-satisfiable local/static checks must pass; env/tool/network gaps that only an operator can close are documented as prereqs/MANUAL: rather than forced to exit 0. docs/troubleshooting.md reflects any real fix applied.mmdc if available).Present a change summary. Do not commit unless the user explicitly asks.
README.md and docs/*.md reconciled to the code, each non-obvious claim cited to path:line.docs/DECISIONS.md — append-only log of every ambiguity resolved with the user.scripts/validate-<name>.sh (check-only) linked from the section, plus docs/troubleshooting.md updated with fixes found during validation.FLAGs.A run passes when all hold:
path:line or marked FLAG and raised with the user. Zero unresolved FLAG markers at close.updated, verified-current, or flagged; none left unknown or known-stale-and-untouched.docs/DECISIONS.md with the resolution and (where applicable) source.validate-<name>.sh that is linked, well-formed, and gates every destructive step (run --check to confirm). Acceptance is not "exit 0 at all costs": agent-satisfiable local/static checks must pass; genuine operator prerequisites (missing env vars, tools, remote health outside this environment) may leave --check non-zero when documented as prereqs or MANUAL: steps — never invent a green path by dropping real checks. On a read-only tree the script is emitted inline and its --check outcome reported instead of committed. docs/troubleshooting.md records any real fix applied.docs/*.md is orphaned.main/master; all changes on a feature branch. No commit without an explicit user request.README.md, add docs/ files the code justifies. Still cite everything.DECISIONS.md. Do not delete the user's prose without asking.FLAG and report it — do not fill the gap.--check outcome (including documented prereq failures).After each major step, emit:
◆ [Step Name] ([step N of M] — [context])
··································································
[Check 1]: √ pass
[Check 2]: × fail — [reason]
[Criteria]: √ N/M met
____________________________
Result: PASS | FAIL | PARTIAL
Use √ pass, × fail, — for context. Per-phase checks:
Ground-truth read, Inventory built, Scope confirmedClaims cited, Conflicts flagged, Decisions loggedValidate script check-only, Destructive steps gated, Troubleshooting updatedNo unresolved FLAGs, Links resolve, Inventory closed, Runbook script well-formeddocs/ category applies.verified-current).tools
Run Herdr loops for one open GitHub issue (resolve→review→fix) or an existing PR (review→lazy fixer) until CLEAN. Don't use for plain resolution without review, review-only/no-fix requests, backlog automation, or merging.
tools
Manage AI agent fleets in Herdr: split root + sub-agents into one tab as a tiled grid, message/wait/read via herdr CLI, steer any pane. Use for Herdr multi-agent fleets. Don't use for tmux, screen, or non-Herdr terminals.
testing
Generate a diagram and route to the right engine — draw.io XML (precise, editable, C4, swimlanes) or Excalidraw JSON (hand-drawn, sketch, wireframes). One entry for flowcharts, architecture, ER, sequence, mind maps. Don't use for Mermaid or slides.
data-ai
Sync a GitHub fork with upstream while keeping unmerged feature branches and open PRs mergeable. Use for rebase on upstream, PR conflicts, integration main. Don't use for git init, releases, or non-fork repos.