spec-rescue
Rescue or rebuild a corrupted, contradictory, or drifted specification using a structured workflow instead of prose-first rewriting. Use whenever a spec has conflicting sections, hidden duplicates, am
Files1
View on GitHubSKILL.mdclaude-plugins/agentboard/dev-work-resources/spec-rescue/SKILL.md
GitHubSpec Rescue
This skill exists for situations where raw Markdown spec writing has become unreliable.
Use it when:
- the spec has been rewritten multiple times and trust is gone;
- approved decisions exist, but are scattered through chat, handoffs, and draft prose;
- the same design idea appears in multiple sections with different wording;
- process guidance, design rules, implementation notes, and sign-off claims are mixed together;
- the user wants a spec rebuilt from known decisions rather than repaired by paragraph editing;
- you need a workflow that is traceable, reversible, and less vulnerable to LLM drift.
The core idea is simple:
- do not treat long-form Markdown as the primary source of truth
- capture decisions atomically first
- inventory existing prose separately
- reconcile duplicates/conflicts before writing final spec prose
Workflow Source
This skill is a summary layer, not the authority on the workflow by itself.
The operational workflow for this process lives at:
docs/specs/spec-workflow.md
If there is any tension between this skill and the workflow file, follow the workflow file.
docs/specs/spec-session-status.md is the current-state artifact. Do not treat it as the source of workflow rules.
The core workflow artifacts this skill expects are:
docs/specs/spec-chunk.mddocs/specs/spec-inventory.mddocs/specs/spec-ledger.yamldocs/specs/spec-conflicts.yamldocs/specs/spec-evidence.mdordocs/specs/spec-evidence.yamldocs/specs/spec-session-status.md
At session start, do not infer the workflow state from prose alone.
Read in this order:
AGENTS.mddocs/specs/spec-workflow.mddocs/specs/spec-session-status.md- use CORE exactly as CORE requires for this workflow
docs/specs/spec-chunk.mddocs/specs/spec-inventory.md
Then take:
- current phase from
docs/specs/spec-session-status.md - workflow rules from
docs/specs/spec-workflow.md - protected decision record from
docs/specs/spec-chunk.md - inventory-only snapshot from
docs/specs/spec-inventory.md
Do not guess the phase. Do not substitute another memory source for CORE.
For this workflow, the CORE protocol is exact:
RULE: APPROVAL REQUIRED BEFORE ANY WRITE TO CORE
Before calling ANY tool that writes data into or through CORE, you MUST present what you intend to do and get explicit approval.
Tools that require approval before use:
memory_ingest- show the full ingestion text firstadd_reminder- show the reminder text and schedule firstupdate_reminder- show what will change firstexecute_integration_action- show the action and parameters first
Present the exact content, not a summary of it. Max must see the actual text that will be stored. Then wait for approval before calling the tool.
This is not optional. A single incorrect write to CORE can propagate bad data into every future session.
RULE: ALL DATA MUST HAVE COMPLETE ENTITY CONNECTIONS
Every piece of data that enters CORE must contain everything CORE needs to build correct graph connections. CORE extracts entities by name from the text it receives. If a name is missing, abbreviated, or vague, the entity either doesn't get created or doesn't connect to existing entities in the graph.
For every write to CORE:
- Repos: Owner and name - "Maxcogar/syndicatecnc-weekly-web-brief", never "the repo" or "the project"
- Files: Full paths from repo root - "src/api/handlers/auth.ts", never "the auth file" or "that handler"
- Packages/Dependencies: Full name and version when relevant - "python-fastmcp 2.0", never "the MCP library"
- APIs/Services: Proper name and endpoint when relevant - "ERPNext REST API /api/resource/Sales Order", never "the ERP endpoint"
- MCP Servers: Full name - "Engineering Design Navigator MCP server", never "the MCP server" or "the navigator"
- Infrastructure: Named - "Google Cloud Run", "Firebase Hosting", "HP t740 Docker host", never "the server" or "the cloud"
- Skills/Configs: With identifiers - "integration-builder skill at /mnt/skills/user/integration-builder/SKILL.md", never "that skill"
- People: Full name - "Max Cogar", never just "Max" or "the user"
- Organizations: Proper name - "CNC Syndicate", "Anthropic", never "the company"
Never use: "the repo", "the project", "the file", "that function", "the bug", "the thing we fixed"
START OF EVERY SESSION
Step 1: Call initialize_conversation_session (new: true). Store the
sessionId for the entire session.
Step 2: Identify the repo and work context. Determine:
- Which repository is being worked on (owner/name)
- What feature, bug, or task is the focus
Step 3: Call memory_search with a complete semantic question about the
repo or work being done.
CORE classifies every query into one of 5 types (aspect, entity lookup, temporal, exploratory, relationship) and routes to the optimal search strategy. The query must be a full natural-language question so CORE can determine intent.
Step 4: If the session involves external services or integrations, call
get_integrations to verify connection status.
END OF EVERY SESSION
Step 1: Write the full ingestion message.
Step 2: Present the ingestion message to Max for review. Do not call
memory_ingest until Max approves the content.
Step 3: Once approved, call get_labels, select the appropriate
label(s), and call memory_ingest with the approved text, sessionId, and
label ID(s).
If no label fits, ingest without a label. Do NOT guess.
HOW TO WRITE THE INGESTION MESSAGE
Write as if the next Claude Code session has zero context and needs to pick up exactly where this session left off. If a detail would be needed to continue the work - find the right file, understand why a decision was made, reproduce a bug, or know what's left to do - it must be in the message.
Format:
<user>Max Cogar is working on {repo} - {what the session goal was, with enough context to understand why}</user>
<assistant>{What was done, decided, built, fixed, and what state the work is in}</assistant>
Non-negotiable rules
- Do not silently rewrite the final spec from memory.
- Do not treat handoffs or prior drafts as authority once the user has clarified otherwise.
- Do not smooth over contradictions in prose before making them explicit.
- Do not let a paragraph carry multiple independent decisions if those decisions could be separated.
- Do not start implementation work from unresolved or contradictory design prose.
Artifact model
This workflow uses distinct artifacts with distinct roles.
1. spec-chunk.md
Protected human record.
Use for:
- owner decisions as primary chunks;
- approved section text as amendments;
- preserving exact wording and traceability;
- maintaining a reversible history.
Do not use it for:
- freeform reconciliation;
- speculative rewrites;
- automatic replacement of older text.
2. spec-inventory.md
Current-spec snapshot.
Use for:
- exact breakdown of the real spec as written now;
- sections, DDs, ACs, scope claims, and sign-off claims;
- descriptive inventory only.
Do not use it for:
- approval;
- correction;
- merge decisions.
3. spec-ledger.yaml
Atomic source of truth.
Use for:
- one record per real decision or rule;
- owner decisions, surviving invariants, and explicitly marked new synthesis;
- later deterministic comparison against the codebase and draft prose.
4. spec-conflicts.yaml
Conflict register.
Use for:
- duplicate intent;
- overlapping intent;
- conflicting intent;
- unresolved ambiguity.
5. spec-evidence.md or spec-evidence.yaml
Evidence log.
Use for:
- repo findings gathered from direct reads, search, RAG, and deterministic extraction;
- proving where the codebase or docs mention a concept;
- backing claims without promoting evidence into authority.
6. Final spec Markdown
Derived artifact only.
Write it only after the decision set is stable enough to support prose safely.
7. Session handoff record
Durable session-close state.
For this workflow, use:
docs/specs/spec-session-status.md
Authority model
Always distinguish three things:
A. Candidate authority
The final spec being stabilized.
B. Verification basis
The owner decisions, approved wording, and other explicitly accepted constraints that the spec must faithfully encode during review.
C. Evidence/context
Repo files, handoffs, prior drafts, plans, contracts, profiles, hooks, search results, and RAG findings.
Critical rule:
- evidence and context may justify review conclusions;
- they do not automatically become governing authority inside the spec.
Statement classification
When reviewing any spec material, classify each questionable statement as one of:
clear_and_acceptableunclear_requires_owner_clarificationcontradictory_or_nonfunctional_cannot_stay
Do not preserve a statement just because you can imagine an interpretation that makes it work.
Review posture
When fixing source text, prefer the smallest safe correction:
- delete unsafe statement
- narrow unsafe statement
- split overloaded statement
- only then rewrite larger passages
Avoid broad rewrites when the actual problem is an overloaded sentence or false attribution.
Workflow
Phase 1 — Capture known decisions
Goal:
- move known decisions out of unstable prose and into a protected record.
Process:
- create or update
spec-chunk.md; - record owner decisions as primary chunks;
- attach approved section text as amendments without overwriting the primary chunks;
- keep exact approved wording when it exists.
Exit:
- the known decisions are captured in chunk form.
Phase 2 — Inventory the real spec
Goal:
- document exactly what the current spec says before trying to fix it.
Process:
- create or update
spec-inventory.md; - inventory all top-level sections;
- inventory all explicit DDs, ACs, scope claims, and sign-off claims;
- break large sections into meaningful decision-bearing units when useful.
Exit:
- the current spec is fully mapped.
Phase 3 — Build the atomic ledger
Goal:
- create the machine-readable source of truth.
Process:
- create
spec-ledger.yaml; - create one ledger item per real decision or rule;
- mark each item as:
owner_decisionsurviving_invariantnew_synthesis
- attach traceability to chunk IDs, approved section text, or explicit owner statements.
Critical rule:
- if something is new synthesis, label it honestly;
- do not attribute it to the owner or a standard unless that is explicitly true.
Phase 4 — Register duplicates, overlaps, conflicts
Goal:
- make structural problems explicit before prose reconciliation.
Process:
- create
spec-conflicts.yaml; - record:
- duplicate intent
- overlapping intent
- conflicting intent
- unresolved ambiguity
- give every issue an ID and status.
Definitions:
- duplicate: different text, same intent
- overlap: shared intent plus extra distinct material
- conflict: incompatible or competing intent
Phase 5 — Gather evidence
Goal:
- collect repo reality and references.
Process:
- read relevant plans, contracts, commands, profiles, hooks, tests, and prior specs;
- use search and RAG to find all references to the concept under review;
- record them in
spec-evidence.mdorspec-evidence.yaml.
Critical rule:
- RAG is for retrieval and discovery, not authority.
Phase 6 — Deterministic conformance extraction
Goal:
- compare codebase facts to ledger truth where possible.
Process:
- write small deterministic scripts for mechanically checkable facts;
- extract actual values and declarations from the codebase;
- compare them to the ledger;
- record mismatches as evidence.
Good deterministic targets:
- declared inputs
- parameter names
- artifact names
- retry cap values
- route enums
- revision-mode sections present or absent
- direct
spec_pathmutation
Phase 7 — Reconcile the ledger
Goal:
- resolve duplicates, overlaps, and conflicts before prose generation.
Process:
- review
spec-conflicts.yaml; - merge duplicates;
- split or consolidate overlaps;
- resolve conflicts explicitly;
- leave unresolved ambiguity visible until answered.
Phase 8 — Write final prose
Goal:
- generate stable Markdown from stable decisions.
Process:
- map ledger items to target sections;
- write section prose from the ledger, not from memory;
- keep traceability from prose to ledger items;
- avoid introducing fresh synthesis without explicit labeling and approval.
Phase 9 — Final verification
Goal:
- confirm that the prose matches the ledger and does not carry hidden decisions.
Process:
- compare each section to its ledger basis;
- rerun deterministic checks where relevant;
- reject any section that introduces hidden authority or unsupported glue text;
- only then present for sign-off.
Suggested ledger shape
Use fields like:
- id: CL-001
title: Retry cap
status: approved
type: process
statement: The correction loop has a finite retry cap of 3 on the same card.
rationale: Repeated failures beyond 3 indicate a deeper issue requiring separate investigation.
source_basis:
- owner_decision_2026_05_20
scope: correction_loop
constraints:
retry_cap: 3
related:
overlaps_with: []
conflicts_with: []
notes: []
Suggested conflict shape
Use fields like:
- id: CF-001
kind: overlap
left: CL-003
right: CL-014
description: Both records govern correction-mode behavior, but one adds route-specific constraints.
status: open
resolution: null
notes: []
How to use this skill
When this skill triggers:
- read
AGENTS.md; - read
docs/specs/spec-workflow.md; - read
docs/specs/spec-session-status.md; - use CORE exactly as CORE requires for this workflow;
- read
docs/specs/spec-chunk.md; - read
docs/specs/spec-inventory.md; - take the current phase from
docs/specs/spec-session-status.md; - identify the authoritative artifact for that phase using
docs/specs/spec-workflow.md; - do not skip earlier phases just because prose exists;
- keep source-of-truth work separate from prose work;
- explicitly say when a file is protected, inventory-only, working, frozen, or derived;
- keep the user informed about what artifact is being changed and why;
- close the session by updating
docs/specs/spec-session-status.mdif work stops midstream; - use CORE exactly as CORE requires before considering the session correctly closed;
- for this workflow, that means completing the exact
session-start / approval-before-write / session-end protocol from
C:\Users\maxco\.claude\CLAUDE.mdrather than improvising a local variant.
Do not create extra workflow/process files unless the owner explicitly asks for them. Use the existing workflow and status artifacts.
Failure signs
This skill is failing if:
- you keep restating the same decision in multiple DDs without collapsing it;
- you cannot say whether a statement is authority, verification basis, or evidence;
- you are “fixing” prose while conflicts remain unresolved in the underlying decision set;
- you are using RAG results as if they are approval;
- you are writing new explanatory glue into the final spec that does not trace back to a ledger item.