Updates project documentation (README, AGENT_CONTEXT, ARCHITECTURE, feature docs) after a feature lands. Run before merging.
Ships in correctless. 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.
None: SKILL.md is the whole skill.
Shared constraints apply. Before executing, read
_shared/constraints.mdfrom the parent of this skill's base directory. All constraints there apply to this skill.
You are the documentation agent. Your job is to keep project documentation current after features land. You update README, .correctless/AGENT_CONTEXT.md, feature docs, and suggest .correctless/ARCHITECTURE.md additions.
| Standard | High | Critical | |
|---|---|---|---|
| Scope | AGENT_CONTEXT + feature docs | add Mermaid diagrams | add fact-checking subagent |
| Post-merge | Suggest /cmetrics | Suggest /caudit | Require /caudit |
Determine the effective intensity using the computation in the shared constraints (_shared/constraints.md).
Documentation updates take about 5 minutes. The user must see progress throughout.
Before starting, create a task list:
Between each step, print a 1-line status: "Diff analysis complete — {N} new features, {M} changed behaviors. Checking README..." Mark each task complete as it finishes.
First-run check: If .correctless/ARCHITECTURE.md contains {PROJECT_NAME} or {PLACEHOLDER} markers, or if .correctless/config/workflow-config.json does not exist, tell the user: "Correctless isn't fully set up yet. I can do a quick scan of your codebase right now to populate .correctless/ARCHITECTURE.md and .correctless/AGENT_CONTEXT.md with the basics, or you can run /csetup for the full experience (health check, convention mining, security audit)." If they want the quick scan: glob for key directories, identify 3-5 components and patterns, populate .correctless/ARCHITECTURE.md with real entries, then continue. This takes 30 seconds and dramatically improves output quality.
Step 0: Check prerequisites. Run .correctless/hooks/workflow-advance.sh status to get the current workflow state. Read the Spec: line from the status output to get the spec file path. Derive {task-slug} from the spec file basename (strip the .md extension). Use this task-slug for all artifact path construction below.
If the current phase is not verified, stop immediately and tell the human: "Run /cverify first. The workflow order is: done → /cverify → verified → /cdocs → documented." Check that .correctless/verification/{task-slug}-verification.md exists. If it does not exist, stop and tell the human: "Verification report not found. Run /cverify before /cdocs." Do NOT proceed with documentation work until both checks pass.
git log --oneline -20 to see recent changes.git diff main...HEAD --stat to see what changed on this branch.README.md, .correctless/ARCHITECTURE.md, .correctless/AGENT_CONTEXT.md.Spec: line..correctless/config/workflow-config.json for project commands..correctless/verification/{task-slug}-verification.md — use its findings to inform what to document (new dependencies, architecture changes, etc.).Diff against main. Identify:
Check against the current state of the project:
Update if needed. Present changes to the human for approval.
This is the most important output — every fresh agent reads this first.
Update:
.correctless/antipatterns.mdTarget: under 1500 words. Keep it concise and current.
The .correctless/AGENT_CONTEXT.md Tests-row figure is informational (~N test scripts, INV-007) — the
authoritative test-file count lives in the generated tests/test-inventory.json, read by the
tests/test-ap031-fixture-divergence.sh R-006(c) gate. When the docs phase adds or removes
tests/test-*.sh files, keep that artifact current with the same stage → regen → stage-artifact
ordering the RED/chore phases use (INV-006 / EXT-001/002), consumer-scoped so it no-ops on any
repo lacking the R-006(c) marker:
if [ -f tests/test-ap031-fixture-divergence.sh ]; then
git add tests/test-*.sh 2>/dev/null || true # stage docs-phase test changes first (consumer-scoped, tolerant of no matches — MA-M1)
# Installed-path form when Correctless is installed; source-form fallback for
# the correctless dev repo, where .correctless/scripts/ is absent pre-setup
# (QA-002). BOTH literal `bash …gen-test-inventory.sh write` strings kept.
if [ -f .correctless/scripts/gen-test-inventory.sh ]; then
bash .correctless/scripts/gen-test-inventory.sh write \
|| { echo "gen-test-inventory: FAILED — surface the token and stop"; exit 1; }
else
bash scripts/gen-test-inventory.sh write \
|| { echo "gen-test-inventory: FAILED — surface the token and stop"; exit 1; }
fi
git add tests/test-inventory.json # stage the artifact into the index
fi
Inspect the exit status; on non-zero surface the gen-test-inventory: FAILED token verbatim
and fail the step (RS-006). The no consumer — skipped no-op is exit 0.
For significant features, create or update a doc in docs/features/:
Reference the spec artifact for detailed rules — don't duplicate.
Complementarity note: /cverify detects stale entries and includes them in the verification report. This section acts on those findings and surfaces drift-debt. /cupdate-arch handles comprehensive entry validation of all entries beyond the current feature.
Step 5a: Existing-entry staleness detection — check whether existing .correctless/ARCHITECTURE.md entries need updating BEFORE suggesting new entries:
.correctless/verification/{task-slug}-verification.md). If the verification report does not exist, run your own staleness detection instead of relying on the report: for each .correctless/ARCHITECTURE.md entry whose Enforced at paths were modified by the feature, check if the entry text still reflects current code.stale or path-missing by the report (or identified by your own detection), verify whether the entry text still reflects current code. 1. Update (recommended) — modify this entry to reflect current code
2. Skip — entry is still accurate despite the path change
3. Log as drift debt — create DRIFT-NNN entry for future resolution
Or type your own: ___
Step 5b: Drift-debt resolution prompting — read .correctless/meta/drift-debt.json and surface open items. Dormant when drift-debt.json is absent or has no open items (PAT-019). For each open drift-debt item, present the human with resolution options:
1. Resolve now (recommended) — update the affected entry
2. Keep as debt — defer to a future feature
3. Close — mark as resolved (the drift was intentional)
Or type your own: ___
Resolved or closed items are updated in drift-debt.json (via Edit, not Write — the file already exists) with status: "resolved", a resolved ISO date, and a brief resolution description.
Step 5c: Suggest new entries — if the feature introduced new patterns or conventions:
1. Add (recommended) — add this entry to .correctless/ARCHITECTURE.md
2. Skip — not a pattern worth documenting
3. Modify — change the entry before adding
Or type your own: ___
After writing doc updates, do a spot-check against actual code:
This catches the common failure where documentation is written from spec understanding rather than actual implementation.
For existing docs NOT touched by this run: do they reference code, config, or features that no longer exist? Flag stale docs for the human rather than auto-deleting.
Present all proposed changes to the human for approval before writing.
Structure your output:
Before advancing the state machine, append a workflow summary to docs/workflow-history.md. This file is append-only — never rewrite or delete existing entries. If the file doesn't exist, create it with a # Workflow History header.
Each entry is one paragraph:
### {date} — {feature name}
Branch: {branch}. Rules: {count}. QA rounds: {N}. Findings fixed: {N}. Overrides: {N}. {one-line description}.
The Overrides: {N}. field is included only if the override count is greater than 0. If the override count is 0, omit the field — zero overrides is the normal case and doesn't need annotation.
Read the workflow state file (.correctless/artifacts/workflow-state-{branch-slug}.json): use .branch for the branch name, .qa_rounds for QA round count, .spec_file for the spec path. Count rules from the spec file (count lines matching R-[0-9] or INV-[0-9]). Count fixed findings from .correctless/artifacts/qa-findings-{task-slug}.json if it exists (count entries where .status == "fixed"). Use today's date and the feature name from the spec's # Spec: {title} heading.
Read the override count from the preserved file at .correctless/meta/overrides/{task-slug}-*.json (most recent by filename sort if multiple exist). If no preserved file exists, fall back to the ephemeral override log at .correctless/artifacts/override-log.json (filter entries by current branch and count). If neither file exists, the override count is 0.
Append a dev journal entry to docs/dev-journal.md. This file is append-only — never rewrite or delete existing entries. If the file doesn't exist, create it with a # Dev Journal header.
Each entry is a few paragraphs of prose describing the implementation context — what was built, how it works, and what patterns it uses. This captures knowledge that exists in the agent's context at build time and would otherwise be lost when the conversation ends.
Entry format:
## {date} — {feature name}
{2-4 paragraphs covering:}
- What was built and why (plain language, not the spec's rule format)
- What code was written — files touched, new functions or structures introduced
- How it works — the actual mechanism, not just what it does
- Which patterns and conventions it uses (reference PAT-xxx, ABS-xxx where applicable)
- Design decisions that aren't obvious from the code (why this approach, what was considered and rejected)
Data sources for the entry: the spec (what was intended), git diff main...HEAD (what was actually written), .correctless/ARCHITECTURE.md (which patterns apply), QA findings (what went wrong and was fixed), and the verification report (what was confirmed).
The journal is for future developers (including future agents) who need to modify this feature. Write as if explaining to a colleague who just joined — they can read the code, but they need the "why" and "how it fits together" context that code alone doesn't convey.
If this is the 3rd or more feature where the same architectural pattern has appeared (check .correctless/specs/ for recurring patterns), append to the ## Correctless Learnings section of CLAUDE.md:
### {date} — Convention confirmed: {pattern name}
- Observed in {N} features — treat as established project convention
- Source: /cdocs after {feature slug}
Before appending, read the existing Correctless Learnings section. Search for the heading Convention confirmed: {pattern name} — if an entry with the same pattern name exists, skip. If the ## Correctless Learnings section doesn't exist in CLAUDE.md, create it with the header before appending.
This ensures future spec and review agents know about established conventions without manually updating .correctless/ARCHITECTURE.md.
The single meta artifact this step back-fills is .correctless/meta/pat001-measurement-due.json, created by the path-scoped-rules-pat001-migration feature with a baseline SHA that /cstatus uses to count hook-touching PRs landed after merge. If the field were left null, the MG-003 measurement gate in skills/cstatus/SKILL.md would emit a "null created_at_commit" advisory instead of the real measurement warning — meaning the dogfood experiment never actually measures anything. The field is not the merge commit (which doesn't exist until after merge) — it is the pre-feature baseline on main from which MG-003 counts forward.
Target only that one file — never iterate across the meta directory. Earlier revisions checked every meta artifact for a created_at_commit field, which polluted unrelated features' baselines with this feature's merge-base (#226) and added spurious fields to files that never had one (#192, because jq '.x == null' also matches an absent key). Act on the single path above, and only when it exists and carries a present-null field.
pat001-measurement-due.json is protected by the sensitive-file-guard (SFG) — a naive Edit/Write is blocked (AP-037). Do not edit the file directly. Use the sanctioned sole-writer .correctless/scripts/meta-record.sh pat001-set-created-at <sha> (ABS-047), which sets the field only when it is present and literally null (has("created_at_commit") and .created_at_commit == null), and is an intended no-op otherwise.
Procedure:
.correctless/meta/pat001-measurement-due.json does not exist, silently skip — this is absence-by-design on non-dogfood projects (EXT-004). Do NOT create it and do NOT invoke the writer.created_at_commit is the literal JSON value null — i.e. present and null. If the field is absent, or already non-null, skip: leave the file untouched (do not invoke the writer). This present-null-only guard is the #192/#226 fix.main (MA-L6: a non-main default branch would make git merge-base main HEAD empty and then emit a spurious FAILED token) — and invoke the writer in the same fenced block. Bash tool calls do not share shell state across separate fenced blocks: a SHA derivation split from the writer invocation would read a fresh shell where $SHA is empty and the writer would reject it — the same MA-H2 shell-state-loss hazard as the invocation/rc=$? pairing. Derive the default branch the same way the rest of the codebase does (origin/HEAD, falling back to main), pass the SHA as a discrete argv token (never interpolated into a bash -c string, TB-001), capture the writer's stdout and exit status, and on failure echo the writer's captured meta-record: FAILED <file>: <reason> token verbatim rather than reconstructing a generic string:DEFAULT_BRANCH="$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##')"
[ -n "$DEFAULT_BRANCH" ] || DEFAULT_BRANCH="$(git remote show origin 2>/dev/null | sed -n 's/.*HEAD branch: //p')"
[ -n "$DEFAULT_BRANCH" ] || DEFAULT_BRANCH="main"
SHA="$(git merge-base "$DEFAULT_BRANCH" HEAD)"
out="$(bash .correctless/scripts/meta-record.sh pat001-set-created-at "$SHA")"
rc=$?
if [ "$rc" -eq 127 ]; then
# writer never ran (script absent on an un-re-setup install)
echo "meta-record: FAILED .correctless/meta/pat001-measurement-due.json: writer script not found — run /csetup to install meta-record.sh"
elif [ "$rc" -ne 0 ]; then
# relay the writer's verbatim 'meta-record: FAILED <file>: <reason>' token
printf '%s\n' "$out"
else
printf '%s\n' "$out"
fi
Echo the meta-record: FAILED token verbatim on non-zero so the failure is surfaced. Do not fall back to Write/Edit on the file (SFG-blocked, would silently no-op — PRH-002).
This is a small step but it is the only mechanism that converts the pre-feature main tip into the measurement gate's baseline. Without it, post-merge measurement is silently dormant forever — a bug-by-forgetting class that QA-002 flagged for the pat001 migration and that this instruction prevents for any future feature using the same dormant-gate pattern.
As the last step before advancing the state machine, run scripts/compute-session-cost.sh to compute USD cost for the current feature:
bash .correctless/scripts/compute-session-cost.sh
This reads Claude Code session transcripts and writes a cost artifact to .correctless/artifacts/cost-{branch-slug}.json. The artifact captures all pipeline phases except the current /cdocs invocation itself — an accepted small undercount. After the script completes, read the artifact and append a cost summary line to the workflow-history.md entry: Cost: ${total_cost_usd} (phase breakdown). If the script produces an error JSON or zero cost, omit the cost line rather than writing misleading data.
Advance the state machine:
.correctless/hooks/workflow-advance.sh documented
After advancing, print the pipeline diagram:
At standard intensity:
✓ spec → ✓ review → ✓ tdd → ✓ verify → ✓ docs → ▶ merge
At high+ intensity:
✓ spec → ✓ review → ✓ tdd → ✓ verify → ✓ arch → ✓ docs → ▶ audit → merge
Confirm: "Documentation complete. Your options:
gh pr create (or /cpr-review on your own branch first)git checkout main && git merge {branch}git checkout main && git branch -D {branch}Or type your own: ___
After merging to main:
/cpostmortem to trace which phase missed it/cmetrics periodically to track workflow health and spot trends/caudit for a cross-codebase sweep after major features"See "Progress Visibility" section above — task creation and narration are mandatory.
After documentation is approved: "Consider exporting: /export .correctless/decisions/{task-slug}-docs.md"
If mcp.serena is true in workflow-config.json, use Serena MCP for symbol-level code analysis when verifying documentation accuracy against the codebase:
find_symbol instead of grepping for function/type namesfind_referencing_symbols to trace callers and dependenciesget_symbols_overview for structural overview of a modulereplace_symbol_body for precise edits (not used in this skill — docs is read-only for source)search_for_pattern for regex searches with symbol contextFallback table — if Serena is unavailable, fall back silently to text-based equivalents:
| Serena Operation | Fallback |
|---|---|
find_symbol | Grep for function/type name |
find_referencing_symbols | Grep for symbol name across source files |
get_symbols_overview | Read directory + read index files |
replace_symbol_body | Edit tool |
search_for_pattern | Grep tool |
When running in autonomous mode (mode: autonomous in prompt context), use these defaults instead of pausing for human input.
When dispatched by /cauto, return autonomous decisions in the AUTONOMOUS_DECISIONS_START/AUTONOMOUS_DECISIONS_END format provided in the task prompt.
escalate: always. Default if deferred: skip CLAUDE.md update. Rationale: CLAUDE.md changes alter agent system instructions; writing before human review is irreversible in the pipeline context./cstatus to see where you are. Use workflow-advance.sh override "reason" if the gate is blocking legitimate work.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
documentation-update, readme, architecture-docs, feature-docs
/correctless:cdocsfrom correctless
npx claudepluginhub joshft/correctless --plugin correctless33 skills in this plugin
/carchitectStructured architecture definition. Two modes — reverse-engineer from existing code or greenfield directed discovery. Produces .correctless/ARCHITECTURE.md with machine-referenceable entrypoints YAML and human-readable prose sections./cauditCross-codebase quality audit. Use after a major feature lands or periodically for systemic bug detection. Presets: QA, Hacker, Performance, UX./cautoSemi-auto mode. Orchestrates the full implementation pipeline after human-approved spec review. Runs ctdd, simplify, cverify, cupdate-arch, cdocs, then creates a PR. After /cauto completes, verify the workflow reached the expected end state — if it didn't, re-invoke /cauto to resume./cchoresFully-autonomous issue-resolution pipeline. Selects one open GitHub issue, branches off the fresh default branch, delegates root-cause + TDD fix to /cdebug (autonomous mode), verifies, runs the full regression suite, and — only if everything is green and CI-clean — opens a PR that closes the issue. Fail-closed: any inability to produce a verified fix aborts with an issue comment and no PR, preserving evidence. The issue→PR sibling of /cauto./ccontributeOpen source contribution workflow. Learns the target project's conventions, patterns, and CI requirements before writing code. Generates a PR that matches what maintainers expect./cdashboardGenerate a self-contained HTML dashboard with metrics and artifact browser. Opens via file:// protocol.Other plugins' skills for the same job