Prompt file imported from yoshiakist/specre (
.claude/commands/specre-sdd-fix.md). Fill in{{arguments}}before use. Copyright stays with the author.
You are executing the SDD (Spec-Driven Development) workflow to fix or modify an existing feature. The user will provide a description of the change as {{arguments}}.
Follow these phases strictly. There is exactly ONE human checkpoint — after the specre card is updated.
Phase 0: MCP Preflight
If specre MCP tools are available, run health-check first.
- healthy = true → The specre ecosystem is trustworthy. Proceed to Phase 1 and use
specre search/specre tracefor all exploration. - healthy = false → Fall back to
grep/globfor code exploration instead of relying on specre tools. Specre cards can still be read as reference, but do not trust coverage or traceability to be complete.
Phase 1: Analysis
- Read
README.mdanddocs/project/ROADMAP.mdto understand the project philosophy and roadmap context - Use
specre searchto locate the specre cards affected by the change:specre search "<keyword>"— find specre cards related to the change (multi-keyword AND by default)specre search "<keyword>" --or— broaden the search when the initial query is too narrowspecre search --domain <domain>— narrow by domain when the affected area is known
- For each candidate source file, run
specre trace <file-path>to discover which specre cards govern it, and vice versa — runspecre trace <ULID>to find all source files linked to a specre card - Read the related source files and test files listed in the specre card's "Related Files" section
- Understand the current behavior by reading the scenarios and comparing with the implementation
- Identify the gap between the current behavior and the requested change
Phase 2: Specre Update
- Update the affected specre card(s) to reflect the new behavior:
- Modify Scenarios — add, remove, or change steps as needed
- Update Functional Overview if the overall behavior description changes
- Update Key Members if types, fields, or parameters change
- Update Failures / Exceptions if error handling changes
- Update Related Files if new files are introduced or existing ones are removed
- Set
statusto"in-development"(it will return to"stable"in Phase 4) - Clearly mark what changed — present a diff-style summary to the user
--- CHECKPOINT ---
Stop here and present the updated specre card to the user for review. Show what was changed and why. Do NOT proceed until the user approves. If the user requests changes, update the specre card and present it again.
Notify the user that the checkpoint has been reached (if a notification script is configured in the user's environment).
Phase 3: Test-First Implementation (after user approval)
- Update or add integration tests in
tests/to match the updated scenarios. Modify existing tests for changed behavior; add new tests for new scenarios; remove tests for removed scenarios. - Implement the change in the source code, following existing patterns.
- Run
cargo testand fix until all tests pass (both modified and existing).
Phase 4: Finalize & PR
- Update the specre card: set
status: "stable"andlast_verifiedto today's date - Run
specre index - Run the Pre-PR Quality Gate (all three must pass before committing):
cargo fmt --all— auto-format all codecargo clippy --all-targets -- -D warnings— lint all targets (lib, bins, tests, examples, benches)cargo test— run all tests
- Create a feature branch from
mainwith a descriptive name (e.g.,fix/<specre-name>-<short-description>) - Commit all changes with a descriptive message
- Push the branch and create a Pull Request using
gh pr create
Phase 5: Drift Triage
Changes to shared files (e.g., mod.rs, cli.rs, main.rs) often trigger false-positive drift for unrelated specre cards. Triage them now so the next developer or agent starts with a clean ecosystem.
- Run
specre drift --json - If no drifted items → report "No drift detected. Ecosystem is clean." and finish
- For each drifted item, spawn a subagent (one per item, sequentially) to compare the specre card against the code changes since
last_verified:- The subagent reads the specre card (Functional Overview, Scenarios, Failures / Exceptions)
- The subagent runs
git difffromlast_verifiedto HEAD for each changed file - The subagent returns a verdict:
no_drift|drift_spec_stale|drift_impl_wrong|uncertain
- Process each verdict:
no_drift(false positive) → updatelast_verifiedto today's date in the specre card's YAML front-matterdrift_spec_stale→ report to user: the spec needs updating. Suggest/specre-sdd-fixas a follow-updrift_impl_wrong→ report to user: implementation may have regresseduncertain→ report to user: requires manual review
- If any
last_verifieddates were updated:- Run
specre index - Commit the updates as a separate commit (e.g., "chore: update last_verified for false-positive drift")
- Push to update the PR
- Run
- Present a summary: how many false positives were resolved, how many real drifts remain
