/trace:doctor [path]from trace
Validates a TRACE-adopted scope against TRACE conventions: doc structure, marker pairs, AGENTS.md spec, ADR numbering/immutability, working-note banners, and relative links. Guides fixes for ADR number collisions from merged branches. Useful after merges, before releases, or when structure feels off.
Ships in trace. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use Claude Code’s Read, Glob, Write, and Edit tools for file operations. Use AskUserQuestion for closed choices and normal chat for open questions. Invoke referenced skills with the Skill tool. Resolve script paths from this installed skill; respect the session’s permissions.
You are running TRACE's structure validator: a deterministic script finds the violations; you fix them.
Bias to act. Every fix lands as an uncommitted edit the developer reviews with git diff and can revert, so apply fixes automatically when you are confident. Ask only when you are genuinely unsure which fix is right, or when the action would overwrite content that can't be reconstructed. When you do ask, batch every uncertain item into one question — never a drip of approvals.
Before doing anything, read scope-resolution.md — how the optional [path] argument resolves into a scope root.
Resolve the scope per scope-resolution.md — $ARGUMENTS if given, otherwise cwd. Then:
node "${CLAUDE_SKILL_DIR}/../../scripts/doctor.js" check <scope-root>
The JSON report covers: canonical doc structure and marker pairs, the root AGENTS.md against its spec, ADR filenames / sequential numbering / collisions / post-ship edits, working-note banners and Status: headers, and relative-link resolution across the docs tree and root AGENTS.md. If the resolved docs_folder in the report is wrong, re-run with --docs <folder>.
Monorepos: when the scope contains nested scopes (project-level AGENTS.md files under the root), add --all — the script discovers every scope and returns one report per TRACE-adopted scope (scope_rel names each). Triage and fix per scope; the phases below apply to each in turn. Two things --all deliberately does not validate: an AGENTS.md inside another scope's docs folder is docs content (a folder guide), never a scope; and a scope with a bare AGENTS.md but no TRACE config or marked docs folder comes back under context_only — mention those as information ("run /trace:init <scope> if it should carry the tree"), since adopting a scope is a decision, not a repair.
Clean report (ok: true, no warnings): say so in one line and stop.
Otherwise, list the findings in one short block (errors first, plain language, file + convention broken; note any skipped checks), sort each into auto-fix or needs input per the rules in Phases 3–4, state the split in one line ("fixing N automatically; M need your input"), and proceed. No approval gate to start — the working tree is the approval surface.
adr-collision)Two files sharing a number is almost always a branch merge: each branch minted the same next number for a different decision. The files are fixed mechanically; the references to that number are not — a comment written before the merge means one specific decision, and only reading it tells which. Never bulk-rewrite references.
Decide which file keeps the number. The file that shipped first keeps it: the one that reached the default branch first (the report's summary.adr_base). Check with git log <adr_base> --first-parent -m --diff-filter=A --format="%cI %H" -- <each-file>; its number has been citable for longer. A clear date order decides it — announce the choice and proceed. Ask only when the signal is genuinely absent (no git, same commit, identical dates).
Renumber the other file to the report's suggested_free number:
node "${CLAUDE_SKILL_DIR}/../../scripts/doctor.js" migrate <file> <NNNN> <scope-root>
The script renames the file, rewrites its own title heading, and returns references_to_old_number — every place in the scope (code comments, docs, other ADRs, supersession banners) that mentions the old number, with file, line, and the line's text.
Resolve each reference by reading it. Every scope numbers its own ADRs, so first check each entry's nearest_scope: a reference whose nearest scope differs from the collided ADR's scope refers to that scope's own sequence — leave it unchanged; it isn't part of this collision. For the rest, open enough surrounding context to judge which decision the reference means, then split by confidence:
> Superseded by <old-number>. banner is always in this bucket unless the superseding ADR's own text names its target — pointing it at the wrong decision silently corrupts the record.Re-run refs <old-number> afterwards; every remaining hit should be one you deliberately left. Include the full resolution list (reference → kept / rewritten → why) in the Phase 5 summary.
Auto-fix (apply, then report):
CLAUDE.md → write the forwarder (See @AGENTS.md for more information.). Overwriting is safe only when the existing content is a forwarder variant; anything with real content goes to the ask bucket.AGENTS.md → write it from context-folder-template.md — only when no AGENTS.md exists there at all.Status: missing → insert the banner line right under the title and Status: Research note.node "${CLAUDE_SKILL_DIR}/../../scripts/copy-doc-structure.js" <docs-folder> (copies only missing files; never overwrites).Needs input (batch into one question):
AGENTS.md or CLAUDE.md with real, non-template content in the way of a marker or forwarder — never overwrite prose you didn't write.Report only (never auto-fix):
/trace:agents-md-setup (review mode); piecemeal patching fights that skill's interview.git diff <shipped_in> -- <file>, where shipped_in is the commit that first brought the ADR to the default branch) and recommend reverting or a superseding ADR via /trace:adr. Rewriting records is not doctor's call.Re-run the check. Summarise: every fix applied (this list is the developer's review guide — all of it is uncommitted, git diff shows the exact changes), the collision resolution list from Phase 3, what was asked and decided, and what was left with the reason.
node "${CLAUDE_SKILL_DIR}/../../scripts/doctor.js" check — without invoking this skill's fix flow.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
11 skills in this plugin
/adrRecord an architecture decision as a lightweight, immutable ADR in the scope's docs folder. Owns the ADR template, numbering, and write. Invokable directly for a direct-path decision, or by /trace:spec at handoff./agents-md-setupSet up or review the project's AGENTS.md through an interactive interview with the developer/commit-messageDraft a single commit's message — imperative-mood title plus a short why body, optional decision bullets, plain text (no markdown). Use when the developer explicitly asks for a commit message, asks to fix a message before amending, or asks the agent to perform the commit on their behalf.npx claudepluginhub axakon/trace --plugin trace