/docs:docs sweep [path] | phase <N>from docs
Keep a repo's documentation true to the code. "sweep" rewrites the README, splits CLAUDE.md files, adds or fixes JSDoc/TSDoc and removes comments that only restate the code. "phase N" does the end-of-phase docs update (plan status, changelog, CLAUDE.md, README, runbook, privacy check) and opens the "docs: Phase N docs update" PR. Use when the user asks to update or clean up docs, or to write a phase's docs update.
Ships in docs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Arguments: $ARGUMENTS
sweep [path] (or no arguments): do Sweep mode below, limited to the path if one is given.phase <N>: do Phase mode below for phase N. If N is missing, ask for it.Read .claude/docs.json if the project has one. Every field is optional; a missing file, invalid JSON or a
version other than 1 means "use the defaults" (say so in the report). Defaults:
{
"version": 1,
"plan": "docs/plan.md",
"changelog": "CHANGELOG.md",
"runbook": "docs/ops-runbook.md",
"milestone": "Phase {n}",
"docsIssue": "Phase {n}: Docs update",
"prTitle": "docs: Phase {n} docs update",
"claudeMdLines": { "root": 50, "other": 40 },
"extraSteps": []
}
{n} is the phase number. A path that doesn't exist in the repo is skipped, not created (except the runbook,
see Phase mode). extraSteps are plain-English steps for this project only; phase mode does them in order and
lists each one in the PR.
Scope: the path given after sweep (if none, the whole repo).
Documentation only. Never change behaviour: no renamed identifiers, no reordered logic, no "while I'm here" fixes. If you find a bug, report it at the end instead of fixing it.
CLAUDE.md (the root one and any in subfolders), package.json (scripts, dependencies, exports), the lint
config, CI workflows, and every source file in scope. Docs describe the code as it is, so
read the code before writing about it.Every function, class, method, exported constant, type, interface and option field in scope gets a JSDoc block. In TypeScript, types come from the code, so JSDoc carries meaning, not types.
@param name - … for every parameter, in order, names matching the code exactly. Say what
it is and any default: "Default 1000". For an options object, document its fields on the
options type, and on the parameter write "see {@link FooOptions}".@returns … when it returns something useful. Describe the value, not the type.@throws Error if … when it throws on purpose.@template T - … for type parameters (the TypeScript JSDoc tag, not @typeParam).@example for the main entry points and anything whose usage isn't obvious: a short,
real call taken from how the repo uses it.{@link Name} to point at related types or functions in the same codebase./** … */ at the top of a file): what the file is for, in two or three
lines. Leave out @module unless the repo already uses it.// eslint-disable-next-line … -- reason comments exactly where they are.Keep a comment only if it says something the code can't: why a choice was made, a quirk of an external system, a workaround and what it works around, a non-obvious constraint.
Remove: comments that restate the code (// loop over items), commented-out code,
outdated TODOs, banner and divider comments, and notes that are already in the JSDoc.
Remove comments that only made sense to whoever wrote them. Code and docs are read by people who never saw how they were written. Delete or rewrite anything that depends on that history or on a conversation, for example:
The test: would a new contributor, reading only this file today, understand the comment and need it? If the comment hides a real reason, rewrite it as a plain present-tense "why" ("ESLint can't load a .ts config without an extra loader") or move the reason to the commit message. Otherwise delete it.
Same rule for docs: READMEs, CLAUDE.md and JSDoc describe what is true now, in the present
tense. No "updated to…", "we now…" or "previously…"; that belongs in commit messages.
Move: explanations of a value or field into JSDoc on that value or field, so editors show them on hover.
Shorten: keep "why" comments to one or two lines.
Rewrite the README so a stranger can understand, install, use and change the repo without reading the code first. Use the sections that apply, in this order:
.nvmrc or engines), other tools.Rules for the README:
If the repo has other docs (docs/, guides), check them against the code the same way and fix
anything out of date.
Claude Code loads the root CLAUDE.md in every session, and a folder's CLAUDE.md only when it
works in that folder. Keep them split that way, so each session reads as little as possible:
CLAUDE.md: what applies everywhere (what the repo is, commands, rules for every file
or test, language conventions, dependencies) and a table pointing to each folder guide, with a
line telling the reader to open a folder's guide before working there.CLAUDE.md: the rules, helpers and examples for that folder only. Create one when a
folder has rules of its own, or when a section of the root file only matters there; move that
section out of the root file.package.json scripts). All must pass.tmp=$(mktemp -d)
git worktree add -q "$tmp/old" HEAD && ln -s "$PWD/node_modules" "$tmp/old/node_modules"
npx tsc -p "$tmp/old" --removeComments --noEmit false --declaration false --declarationMap false --sourceMap false --outDir "$tmp/js-old"
npx tsc -p . --removeComments --noEmit false --declaration false --declarationMap false --sourceMap false --outDir "$tmp/js-new"
npx prettier --write "$tmp/js-old" "$tmp/js-new" >/dev/null
diff -r "$tmp/js-old" "$tmp/js-new" && echo "compiled JavaScript identical"
git worktree remove --force "$tmp/old"
For other languages, read git diff and confirm every changed line is a comment, a docstring
or documentation.Files changed, grouped as JSDoc added, JSDoc fixed, comments removed or moved (including history and note-to-self comments), README sections rewritten. The verification results. Anything you found but did not change (bugs, unclear behaviour, decisions the user should make).
Brings the docs in line with what a phase shipped, then opens one PR. Docs only: never change code.
Uses the GitHub CLI (gh); if it isn't installed or logged in, stop and say so.
Settings come from .claude/docs.json (above). Below, <milestone>, <docsIssue> and <prTitle>
are those settings with {n} replaced by the phase number.
gh issue list --milestone "<milestone>" --state closed --json number,title,body,labelsgh pr list --state merged --search 'milestone:"<milestone>"' --json number,title,body,mergedAt,
plus PRs whose body closes an issue in that milestone.<docsIssue>. Its acceptance criteria are the checklist for this run; if there
is none, say so and use the steps below.<docs issue number>-phase-<N>-docs.In the plan file (plan): mark phase N's status (for example "SHIPPED" and the date) where phases are listed
and in any status line at the top. Record decisions that changed during the phase in the section they
belong to. Never rewrite other phases.
In changelog: add ## [Phase N] - YYYY-MM-DD above the previous phase, using
Keep a Changelog groups (Added / Changed / Fixed / Removed). Move
anything for phase N out of [Unreleased].
Update the ones the phase affected. Keep each within its line budget (claudeMdLines: root, others); check
with wc -l.
runbook: if jobs, triggers, secrets or recovery steps changed. If the phase added any and the file is
missing, create it with: what runs on its own, how to pause it, manual mode, restore, rollback.Do each extraSteps entry in order. If a step needs the user (for example running something only they
can), don't pretend it's done: list it under "Your part" in the PR.
Scan git diff of this branch:
privacy plugin is installed, run its scan and use its rules..claude/privacy.json has "dollarAmounts": true, dollar amounts that look like real values.Report what was checked and what was found. Fix anything real before opening the PR.
Title <prTitle>. The body lists what changed per file, the privacy check result, "Your part" (from
step 6), and ends with Closes #<docs issue number> (only that issue). Move its board card if the project
uses one. The phase's milestone closes after the PR merges.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub benweese/claude-plugins --plugin docs