/forge:fg-doctorfrom forge
Read-only integrity health check for forge projects. Surveys .forge/ state contract and docs/manifests, reports inconsistencies with severity and fix hints. Exits 0/1/2 for CI gating.
Ships in forge. 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.
This is not a stage of the forge loop. It is an on-demand, read-only utility (like fg-status / fg-map) that answers a different question than fg-status: fg-status reports "where am I" (progress + the next step), fg-doctor reports "is the state healthy" (integrity violations). It is forge's answer to the harness-engineering init.sh health check (ADR-0019) — forge's state contract is hand-edited Markdown, so it can silently break, and nothing else actively verifies it.
It writes nothing and never auto-fixes — it surveys, classifies each finding by severity, and prints an actionable fix hint per finding. The actual fix is the human's to make (via fg-quick / fg-ask). It never auto-runs — no other skill invokes it; you run it on demand.
Language: This skill file is authored in English, but you MUST write every message shown to the user — the relayed report, and the closing line — in the user's language (detect it from the user's own messages), never mirroring this file's English. The script's finding tokens are language-neutral; render the report in the user's language.
Explaining forge: forge's vocabulary is not the user's — verified: failed, unsealed tail, a pillar or gate name means nothing unread. Always, never gated on eco: gloss a forge-specific term on first use in a message (a few words, not a paragraph), put the purpose before the mechanism, and lead with the answer, closing on what it means for the user. A gloss is not filler — with eco on, ECO.md's terse rules govern form (length, padding) while these govern vocabulary, so terseness never deletes a gloss.
Evidence and candor: every claim you make about code, state, or results — in a message or in a document you write (plan, run notes, retro, ADR) — carries its evidence in the same sentence (a file:line, a command and its output) or a label: Measured (you checked it this session), Inferred (reasoned from what you checked), Guess (a prediction or an unseen cause), rendered in the user's language. A label is not a license to skip a check — if a cheap check would settle it, run it; never hand the user a check you could run. Agreement is not the default: when asked whether to do something, invited to add scope, or shown an approach, give your real judgment first — the strongest objection, and "don't do it" when that is true. Change a recommendation only for a new fact or argument, never for repetition; the decision stays the user's — state the objection once, then follow their call without re-arguing or silently deviating. Output a deterministic script printed is already measured and needs no label.
The mechanical survey — walking the .forge/ state contract and the docs/manifests, classifying each finding, computing the severity — is done by a deterministic script, not by an LLM re-reading everything and hand-reasoning each check in tokens (that was slow and drift-prone; the same problem ADR-0020 fixed for fg-status). This skill runs the script and relays its report in the user's language; it does not re-survey.
The script exists so the check also works AI-free as a CI gate (see "CI usage"): a pipeline runs forge-doctor.sh and fails the build on a non-zero exit. Like fg-status's survey it is read-only — it mutates nothing (fg-doctor's contract, ADR-0019). Guarded by scripts/forge-doctor.test.sh + scripts/forge-doctor.parity.test.sh.
Dual dispatch (ADR-0022): prefer bash, fall back to node.
bash "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/forge-doctor.sh"node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/forge-doctor.js" — identical findings/severity/exit (guarded by the parity test).Output: one [severity] check — path\n fix: hint line per finding, then a verdict line 🩺 forge-doctor — N errors, M warnings, K info. Exit code: 0 clean · 1 warnings only · 2 one or more errors.
Route on the exit code / relay:
The two sections below document the script's checks so the contract is legible; the script is the source of truth for how they run. It resolves the forge root per FORGE-ROOT.md (ADR-0011) and applies it per group (Group A = the resolved branch root; Group B ADR check = the read overlay across top-level + branch root; other Group B = repo-root files). It ignores .forge/dropped/ (fg-drop's archive — out of the active contract, ADR-0021) and accepts both STATUS field forms (field: and the legacy - field:).
Group A — state-contract integrity (.forge/):
run.md/STATUS.md with no plan.md — error.status ∈ {executed, done}; verified ∈ {yes/skipped/n/a/pending/failed}; retro pending/skipped/path. Missing/invalid — error (active/executed), warning (legacy done may lack verified:).forge-slug == STATUS slug; a retro: path must point to an existing file (dangling — error); a done/ reading retro: pending — warning.done/*/STATUS.md reads status: done; else — error.executed/<slug>/ has plan+run+STATUS at status: executed; else — warning.forge-slug+task:; a duplicate task: across all plans — error (missing marker — warning).ask.md older than 1 day — warning..forge/branch/<other>/ leaf root present on this branch — warning, hint: "did you forget fg-merge <branch> after the git merge?" This is the team safety net for the "merged but never integrated" silent data-loss gap.drive.md marker left behind past its 30-minute bound, or one carrying no valid started: — warning either way, hint: "delete it (the Stop hook ignores it, so nothing is blocked)". It blocks nothing, but it means some drive exited without cleaning up, and the next reader deserves to know why nothing is continuing.running.md (written at the launch boundary, immediately before launch with workflow: pending, then updated with a collectable host handle when available; deleted right after run.md is written) present with no plan.md — error (orphan; hint: delete the marker via fg-drop or rm); present alongside run.md — warning (leftover: the run finished but the marker was not deleted); carrying no valid started: — warning (unparseable: delete it and re-enter fg-run); started: older than 1 hour — warning (stale: re-enter fg-run, which collects the result or confirms before re-running). Orphan is checked first, then leftover, then the started value.Group B — docs & manifest integrity (repo root / ADR overlay):
B8 manifest version sync (3 places) — error. B9 manifest JSON validity — error. B10 skill name: frontmatter — error. B12 CLAUDE.md skill-list completeness — warning. B13 README bilingual skill-row parity — warning. B15 script twin parity (.sh↔.js, excluding *.test.sh/*.parity.test.sh/*-wrapper.sh) — warning.
B14 ADR integrity — multi-format aware. Time-based IDs (current YYMMDD-HHMMSS, a letter only on a same-second collision, and grandfathered YYMMDD-HH+letter — ADR-FORMAT.md) are not treated as NNNN gaps; NNNN contiguity is checked only over the grandfathered NNNN set; and a duplicate time-based ID (two ADRs sharing the same ID) is flagged — error (gap in the NNNN set — warning). B14 scans the read overlay — the top-level .forge/adr/ plus, on a non-default branch, the branch root's adr/, each with its retired/ (FORGE-ROOT.md; the default branch scans its one directory once, no double count) — so a branch ADR duplicating a default-branch ID is caught, and NNNN contiguity is checked over the overlay union. (Analogous to A6's task-number uniqueness; keeps the check honest on the repo that dogfooded the time-based scheme.)
B16 SKILL.md description length — each skills/*/SKILL.md frontmatter description is measured in Unicode codepoints (locale-independent, matching the /fg menu's char cap and the .js twin) and flagged when it exceeds 600 — warning. The description is dual-use (/fg menu display + auto-invocation trigger, same char cap), so it must stay a terse trigger core; this lint guards that discipline from silently re-bloating (drift, not breakage → warning, per ADR 260716-22a).
B17 always-on Explaining forge rule — every skills/*/SKILL.md must carry the canonical always-on explanation paragraph (gloss a forge term on first use · purpose before mechanism · lead with the answer). The canonical body has a single definition in scripts/explaining-forge.rule.txt, and the check requires it verbatim by containment — so a heading kept over a deleted, truncated, weakened or negated body fails, while a deliberate superset passes (skills/fg-ask/SKILL.md appends one sentence; no exception list needed). Flagged as warning, matching the rubric below and its prose-drift siblings B12/B13/B15/B16 — a missing style paragraph misleads, it does not break the release. Scoped to the forge plugin repo itself via the top-level manifest name, so a user project's own skills are never told to carry forge's internal rule (a nested "author": {"name": "forge"} does not trigger it). Rationale and why it is not part of eco: ADR 260824-134246. Every scripts/*.rule.txt is checked this way, each independently — today explaining-forge.rule.txt and evidence-and-candor.rule.txt (the always-on Evidence and candor rule: evidence or a Measured/Inferred/Guess label on every claim, check before labelling, agreement is not the default) — and the finding names the missing rule (B17 missing <rule> rule). A rule file must stay one line: grep -F reads a multi-line pattern as an OR of its lines, which would split the bash twin's verdict from the node twin's (ADR 261025-005131).
B18 fg-debug contract coherence — in this plugin repo, the declared and uniquely enumerated counts in both HANDOFF sections (Applies and Does NOT apply) must agree; CONTEXT's handoff count must agree with the Applies enumeration; and the relevant fg-debug sections must retain the active-failure return, persistent-vs-one-off eval classification, every-exit cleanup, and loop-exists/root-cause-unconfirmed exit signals. Each mismatch is a warning. Signals are scoped to their owning sections rather than searched across the whole file, so unrelated mentions cannot satisfy a missing route. Rationale: ADR 260907-140655.
B19 fg-showme confirm snippet single definition — in this plugin repo, skills/fg-showme/VISUAL.md must carry exactly one fenced copy of the inline confirm button, and that copy must contain both choice:'confirm:' (the only prefix the wake filter matches) and the dataset.sent re-send guard — warning. The button is hand-written per screen and confirm appears nowhere in the vendored client, so the doc snippet is the single thing that keeps every screen's button correct; two copies drifted once (retro 260805-063357 learning 3), which is why a second copy fails rather than merely warns about the count.
B20 capability key ↔ Host contract coherence — in this plugin repo, every skills/*/SKILL.md that names a capability key from core/HOST.md's table in backticks must carry a **Host contract** paragraph, and every **Host contract** paragraph must name at least one key; a variant label such as **Host adapter** is reported as a label problem only — warning. A backticked key name is the declaration signal, so a skill that merely mentions a capability in passing writes it without backticks (this bullet does exactly that: structured_choice, prevent_stop, event_wake) — the alternative, exempting the file that documents the check, is the blind spot B17 refused. The vocabulary is derived from core/HOST.md, never hardcoded, so a new key is covered the moment the table gains a row. This is the other half of HOST.md's "a skill names a capability and looks it up mechanically": the dependency must also be declared where a reader looks for it (retro 260908-210216 learning 1 — fg-showme had named Monitor without any declaration).
Severity: error = state/release actually broken (fix before continuing) · warning = drift that misleads but doesn't block · info = a note.
Because the survey is a deterministic script with a clean exit-code contract, a CI job runs it with no AI:
bash scripts/forge-doctor.sh # exit 0 clean · 1 warnings · 2 errors
Wire the gate to your tolerance: fail on non-zero (strict — no warnings allowed) or on >= 2 (block only on errors, allow warnings). It fixes nothing — a failing gate means a human resolves the reported findings locally (fg-quick/fg-ask), then re-pushes. (The example workflow that wires this lives in the team-ci-workflow-merge-policy-docs task.)
fg-doctor (read-only)
│ run forge-doctor.sh (bash) | forge-doctor.js (no bash)
▼
exit 0 ──▶ relay clean bill of health
exit 1/2 ──▶ relay findings (severity · path · fix hint) → state fixes are the human's (fg-quick/fg-ask), auto-fix nothing
There is no loop handoff — fg-doctor is self-contained and read-only. Relay the verdict; when it names a next step (findings present), do it as the handoff table per ../fg-next/HANDOFF.md — the single definition of its shape; never restate that layout here. Statement form, in the user's language; do not auto-invoke anything or start fixing (the same restraint as fg-status).
Just did = the verdict in one line: the exit code and its meaning (clean / N warnings / N errors).
Findings present → the fix route is keyed to the findings actually reported, by the first case that applies:
done/, an un-integrated branch root — anything needing a plan rather than a one-line edit) → Next step = fg-ask (the full loop), How to start = /forge:fg-ask; Alternative = fg-quick for the trivial findings in the same report.Next step = fg-quick, How to start = /forge:fg-quick; Alternative = fg-ask, should one turn out non-trivial.Judge triviality per finding from the fix hint the script reported, and let the heaviest one decide. Neither route is auto-invoked (see Constraints).
Clean (exit 0) → render no table at all. State the clean bill of health in one line and stop. There is no next step here, so a table would only carry rows saying "nothing to fix" / "nothing to trigger" — the information-free rows HANDOFF.md rules out, and the same reason it excludes the skills that have nothing to point at. Deriving where the user was in the loop instead is not this skill's job: fg-doctor reads health, not progress, and never runs fg-status's next-step state machine (fg-status: where am I; fg-doctor: is the state healthy).
The findings themselves are list-shaped, so they go below the table as bullets (HANDOFF.md, "List-shaped content goes below the table"): one line each carrying severity · path · fix hint, exactly as the script reported them. The table says that the state is unhealthy; these lines say what to fix, so they are never compressed into a cell or dropped.
.forge/ state, no docs, no fixes. If you find yourself editing a file, you have left fg-doctor's job.scripts/forge-doctor.sh / .js (ADR-0022 / 260716-16a).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
forge, state-integrity, health-check, ci-gate, documentation-audit
25 skills in this plugin
/fg-adversarial-reviewOptional adversarial review between fg-run and the seal (fg-done) — a reviewer assumes the result is WRONG and hunts for evidence across six lenses (failure points, hidden assumptions, misread requirements, security/perf/data-loss, unexpected misuse, weak decisions), fanning out as parallel subagents; fix-needed findings become a fix-forward plan on your approval. Outside the loop, never a seal gate, always skipped in fg-next all / fg-loop. Use in contexts like 'adversarial review', '적대적 리뷰', '이 결과 공격적으로 검토', '허점 찾아줘', 'red team this'./fg-agendaA decision queue for foggy work — outside the forge loop. Settles the destination with you, grills breadth-first to surface what must be decided, and keeps it in .forge/agenda.md (destination · decided · open questions · fog · out of scope), resolving one question at a time via fg-ask until the way is clear, then deleting itself. The agent finds the decisions; you answer them. Use in contexts like 'forge agenda', '의제', '결정 대기열', '뭘 결정해야 하는지 정리해줘', '어디서 시작할지 모르겠다'./fg-agentsGenerates a project's domain agents — conversational grilling derives the recurring roles, then writes standard Claude Code subagent cards to .claude/agents/<role>.md (each `description` carrying a "when to use" so fg-run can dispatch a matching role as agentType). Cards load only at session start, so RESTART the session after generating them before fg-run can use them. On-demand utility outside the loop. Use in contexts like 'forge agents', '도메인 에이전트 만들어', '에이전트 팀 구성', 'create project agents', 'domain agents', 'agent roles'./fg-askGrilling session that stress-tests your plan against the project's domain model, terminology, and documented decisions, updating CONTEXT.md/ADRs inline. The forge loop's entry point (the plan-grilling stage), always conversational. Use to start or refine a task — "start a new task", "start with forge", "let's work on this", "refine the plan", '새 작업 시작', '계획 다듬자', '이 계획 그릴링해줘'./fg-cleanupRetires stale or superseded ADRs out of the active decision set — proposes candidates with rationale, and on your approval moves each to .forge/adr/retired/ (IDs never reused, nothing deleted). fg-ask stops reading retired/ as source of truth, so retired decisions drop out of grilling fuel. On-demand utility outside the loop (sealing a task is fg-done, not this). Use in contexts like 'forge cleanup', 'ADR 정리', '오래된 ADR 치워'./fg-configUnified settings surface for forge — every key in .forge/config.json: `simple` (auto-seal — fg-run verifies then seals in the same turn, no questions), `eco` (sonnet-capped subagents + ECO.md discipline), `tdd` (test-first default), `driveCommit`/`driveCommitMessage`, `defaultBranch`, `monitorRetention`. `fg-config` (no arg) shows all and offers changes via a menu; `fg-config <key> <value>` sets one directly. Outside the loop. Use in contexts like 'forge config', '설정', 'simple mode', '심플 모드', 'eco on', 'eco off', '에코 모드', 'tdd on', 'tdd off', 'TDD 켜', 'TDD 꺼'.npx claudepluginhub gyuha/forge --plugin forgeOther plugins' skills for the same job