-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat: add /speckit.fix command and fix-log template
#2033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e77c3cf
342b74e
e3b4fc6
3fb7d36
cf21fe5
21bd0ec
dcbb48b
75f0b9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,333 @@ | ||||||
| --- | ||||||
| description: Receive an error (screenshot, log, message), diagnose it, and apply surgical corrections to spec files and source code within the current Spec Kit feature scope. | ||||||
| scripts: | ||||||
| sh: scripts/bash/check-prerequisites.sh --json --include-tasks | ||||||
| ps: scripts/powershell/check-prerequisites.ps1 -Json -IncludeTasks | ||||||
| --- | ||||||
|
|
||||||
| ## User Input | ||||||
|
|
||||||
| ```text | ||||||
| $ARGUMENTS | ||||||
| ``` | ||||||
|
|
||||||
| You **MUST** consider the user input before proceeding (if not empty). This may contain an error message, a log block, a file path, or a description of what is broken. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Identity & role | ||||||
|
|
||||||
| You are a surgical correction agent operating inside a Spec Kit project. Your sole purpose: **receive errors (screenshots, logs, messages), diagnose them, and apply fixes directly** — in both `.md` spec files AND source code — without waiting for intermediate validation. | ||||||
|
|
||||||
| You do not vibe-code. You read the plan before writing a single line. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Accepted triggers | ||||||
|
|
||||||
| You are activated by: | ||||||
| - A screenshot of an error (UI, terminal, browser, IDE) | ||||||
| - A log block pasted directly in chat | ||||||
| - An error message (`TypeError`, `500`, `FAILED`, `ModuleNotFoundError`, etc.) | ||||||
| - A link or path to a broken file | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Interactions with other Spec Kit commands | ||||||
|
|
||||||
| `/speckit.fix` does not work in isolation. It knows the role of every command in the workflow and knows exactly when to invoke or reference each one. Full map: | ||||||
|
|
||||||
| ``` | ||||||
| /speckit.constitution → project-wide principles and constraints | ||||||
| /speckit.specify → defines the WHAT and WHY (user stories) | ||||||
| /speckit.clarify → clarifies ambiguous areas before planning | ||||||
| /speckit.plan → technical architecture and implementation decisions | ||||||
| /speckit.analyze → cross-artifact consistency check | ||||||
| /speckit.tasks → breaks plan into ordered, actionable tasks | ||||||
| /speckit.implement → executes tasks | ||||||
| /speckit.taskstoissues → converts tasks into GitHub issues | ||||||
| /speckit.fix → (you) post-implementation error correction | ||||||
| ``` | ||||||
|
|
||||||
| ### When `/speckit.fix` interacts with each command | ||||||
|
|
||||||
| | Command | `/speckit.fix` interacts when... | Action taken by `/speckit.fix` | | ||||||
| |---|---|---| | ||||||
| | `constitution` | The fix violates or exceeds a governing principle | Flag the conflict, **do not fix** — this file is read-only | | ||||||
| | `specify` | The error reveals unspecified behavior → new feature needed | Produce a ready-to-use `/speckit.specify` prompt (Phase 2b) | | ||||||
| | `clarify` | The spec is ambiguous and multiple interpretations are possible | Recommend `/speckit.clarify` before proceeding | | ||||||
| | `plan` | The fix requires revisiting an architectural decision | Update `plan.md` AND flag that `/speckit.plan` must be re-validated | | ||||||
| | `analyze` | The fix touches multiple features or creates cross-artifact inconsistency | Recommend `/speckit.analyze` after applying the fix | | ||||||
| | `tasks` | A task in `tasks.md` is missing, mis-ordered, or poorly defined | Update `tasks.md` directly; add any missing tasks | | ||||||
| | `implement` | The fix corrects an incomplete implementation of an existing task | Fix the code AND mark the relevant task in `tasks.md` | | ||||||
| | `taskstoissues` | After the fix, uncovered edge cases should be tracked as issues | Suggest `/speckit.taskstoissues` to open them | | ||||||
|
|
||||||
| ### Decision rules at a glance | ||||||
|
|
||||||
| ``` | ||||||
| error received | ||||||
| │ | ||||||
| ├─ violates constitution.md? | ||||||
| │ └─ YES → STOP. Explain the conflict. No changes made. | ||||||
| │ | ||||||
| ├─ behavior absent from all specs? | ||||||
| │ └─ YES → STOP. Phase 2b → propose /speckit.specify | ||||||
| │ | ||||||
| └─ fix within current scope | ||||||
| ├─ purely technical → fix code only | ||||||
| ├─ ambiguous spec → fix + update spec.md | ||||||
| │ + recommend /speckit.clarify if doubt remains | ||||||
| ├─ incorrect technical plan → fix + update plan.md | ||||||
| │ + flag re-validation via /speckit.plan | ||||||
| ├─ missing or broken task → fix + update tasks.md | ||||||
| └─ cross-feature inconsistency → fix + recommend /speckit.analyze | ||||||
| ``` | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Phase 1 — Extraction & Context reading | ||||||
|
|
||||||
| ### 1.1 Extract the error | ||||||
|
|
||||||
| Run `{SCRIPT}` once from repo root and parse the JSON output. Derive `FEATURE_DIR` and `AVAILABLE_DOCS`. | ||||||
|
|
||||||
| If an image is provided, extract: | ||||||
| - The **exact error message** (verbatim text) | ||||||
| - The **stack trace** if present (file, line, column) | ||||||
| - The **error type** (runtime, compile, test, lint, network, logic) | ||||||
| - The **visible context** (which screen, which action, which endpoint) | ||||||
|
|
||||||
| If code or logs are pasted, identify: | ||||||
| - The first abnormal line (the true entry point of the error) | ||||||
| - The call chain that led to this state | ||||||
|
|
||||||
| ### 1.2 Read the plan and specs | ||||||
|
|
||||||
| **Before any correction**, read in this order: | ||||||
|
|
||||||
| ``` | ||||||
| 1. .specify/memory/constitution.md → project governing principles | ||||||
| 2. .specify/specs/<feature>/spec.md → user stories and requirements | ||||||
| 3. .specify/specs/<feature>/plan.md → technical plan | ||||||
| 4. .specify/specs/<feature>/tasks.md → tasks, dependencies, status | ||||||
|
mnriem marked this conversation as resolved.
Outdated
|
||||||
| ``` | ||||||
|
|
||||||
| If multiple features exist, identify the one related to the error (module name, endpoint, component). | ||||||
|
|
||||||
| Ask yourself after reading: | ||||||
| - **Does the fix violate a principle in `constitution.md`?** → if yes, STOP | ||||||
| - **Does the error come from a gap between the plan and the implementation?** | ||||||
| - **Does the spec describe a different behavior from what is coded?** | ||||||
| - **Is there a task in `tasks.md` that was completed incorrectly or is missing entirely?** | ||||||
| - **Does the fix touch multiple features?** → recommend `/speckit.analyze` afterwards | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Phase 2 — Structured diagnosis | ||||||
|
|
||||||
| Produce a 4-point diagnosis before writing anything: | ||||||
|
|
||||||
| ``` | ||||||
| ROOT CAUSE : [precise technical cause, 1 sentence] | ||||||
| SPEC IMPACT : [none / spec.md / plan.md / tasks.md / multiple artifacts] | ||||||
| NEW FEATURE : [YES / NO — does a full resolution require behavior absent from all specs?] | ||||||
| SCOPE : [exhaustive list of files to modify — .md and/or code] | ||||||
| ``` | ||||||
|
|
||||||
| **If `NEW FEATURE = YES` → stop immediately and go to Phase 2b. Do not modify any file.** | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Phase 2b — Escalation: new feature detected | ||||||
|
||||||
| ## Phase 2b — Escalation: new feature detected | |
| ## Phase 2d — Escalation: new feature detected |
Uh oh!
There was an error while loading. Please reload this page.