[Documentation] Use when generating, smart-merging or refactoring the root AI context (CLAUDE.md, AGENTS.md) and its Claude/Codex projections. Config file only: project-config.
The English summary is being prepared. Showing the original description.
[Documentation] Use when a workflow step or the user asks for one project-reference doc rebuild via --target=<key>, preserving verified rules. All selected reference docs: scan-all.
The English summary is being prepared. Showing the original description.
Run score Not tested
See how to installReview the instructions the agent will receive before you install.
Protocol guides — Apply each protocol only when its read-when condition holds. If a protocol's text is not in your context, read its file below before you act on it.
output-quality-principles — Readable guidance and verified contents for long skill/doc files; writing, updating or auditing a skill or reference document, or another Markdown artifact over 200 lines → .claude/skills/shared/protocols/output-quality-principles.mdscan-and-update-reference-doc — Baseline-safe updates with semantic retention and truthful freshness; scanning or updating a reference doc → .claude/skills/shared/protocols/scan-and-update-reference-doc.mdGoal: Scan one selected built-in or explicitly generic custom reference doc and deliver a surgical, evidence-backed update that preserves action-changing rules, exceptions and verified discovery without report bulk.
Summary:
kind: orchestrator uses its procedure; unknown key STOPs; unsupported capability is a reported skip, not a guessed fallback.file:line examples, incremental unique reports, surgical writes, all-path/name checks, target exceptions, and graph checks when the project supports them.Workflow:
--target=<key>, load its manifest entry, and confirm the output is selected or separately owned as an always-on input.Key Rules:
MUST ATTENTION resolve --target FIRST; the manifest entry owns all target-specific behavior, never memory.
MUST ATTENTION validate config and target applicability before scanning; a catalog entry is not proof the project uses that capability.
MUST ATTENTION detect framework/type only after applicability is established; derive scan terms and scopes from evidence, never hardcode.
MUST ATTENTION use actual project examples with file:line — NEVER fabricate.
MUST ATTENTION treat graph output as an optional, stale-able hint for code relationships (source callers remain the evidence); an absent graph is not a scan failure.
--target=<key> from the invocation (e.g. /scan --target=backend-patterns). Built-in keys use their manifest entry. The reserved generic-reference-doc mode also requires --filename="<relative-path>". If no target or an unknown key is supplied, STOP and list registered keys; never guess the intended target..claude/hooks/lib/project-config-loader.cjs (default docs/project-config.json). Absent config is supported: use the runtime capability resolver and repository evidence. Present config requires a non-empty project.name; omitted sections use neutral defaults/skips. Repair declared invalid sections through project-init / project-config before relying on them.referenceDocs selection through the project config/runtime resolver. An explicit array, including [], is exact for task-specific docs. A built-in target may write only its manifest doc when that exact filename is selected. generic-reference-doc may write only the exact selected custom filename whose scanTarget is generic; a missing/manual target or unselected filename blocks the scan. Custom docs never inherit a built-in target by basename. The lessons.md and docs-index inputs are ensured by project-init separately from task-specific selection.references/targets.md (registry index: selection rules, path roots, key → file table), then the resolved target's own file references/targets/<key>.md — MANDATORY; the index carries no scan data and no other target file is needed. generic-reference-doc uses the index's Dynamic Target section instead of a target file. The target file supplies:
doc — the reference doc path this scan ownsSKIPPED with the config fields and paths checked and write nothing. If evidence conflicts materially, stop and surface the conflict.kind: orchestrator, follow its applicability-aware procedure and include only eligible children. Do not run the shared single-doc engine for the orchestrator.Everything below is the SHARED engine (standard single-doc scanner targets). Wherever it says "the target entry," read the loaded manifest entry — do not assume values from another target. Orchestrator-kind targets do not use this engine — they run their entry's Orchestration Procedure instead.
After config, output selection, and applicability pass, run only the checks relevant to this target:
doc.
scan-and-update-reference-doc; existing sections are not evidence that their owners were checked..code-graph/graph.db and the graph tool are available.Evidence gate: If applicability or framework detection cannot be established, report what was checked and what remains unknown. Skip absent capabilities; ask only when unresolved evidence materially changes the doc and cannot be settled from config or source. Never substitute a guessed manifest fallback.
From the evidenced framework/type, derive concrete patterns to search (naming, lifecycle, data access, configuration, and test organization). Treat architecture patterns such as repositories, CQRS, events, or domain entities as options to evaluate against observed boundaries, not mandatory structures.
Record authoritative owners and exemplar preconditions; distinguish intended practice from legacy frequency. Bound exploration by selected owner scope and relevant consumers, use live registries, and record unknowns rather than exhaustive inventories. Create work items only for applicable branches. When delegation is authorized, assign disjoint source scopes and reconcile their union, including boundary files, before dispatch; the main agent owns output writes.
Launch only the general-purpose sub-agents defined for applicable branches in the target entry. Give each sub-agent its Think scope + scan-target bullets verbatim from the entry. Each sub-agent MUST:
file:line for every pattern exampleEach worker writes a unique shard under tmp/reports/scan-{target}-{YYMMDD}-{HHMM}/; workers never append to the same report. After the barrier, the main agent reads and validates every shard and is the sole writer of tmp/reports/scan-{target}-{YYMMDD}-{HHMM}-report.md.
Honor every conditional / ordered sub-agent from the entry (for example, cross-service work only when service boundaries exist, or a BDD agent only when BDD artifacts are present). Honor any CRITICAL security flag the entry defines. Never create extra architecture or test components to fill a section.
Read the full report. Apply the fresh-eyes protocol:
Round 1 (main agent): Build section drafts from report findings, using the target entry's Target Sections + Content Rules / exceptions.
Round 2 (only after Round 1 finds and fixes issues; fresh sub-agent, zero memory of Round 1): Sub-agent re-reads report + draft doc independently and checks (apply the target entry's Round-2 verification specifics):
Round 3 only if Round 2 finds issues. Max 3 rounds → escalate to user if unresolved. (Clean Round 1 ends the scan; fresh-eyes is mandatory only after issues are found and fixed.)
Authoring branch (init mode): if the target entry defines one (e.g.
design-systemauthors the canonical doc + token.scss), follow it exactly — including any sentinel removal (e.g. "First: REMOVEPLACEHOLDER_MARKER_SCSS") and regen-marker prepend.
[BLOCKING] No-op scans write NOTHING — not even the stamp. Finish enhancement and semantic review on the full candidate before application; choose freshness metadata according to the classified operation, then compare it against the doc on disk with the shared guard, which ignores volatile stamps and whitespace:
node .claude/hooks/lib/doc-stamp-guard.cjs --check <target doc> --candidate <candidate file> --baseline <baseline file>
Exit 4 (CONFLICT) → preserve candidate/live baseline, reconcile newer guidance and repeat semantic/discovery checks before retrying. Single main writer applies immediately after the check; it is optimistic detection, not locking.
Exit 0 (CHANGED) → write the fully reviewed candidate with truthful operation metadata.
Exit 3 (NO-OP) → do NOT write the file, do NOT touch the stamp. Only after a full owner scan, record verification in the local ledger; impact/editorial work preserves full-scan staleness:
node .claude/hooks/lib/doc-stamp-guard.cjs --record-verified <doc filename>
Then report unchanged (no write). Date-only rewrites create merge conflicts without adding information.
Apply only affected guidance; preserve manual annotations and meaningful local rules. Remove redundant/outside-purpose sections with semantic dispositions, preserving parser-owned structures. Never use a pointer that cannot deliver the rule when needed.
Verify (Glob check): ALL code example file paths exist — not just a sample of 5.
Verify (Grep check): class/token/variable names in examples match actual declarations.
Verify any target-mandated section is real, not hypothetical (Anti-Patterns / Coverage gaps / M1-M2 leaks / ports-from-config / etc.).
For code-oriented claims, validate call-chain or dependency claims with the available project graph; when no supported graph exists, trace relevant source callers directly.
Convention classes (main agent only, never a worker): when the valid project config declares convention classes, follow their configured additive merge procedure. Omitted optional convention configuration is a skip; do not create classes from guessed stack facts. Workers keep writing only their unique shard; the main agent stays the sole writer.
Report: sections updated / unchanged / coverage gaps / violations found / convention classes added-refreshed-kept.
<!-- SCAN:prompt-enhance-final-step -->Output-rule overrides: apply the target entry's "Content Rules / exceptions" — owner-required index rows/counts/anchors remain intact; contractual thresholds/versions remain actionable. Detailed statistics and coverage reports stay in temporary evidence unless they govern action or a consumer requires them.
MUST ATTENTION for a changed candidate, run /prompt-enhance with the target output identity and its ownership contract before application when required by the manifest. Use its agent-guide branch; compare final semantic dispositions against the baseline so enhancement cannot restore removed bulk. A skipped or unchanged target is not rewritten or enhanced.
TaskCreate (last task when a doc changed): Enhance candidate and review semantic retention before applying <target doc>
IMPORTANT MUST ATTENTION Goal: Scan one selected built-in or explicitly generic custom reference doc and deliver a surgical, evidence-backed update that preserves action-changing rules, exceptions and verified discovery without report bulk.
MUST ATTENTION Main steps: Resolve config/selection and target → verify applicability → classify Init/Sync/target-defined Force and save baseline → plan applicable owner scopes → scan into unique shards → review evidence and retention → enhance when required → reconcile baseline/no-op/freshness and apply → report. Orchestrator targets follow their own procedure.
file:line, document above 80% confidence, label 60–80% unresolved, omit below 60%. An optional graph is only a hint; trace source callers when absent. Absence is neither a scan limitation nor a finding.IMPORTANT MUST ATTENTION read/save baseline, classify full/impact/editorial operation, preserve semantic dispositions and manual guidance, reject/reconcile changed live bytes before application. No-op writes nothing; only full owner scans advance full-scan freshness.
<!-- /SYNC:scan-and-update-reference-doc:reminder --> <!-- SYNC:output-quality-principles:reminder -->IMPORTANT MUST ATTENTION lead with useful guidance and readable priorities; preserve action-changing conditions/numbers and required structures. When writing, updating or auditing Markdown skill/doc content, verify top, heading-linked contents over 200 lines (stricter owner thresholds remain); refresh after edits and report gaps in read-only audits. Remove report bulk; judge semantic value rather than word counts.
<!-- /SYNC:output-quality-principles:reminder -->Anti-Rationalization (shared — the target entry adds its own rows):
| Evasion | Rebuttal |
|---|---|
"I know what a <target> scan does, skip the manifest entry" | The entry holds the BLOCKING gates, sub-agent count, and exceptions — scanning from memory drops them |
| "Framework/type already known, skip Phase 0 detection" | Phase 0 is BLOCKING — derive grep terms from evidence, not assumption |
| "Doc has content, skip re-read" | Show section list extracted from doc as proof of re-read |
| "Examples look right" | Glob-verify ALL file paths + Grep-verify ALL names — looking right ≠ verified |
| "Round 2 review not needed after fixing a small scan" | Size does not waive the issue-triggered gate: corrected Round 1 requires a fresh sub-agent; a clean Round 1 ends the scan. |
[TASK-PLANNING] Before acting, analyze task scope and break into small todo tasks and sub-tasks using TaskCreate.
No reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
[Documentation] Use when generating, smart-merging or refactoring the root AI context (CLAUDE.md, AGENTS.md) and its Claude/Codex projections. Config file only: project-config.
The English summary is being prepared. Showing the original description.
[Code Quality] Use when a workflow step or the user asks for AI code or plan review: LLM calls, prompts, agents, RAG, evals and guardrails. --mode={code|plan}; --report-only is read-only.
The English summary is being prepared. Showing the original description.
[Architecture] Use when a workflow step or the user asks for architecture design, compliance review, scalability grading or whole-project audit via --mode={design|review|scalability|full}.
The English summary is being prepared. Showing the original description.
[Content] Use when a workflow step or the user asks for product/feature ideation with ranked opportunities and validation tests. --mode={roadmap|scope}.
The English summary is being prepared. Showing the original description.
[Content] Use when a workflow step or the user asks for business viability: Business Model Canvas, financials, risks and go-to-market recommendation.
The English summary is being prepared. Showing the original description.
[Code Quality] Use when a workflow step or the user asks for a focused code-change review: staged, unstaged, branch diff or simple pull request. --fix-loop fixes and re-reviews. Complex pull request: workflow-review-changes; rationale: why-review.
The English summary is being prepared. Showing the original description.