@jakkrichm/create-nexus-devflow 2.2.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +58 -45
  2. package/dist/bin/create-nexus-devflow.js +9 -1
  3. package/dist/bin/create-nexus-devflow.js.map +1 -1
  4. package/dist/lib/command-catalog.js +1 -1
  5. package/dist/lib/command-catalog.js.map +1 -1
  6. package/dist/lib/core-skill-inventory.d.ts +16 -0
  7. package/dist/lib/core-skill-inventory.js +96 -0
  8. package/dist/lib/core-skill-inventory.js.map +1 -0
  9. package/dist/lib/dashboard-page.d.ts +1 -1
  10. package/dist/lib/dashboard-page.js +42 -20
  11. package/dist/lib/dashboard-page.js.map +1 -1
  12. package/dist/lib/dashboard-snapshot.js +16 -12
  13. package/dist/lib/dashboard-snapshot.js.map +1 -1
  14. package/dist/lib/dashboard.js +10 -1
  15. package/dist/lib/dashboard.js.map +1 -1
  16. package/dist/lib/doctor.js +14 -11
  17. package/dist/lib/doctor.js.map +1 -1
  18. package/dist/lib/gatekeeper.d.ts +4 -0
  19. package/dist/lib/gatekeeper.js +2 -2
  20. package/dist/lib/gatekeeper.js.map +1 -1
  21. package/dist/lib/git-status.d.ts +10 -2
  22. package/dist/lib/git-status.js +57 -29
  23. package/dist/lib/git-status.js.map +1 -1
  24. package/dist/lib/swarm-orchestrator.d.ts +4 -1
  25. package/dist/lib/swarm-orchestrator.js +2 -2
  26. package/dist/lib/swarm-orchestrator.js.map +1 -1
  27. package/dist/lib/update.js +5 -8
  28. package/dist/lib/update.js.map +1 -1
  29. package/dist/lib/version-check.js +1 -1
  30. package/dist/lib/workflow-state.js +19 -32
  31. package/dist/lib/workflow-state.js.map +1 -1
  32. package/dist/scripts/prepare-template.js +19 -16
  33. package/dist/scripts/prepare-template.js.map +1 -1
  34. package/package.json +1 -1
  35. package/template/.agents/skills/check/SKILL.md +78 -75
  36. package/template/.agents/skills/complete/SKILL.md +47 -36
  37. package/template/.agents/skills/debug/SKILL.md +76 -94
  38. package/template/.agents/skills/devflow/SKILL.md +51 -79
  39. package/template/.agents/skills/discovery/SKILL.md +7 -9
  40. package/template/.claude/skills/check/SKILL.md +78 -75
  41. package/template/.claude/skills/complete/SKILL.md +47 -36
  42. package/template/.claude/skills/debug/SKILL.md +76 -94
  43. package/template/.claude/skills/devflow/SKILL.md +51 -79
  44. package/template/.claude/skills/discovery/SKILL.md +7 -9
  45. package/template/AGENTS.md +21 -30
  46. package/template/devflow/build-plan.md +9 -0
  47. package/template/devflow/context/ai-interaction.md +43 -45
  48. package/template/devflow/context/coding-standards.md +31 -6
  49. package/template/devflow/context/current-stage.md +10 -7
  50. package/template/devflow/context/findings.md +8 -11
  51. package/template/devflow/context/glossary.md +31 -0
  52. package/template/devflow/history/HISTORY.md +1 -1
  53. package/template/devflow/project-plan.md +2 -2
  54. package/template/devflow/reference/build-plan-template.md +65 -0
  55. package/template/devflow/reference/feature-spec-template.md +110 -0
  56. package/template/devflow/reference/project-plan-template.md +128 -0
  57. package/template/devflow/reference/running-id-contract.md +12 -11
  58. package/template/.agents/skills/10-define/SKILL.md +0 -54
  59. package/template/.agents/skills/20-spec/SKILL.md +0 -155
  60. package/template/.agents/skills/30-plan/SKILL.md +0 -226
  61. package/template/.agents/skills/40-execute/SKILL.md +0 -158
  62. package/template/.agents/skills/50-verify/SKILL.md +0 -62
  63. package/template/.agents/skills/60-report/SKILL.md +0 -57
  64. package/template/.agents/skills/70-deliver/SKILL.md +0 -72
  65. package/template/.claude/skills/10-define/SKILL.md +0 -54
  66. package/template/.claude/skills/20-spec/SKILL.md +0 -155
  67. package/template/.claude/skills/30-plan/SKILL.md +0 -226
  68. package/template/.claude/skills/40-execute/SKILL.md +0 -158
  69. package/template/.claude/skills/50-verify/SKILL.md +0 -62
  70. package/template/.claude/skills/60-report/SKILL.md +0 -57
  71. package/template/.claude/skills/70-deliver/SKILL.md +0 -72
@@ -1,108 +1,111 @@
1
1
  ---
2
2
  name: check
3
- description: "[devflow][F] Prove the current work actually does what its spec says by running the real app and observing behavior against the \"done when\" criteria in current-feature.md. Drives the app (browser, CLI, or server), captures evidence (screenshots, output, console/network errors), and reports pass/fail per criterion. Does not edit source or commit - it observes; fixing stays /implement's job. Use when the user runs /check, asks to confirm a step or feature works, wants proof before /complete, or wants to check a change in the running app rather than just the build. (Supersedes the built-in /verify with a spec-aware version inside blueprint projects.)"
3
+ description: "[devflow][F] Prove the current work actually does what its spec says and adheres to architectural standards through a Dual-Axis Independent Review (Spec Fidelity + Standards & Architecture). Drives the app (browser, CLI, or server), captures empirical evidence (screenshots, output, console/network errors), checks against 12 Fowler smells and deep-module standards, and reports pass/fail. Does not edit source or commit - it observes; fixing stays /implement's job. Use when the user runs /check, asks to confirm a step or feature works, wants proof before /complete, or wants to check a change in the running app rather than just the build."
4
4
  ---
5
5
 
6
- # check - prove it works against the spec, with evidence
6
+ # check - Dual-Axis Independent Verification Engine
7
7
 
8
8
  Where this sits in the workflow:
9
9
 
10
10
  /implement -> [check] -> /complete
11
- (built a (run the app, (only once the
12
- step or prove each done-whens are
13
- the feature) done-when) proven)
11
+ (built a (dual-axis (only once both
12
+ step or review with axes pass with
13
+ the feature) empirical proof) evidence)
14
14
 
15
- `/implement` builds and does a quick build-plus-screenshot check inline. `/check`
16
- is the deeper, repeatable gate for when a "done when" needs the *real running app*,
17
- not just a green build: a click that triggers a download, a route that returns a
18
- file, a flow across screens. Run it on a single step whose done-when is
19
- behavioral, or on the whole feature as the acceptance check before `/complete`.
15
+ `/implement` builds and does a quick build-plus-screenshot check inline. `/check` is the rigorous, repeatable gate for when a feature or step needs **empirical proof** on the running app and **two-axis code review** before merging.
20
16
 
21
- The point is evidence. A passing build proves the code compiles; `/check` proves
22
- the thing the spec promised actually happens. It changes no source and commits
23
- nothing - it runs the app and reports what it saw.
17
+ It changes no source and commits nothing it executes, inspects, and reports observed facts.
18
+
19
+ ---
24
20
 
25
21
  ## Input
26
22
 
27
- Optional: a specific thing to check (a step, a flow, a URL). With no argument,
28
- verify the whole current feature against every "done when" in
29
- `devflow/context/current-feature.md`.
23
+ Optional: a specific target to check (a step, a flow, a URL). With no argument, verify the whole current feature against `devflow/context/current-feature.md` and `devflow/context/coding-standards.md`.
30
24
 
31
- ## Step 1 - build the checklist
25
+ ---
32
26
 
33
- Read `devflow/context/current-feature.md`. Pull the observable "done when"
34
- criteria from the build steps (and any acceptance notes in the Testing section).
35
- Turn them into a concrete checklist of claims to prove - each one a specific,
36
- observable behavior, not "it works". If the user named one thing, scope to that.
27
+ ## Step 1 - Build the Dual-Axis Review Matrix
37
28
 
38
- If there's no current feature spec, ask what to verify rather than guessing.
29
+ Read `devflow/context/current-feature.md` and `devflow/context/coding-standards.md`. Prepare the inspection criteria across two independent axes:
39
30
 
40
- ## Step 2 - get the app running
31
+ 1. **Axis 1 (Standards & Architecture Criteria)**:
32
+ - Coding conventions in `coding-standards.md`
33
+ - Deep Modules discipline (Small interface, deep implementation, clean seams, no leaky abstractions)
34
+ - Baseline 12 Fowler Code Smells (Primitive obsession, Feature envy, Shotgun surgery, Speculative generality, etc.)
35
+ - Multi-lane technical gates (Typecheck, test suites, zero secrets, zero P0/P1 findings)
36
+ 2. **Axis 2 (Spec Fidelity & Behavioral Observables)**:
37
+ - Line-by-line Acceptance Criteria (ACs) and "Done When" observables from `current-feature.md`
38
+ - Scope Creep detection (Unrequested behavior in the diff)
39
+ - Missing Requirements detection (Unimplemented edge cases)
41
40
 
42
- Use the project's real commands (see Commands in `AGENTS.md`). Match the project
43
- type:
41
+ ---
44
42
 
45
- - **Web app** - start (or reuse) the dev/preview server, then drive a real browser
46
- to the relevant routes. Prefer reusing an already-running server over starting a
47
- duplicate. If Playwright is already installed or declared in `AGENTS.md`, prefer
48
- it for browser driving, screenshots, console errors, and failed request checks.
49
- If it is not installed, do not add it from `/check`; use another real-browser
50
- evidence path and report what you used.
51
- - **CLI** - run the actual command(s) with representative inputs.
52
- - **Server/API** - start it and hit the endpoints.
53
- - **Library** - exercise the public API through an example or the test command.
43
+ ## Step 2 - Get the App Running & Exercise Live Proof
54
44
 
55
- If a `test` command is declared in `AGENTS.md`, you may run it as *one* input, but
56
- `/check` is broader than unit tests: it checks real behavior, which is exactly the
57
- evidence UI and integration steps ride on instead of unit tests.
45
+ Use the project's real commands (from `AGENTS.md`):
58
46
 
59
- ## Step 3 - exercise each claim
47
+ - **Web app**: Start (or reuse) the local dev server. Drive a real browser to relevant routes. Prefer Playwright when installed for screenshots, network errors, and console assertions.
48
+ - **CLI**: Execute commands with representative input fixtures, asserting exit codes and output snapshots.
49
+ - **Server / API**: Hit endpoints with real payloads and assert on HTTP response status and bodies.
50
+ - **Library**: Exercise public interfaces through integration tests or sample scripts.
60
51
 
61
- Drive the app to each checklist item and capture evidence as you go:
52
+ > [!IMPORTANT]
53
+ > **Evidence or it didn't happen**: Every verdict must be backed by empirical evidence (screenshot, command output, status code, response time). Never assume a pass from reading source code alone.
62
54
 
63
- - Navigate and interact for real (click, type, submit, download) - don't assert
64
- from the code what the running app would do.
65
- - Capture **screenshots** for visual/UI claims, **output** for CLI/API claims.
66
- - Watch for **console errors and failed network requests**; a clean-looking screen
67
- with errors in the console is not a pass.
55
+ ---
68
56
 
69
- ## Step 4 - report (Two-Stage Review Pattern)
57
+ ## Step 3 - Dual-Axis Independent Report
70
58
 
71
- Format the verification report into two explicit review stages:
59
+ Format the report into two distinct, un-merged review axes:
72
60
 
73
- ### Stage 1: Spec Fidelity & Acceptance Gate
74
- Give a line-by-line verdict for each Acceptance Criterion and "done when" item:
61
+ ```markdown
62
+ # 🔍 Verification Report: [Feature Name]
75
63
 
76
- [pass] AC-1: Download PDF saves certificate-<slug>.pdf - file downloaded, opened to cert
77
- [pass] AC-2: Both buttons show a loading state - screenshot: loading-state.png
78
- [fail] AC-3: PDF border missing - printBackground not set; screenshot: pdf-no-border.png
79
- [skip] AC-4: Vercel deploy smoke test - can't verify locally (pending staging)
64
+ ## ⚖️ Axis 1: Standards, Architecture & Quality Gate
80
65
 
81
- ### Stage 2: Code Quality, Security & Architecture Gate
82
- Report the multi-lane technical verification results:
83
- - **Type & Syntax**: `tsc --noEmit` (0 errors)
84
- - **Automated Tests**: Unit & integration tests (100% pass)
85
- - **Security & Hygiene**: Zero secrets, sanitized inputs
86
- - **Findings Ledger**: 0 blockers (P0/P1) in `devflow/context/findings.md`
66
+ - **Technical Lanes**:
67
+ - [pass] Type Safety: `tsc --noEmit` (0 errors)
68
+ - [pass] Automated Tests: `npm test` (All tests green)
69
+ - [pass] Security & Hygiene: Zero secrets, sanitized inputs
70
+ - [pass] Findings Ledger: 0 blocking P0/P1 in `devflow/context/findings.md`
71
+ - **Deep Modules & Architecture**:
72
+ - [pass] Seam Integrity: Public interfaces remain small, implementation details hidden.
73
+ - [pass] The Deletion Test: Complexity is concentrated inside the module, not scattered across callers.
74
+ - **Code Smells Assessment**:
75
+ - [clean] 12 Fowler Code Smells evaluated across git diff: No critical smells detected.
87
76
 
88
- ### Final Verdict & Route
89
- - **All Passed**: State that the feature is verified and ready for `/complete`.
90
- - **Any Failure**: Hand back to `/implement` with exact failure evidence and reproduction steps. Never fix issues inside `/check`.
91
- - **Unverifiable**: Clearly state reasons and residual risk. Never fabricate a pass.
77
+ ## 🎯 Axis 2: Spec Fidelity & Behavioral Acceptance Gate
92
78
 
93
- ## Rules
79
+ Line-by-line verification against `current-feature.md`:
80
+ - [pass] **AC-1 (<title>)**: <Observed empirical evidence / screenshot path>
81
+ - [pass] **AC-2 (<title>)**: <Observed empirical evidence / terminal output>
82
+ - [fail] **AC-3 (<title>)**: <Exact observed failure with reproduction command>
83
+ - [clean] **Scope Creep Check**: No unrequested features or unnecessary abstractions introduced.
84
+ - [clean] **Completeness Check**: 100% of spec requirements addressed.
85
+
86
+ ---
87
+
88
+ ## 🚦 Final Routing & Verdict
94
89
 
95
- - **Observe, don't change.** `/check` runs the app and reports. It never edits
96
- source, never commits, never merges. Fixing is `/implement`'s job.
97
- - **Evidence or it didn't happen.** Every `pass` is backed by something observed -
98
- a screenshot, output, a response. No assumed passes from reading the code.
99
- - **Honest over green.** "Couldn't verify" and "failed" are valid, useful results.
100
- Faking a pass defeats the entire gate.
101
- - **Check the spec, not vibes.** Verify against the done-whens in
102
- `current-feature.md`, so "works" means what the spec said it would do.
90
+ - **ALL PASSED**: Both axes green. Ready for `/complete`.
91
+ - **ANY FAILURE**: Hand back to `/implement` with exact failure evidence and reproduction steps.
92
+ - **UNVERIFIABLE**: Clearly document the gap and residual risk. Never fabricate a pass.
93
+ ```
103
94
 
104
- ## Formatting
95
+ ---
96
+
97
+ ## Why Two Independent Axes?
98
+
99
+ A code change can pass one axis and fail the other:
100
+ - **Standards Pass, Spec Fail**: Code is beautifully architected and tested, but implements the wrong business behavior.
101
+ - **Spec Pass, Standards Fail**: Feature works end-to-end, but violates encapsulation, introduces shallow modules, or leaks secrets.
102
+
103
+ Reporting both axes side-by-side stops elegance from masking functional bugs, and stops functional completeness from excusing architectural rot.
104
+
105
+ ---
106
+
107
+ ## Rules
105
108
 
106
- Format the output to match the project's conventions in
107
- `devflow/context/ai-interaction.md`: concise, scannable markdown, with lists for
108
- enumerations and tables for matrices rather than dense paragraphs.
109
+ - **Observe, don't change**: `/check` runs the app and reports. It never edits source or commits. Fixing is `/implement`'s job.
110
+ - **Honest over green**: "Failed" and "Could not verify" are valid, valuable outputs. Faking a pass destroys the gate.
111
+ - **Check the spec, not vibes**: Verify against documented ACs, not subjective feelings.
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  name: complete
3
- description: "[devflow][F] Wrap up a finished feature, fix, or rollback. Runs a final safety pass, archives its spec to devflow/history/features/, devflow/history/fixes/, or devflow/history/rollbacks/, updates the build plan for features and rollbacks, resets devflow/context/current-feature.md to its stub, makes one work-level commit, then squash-merges the branch to main and deletes it. Merges only with explicit approval, then asks separately before pushing main. Use when the user runs /complete, or asks to finish, wrap up, merge, or close out the current feature, fix, or rollback after it is built and reviewed."
3
+ description: "[devflow][F] Wrap up a finished feature, fix, or rollback. Runs a final safety pass, archives its spec to devflow/history/features/, devflow/history/fixes/, or devflow/history/rollbacks/, updates the build plan for features and rollbacks, resets devflow/context/current-feature.md to its stub, and makes the work commit. Enforces a mandatory user gate: asks whether to squash-merge to main/master OR pull latest main/master into the feature/dev branch and push to remote for Merge Request (MR / PR) creation. Never merges into main/master without explicit user instruction."
4
4
  ---
5
5
 
6
- # complete - log the finished work, make the work commit, and merge
6
+ # complete - log the finished work, make the work commit, and deliver
7
7
 
8
8
  Where this sits in the workflow:
9
9
 
10
10
  /feature, /fix, or /rollback -> /implement -> [complete] -> next
11
- (the spec) (build it) (commit + merge + log)
11
+ (the spec) (build it) (commit + delivery gate)
12
12
 
13
13
  `/implement` built the feature, fix, or rollback on its branch, with optional per-step commit
14
14
  checkpoints. This skill closes it out: it logs the work, makes the single
15
- work-level commit, and squash-merges. Run it only when the work is done,
15
+ work-level commit, and guides the delivery through a **Mandatory User Delivery Gate**. Run it only when the work is done,
16
16
  reviewed, and the documented `Verify` command, or the fallback build and tests,
17
17
  passes.
18
18
 
@@ -22,7 +22,7 @@ Confirm the work is actually finished: `devflow/context/current-feature.md`
22
22
  holds a real spec, its steps are built on a branch, and `Verify`, or the fallback
23
23
  build and tests, passes. If any of the
24
24
  spec's done-whens are behavioral, `/check` should have proven them against the
25
- running app first - don't merge on an unverified claim. Uncommitted step work is
25
+ running app first - don't merge or complete on an unverified claim. Uncommitted step work is
26
26
  expected (per-step checkpoints are optional); this skill commits it. Don't require
27
27
  the steps to be pre-committed.
28
28
 
@@ -30,7 +30,7 @@ the steps to be pre-committed.
30
30
 
31
31
  Before logging or committing, run a short safety pass and report blockers only:
32
32
 
33
- - active spec exists and the work is not being completed from `main` or `master`
33
+ - active spec exists and the work is not being completed directly from `main` or `master`
34
34
  - changed files are tied to the active spec, with no unrelated dirty work mixed
35
35
  in (a dirty `devflow/context/findings.md` is expected, since `/audit` writes it)
36
36
  - the exact `Verify` command from `AGENTS.md` passed in this session, when one is
@@ -107,25 +107,47 @@ into the app - delete the `prototypes/` folder now. The tokens live in the real
107
107
  stylesheet and the HTML mockups were always throwaway; fold the deletion into this
108
108
  feature's commit. Skip this if the feature didn't consume prototypes.
109
109
 
110
- ## Step 2 - make the work commit
110
+ ## Step 2 - make the work commit on feature branch
111
111
 
112
112
  Stage everything on the branch (any uncommitted step work plus the Step 1 logging
113
- changes) and make one conventional work commit (for example `feat: <feature>`,
113
+ changes) and make one conventional work commit on the active branch (for example `feat: <feature>`,
114
114
  `fix: <name>`, or `revert: roll back <feature>`). `Verify`, or the fallback build
115
115
  and tests, must pass first.
116
116
 
117
- ## Step 3 - merge
117
+ ## Step 3 - Mandatory Delivery Gate (Ask User First)
118
+
119
+ > [!IMPORTANT]
120
+ > **MANDATORY USER SELECTION**: In real-world engineering teams, developers often do NOT have direct merge/push access to `main` or `master` (protected branches).
121
+ > Therefore, you **MUST STOP AND ASK** the user to choose their desired delivery flow. **NEVER automatically merge into `main` or `master` without explicit user choice.**
122
+
123
+ Present the user with two clear delivery options:
124
+
125
+ ### 🔀 Option 1: Team MR / PR Flow (Pull latest main/master & Push dev branch) [Default for Teams]
126
+ - **When to choose**: When working in a team where code reviews happen via GitLab Merge Request (MR) or GitHub Pull Request (PR), or where developers lack direct write access to protected `main`/`master` branches.
127
+ - **Execution Actions**:
128
+ 1. Detect default base branch name (`main` or `master`).
129
+ 2. Run `git pull origin <main/master>` (or `git fetch origin <main/master> && git merge origin/<main/master>`) to bring the latest upstream changes into the active feature/dev branch.
130
+ 3. If merge conflicts occur, highlight them clearly and help the user resolve them.
131
+ 4. Run `Verify` (or build & tests) to ensure integrity after the merge.
132
+ 5. Run `git push origin <current-feature-branch>` to push the up-to-date branch to the remote repository.
133
+ 6. Stop and inform the user that the branch is synchronized and pushed, ready for them to open a Merge Request (MR / PR) on GitLab/GitHub.
134
+ 7. **Do NOT merge into local `main`/`master` and do NOT delete the branch.**
135
+
136
+ ### 🔀 Option 2: Direct Local Squash-Merge (Solo / Direct Access Mode)
137
+ - **When to choose**: Only when the user explicitly instructs that they want to merge directly into `main` or `master` locally now (e.g. solo projects or Tech Leads with merge privileges).
138
+ - **Execution Actions**:
139
+ 1. Switch to `main` or `master`: `git checkout <main/master>`.
140
+ 2. Squash-merge the branch: `git merge --squash <feature-branch>`.
141
+ 3. Commit the squash-merge.
142
+ 4. Delete the local feature branch only with the user's explicit consent.
143
+ 5. **Stop and ask separately** before pushing local `main`/`master` to remote upstream. The merge approval does NOT count as push approval.
144
+ 6. Run `git push origin <main/master>` only after separate explicit confirmation.
118
145
 
119
- 1. Squash-merge the branch into main, only with the user's explicit go-ahead, so
120
- the feature lands as one clean commit regardless of how many checkpoints the
121
- branch carried.
122
- 2. Delete the branch after a clean merge.
123
- 3. Stop and ask whether to push local `main` to its upstream. The merge approval
124
- does not count as push approval.
125
- 4. Push main only after a separate explicit yes to push main in the current chat.
126
- If the repo has no remote or upstream, say so instead of guessing.
146
+ ---
147
+
148
+ ## Step 4 - Finish & Try Path
127
149
 
128
- Then point the user at `/feature`, `/fix`, or `/rollback` for the next thing.
150
+ Point the user at `/feature`, `/fix`, or `/rollback` for the next task.
129
151
 
130
152
  Finish with a concise **How to try it** note for the completed work. For a
131
153
  rollback, explain how to confirm the removed behavior is gone and name one
@@ -135,26 +157,15 @@ that command can read the archived feature after `current-feature.md` is reset.
135
157
 
136
158
  ## Rules
137
159
 
160
+ - **Mandatory User Confirmation Gate**: Always ask before choosing between Team MR/PR Push vs Direct Squash-Merge.
161
+ - **Never auto-merge into main/master**: The decision to merge into `main` or `master` belongs strictly to the user.
138
162
  - The work item is the unit of history: one squashed feature, fix, or rollback
139
- commit on main, even if the branch carried several checkpoint commits.
163
+ commit, even if the branch carried several checkpoint commits.
140
164
  - A rollback preserves the original feature archive and adds a separate rollback
141
165
  archive. Never rewrite history to make the feature look as if it never existed.
142
- - Don't merge unfinished or failing work. The documented `Verify` command, or
166
+ - Don't merge or push unfinished or failing work. The documented `Verify` command, or
143
167
  the fallback build and tests, must pass first.
144
- - Never merge while a P0 or P1 finding is `open` or `fixed` in the ledger. The
145
- recorded ways past the gate without code are `accepted` (only by the user's
146
- explicit decision, with their reason) or `invalid` (only from re-examination
147
- evidence or the user's explicit call); both travel into the archive, never a
148
- silent drop.
149
- - Merging and pushing are the user's calls: get an explicit yes for the merge,
150
- then ask whether to push main. Do not treat merge approval, `/complete`, or
151
- "looks good" as permission to push.
152
- - Push main only after a separate explicit yes to push main in the current chat.
168
+ - Never merge or push while a P0 or P1 finding is `open` or `fixed` in the ledger.
169
+ - Pushing to remote is always explicit: confirm before running `git push`.
153
170
  - One item per completion. If a parent feature still has unchecked sub-features,
154
- leave the parent unchecked.
155
-
156
- ## Formatting
157
-
158
- Format the output to match the project's conventions in
159
- `devflow/context/ai-interaction.md`: concise, scannable markdown, with lists for
160
- enumerations and tables for matrices rather than dense paragraphs.
171
+ leave the parent unchecked.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: debug
3
- description: "[devflow][B] Diagnose a failing test, broken build, crash, error, regression, or unexpected behavior without editing source or Blueprint state. Reproduces the symptom with the smallest safe command, localizes the failing path, tests competing hypotheses, identifies the root cause when evidence supports one, and reports a repair handoff to /fix or /implement. Use when the user runs /debug, invokes $debug, asks why something is failing or broken, wants a root-cause investigation, or asks to diagnose before fixing."
3
+ description: "[devflow][B] Diagnose a failing test, broken build, crash, error, regression, or unexpected behavior without editing source or DevFlow state. Follows a strict 6-Phase Scientific Debugging Loop: builds a red-capable tight feedback loop, reproduces & minimises, tests 3-5 falsifiable hypotheses, localizes the failure to a root cause, and reports a repair handoff to /fix or /implement. Use when the user runs /debug, invokes $debug, asks why something is failing or broken, wants a root-cause investigation, or asks to diagnose before fixing."
4
4
  ---
5
5
 
6
- # debug - find the cause before changing the code
6
+ # debug - 6-Phase Scientific Debugging Protocol
7
7
 
8
8
  Where this sits in the workflow:
9
9
 
@@ -12,130 +12,112 @@ Where this sits in the workflow:
12
12
  crash, behavior) isolate, repair active work)
13
13
  explain)
14
14
 
15
- `/debug` separates diagnosis from repair. It gathers evidence, narrows the
16
- failure to a specific cause when possible, and stops with a useful handoff. It
17
- does not make the code "temporarily work" while investigating.
15
+ `/debug` separates diagnosis from repair. It gathers empirical evidence, narrows the failure to a specific root cause using scientific method, and stops with an actionable repair handoff. It does not guess, assume, or perform ad-hoc "vibe debugging".
16
+
17
+ ---
18
18
 
19
19
  ## Input
20
20
 
21
21
  Accept a symptom, failing command, error message, or unexpected behavior. Examples:
22
22
 
23
- /debug npm test fails in cart-total.test.js
23
+ /debug npm test fails in cart-total.test.ts
24
24
  /debug the upload route returns 500 for PNG files
25
- /debug why does the production build fail?
25
+ /debug why does the build fail on Windows?
26
26
 
27
- With no useful symptom, ask for the expected behavior, actual behavior, and
28
- smallest known reproduction. Do not guess which problem the user means.
27
+ With no useful symptom, ask for expected behavior, actual behavior, and smallest known reproduction. Do not guess.
29
28
 
30
- ## Step 1 - establish the boundary
29
+ ---
31
30
 
32
- Read the project instructions and the context relevant to the failure:
31
+ ## 🔬 The 6-Phase Scientific Debugging Loop
33
32
 
34
- - `AGENTS.md` and its real commands
35
- - `devflow/context/project-overview.md`
36
- - `devflow/context/coding-standards.md`
37
- - `devflow/context/current-feature.md`
38
- - the reported error, failing output, and affected files
39
- - git status, diff, and recent log when a regression is possible
33
+ ### Phase 1: Build a Red-Capable Feedback Loop (Golden Rule)
40
34
 
41
- State the symptom and what would count as reproducing it. Note whether the
42
- failure belongs to an active feature or is an unplanned bug.
35
+ **This is the core discipline.** If you have a **tight** pass/fail command that actively goes RED on this bug, you will find the root cause. If you do not have one, staring at code will not save you.
43
36
 
44
- Do not treat a dirty working tree as permission to discard or rewrite anything.
45
- Use the diff as evidence and preserve it.
37
+ **Spend disproportionate effort here. Ways to construct one (in order):**
38
+ 1. **Failing Unit / Integration Test** at the responsible module seam.
39
+ 2. **Curl / HTTP script** against the running local dev server.
40
+ 3. **CLI invocation** diffing stdout/stderr against expected output.
41
+ 4. **Headless browser script** (Playwright) asserting on DOM/network/console.
42
+ 5. **Replay captured trace**: Replay isolated payload/event log through the code path.
46
43
 
47
- ## Step 2 - reproduce safely
44
+ **Completion Criterion for Phase 1**:
45
+ You must name **one single command** (a test invocation, a script, or curl) that you have **already run at least once** and proven:
46
+ - [ ] **Red-capable**: It exercises the actual code path and catches the user's exact symptom (fails red now, will pass green once fixed).
47
+ - [ ] **Deterministic**: Returns the same verdict every run.
48
+ - [ ] **Fast & Agent-runnable**: Completes in seconds, executable without manual intervention.
48
49
 
49
- Run the smallest existing command or interaction that can reproduce the symptom.
50
+ > [!CAUTION]
51
+ > **No Red-Capable Command = No Phase 2.** If you catch yourself reading code to form theories before this command exists, **STOP**. Jumping straight to a hypothesis is the exact failure this protocol prevents.
50
52
 
51
- - Prefer one focused test, request, CLI command, or input over the entire suite.
52
- - Capture the exact exit code, error, stack trace, output, response, console
53
- error, or failed request.
54
- - Reuse an already-running local app when available. If reproduction requires a
55
- long-running server that is not running, ask the user to start it and provide
56
- the documented command.
57
- - Do not install dependencies, change configuration, run migrations, mutate
58
- production data, contact external users, or use destructive commands to force
59
- a reproduction.
60
- - Do not edit code to add logs or probes. Use existing logs, debuggers,
61
- read-only inspection, or one-off commands that do not change project files.
62
- - Compare git status after diagnostic commands. If one changes tracked or
63
- untracked project files, stop and report those paths. Do not clean, restore,
64
- or hide the changes.
53
+ ---
65
54
 
66
- If the symptom cannot be reproduced, say what was attempted and what evidence is
67
- missing. Continue with static investigation only when it can produce a clearly
68
- labeled hypothesis, not a claimed root cause.
55
+ ### Phase 2: Reproduce & Minimise
69
56
 
70
- ## Step 3 - localize the failure
57
+ Run the feedback loop and watch it go RED.
71
58
 
72
- Trace from the observed failure toward the smallest responsible area.
59
+ 1. **Confirm Symptom**: Ensure the failure mode matches what the user reported (not a nearby unrelated error).
60
+ 2. **Minimise the Repro**: Cut inputs, configs, dependencies, and steps **one at a time**, re-running the command after each cut. Keep only what is load-bearing for the failure.
61
+ 3. **Done when**: Every remaining parameter is load-bearing (removing any one makes the loop go green).
73
62
 
74
- Use the evidence that fits the project:
63
+ ---
75
64
 
76
- - the first relevant application frame in a stack trace
77
- - the smallest failing test and its inputs
78
- - request and response data at the failing boundary
79
- - console and network errors
80
- - callers, imports, data flow, and configuration reads
81
- - `git diff`, `git log`, and `git blame` for a suspected regression
82
- - comparison with a nearby working path or input
65
+ ### Phase 3: Form 3–5 Ranked Falsifiable Hypotheses
83
66
 
84
- Separate facts from hypotheses. Test the cheapest safe competing explanations
85
- first. Do not stop at the first plausible line, blame a dependency without
86
- evidence, or confuse the place an error surfaced with the place it originated.
67
+ Generate **3 to 5 ranked hypotheses** before testing or inspecting deeply. Never anchor on the first plausible idea.
87
68
 
88
- ## Step 4 - confirm or narrow
69
+ Every hypothesis MUST be **falsifiable** using this exact format:
70
+ > *"If `<X>` is the cause, then `<changing Y>` will make the bug disappear / `<changing Z>` will make it worse."*
89
71
 
90
- A root cause is confirmed only when the evidence connects all three:
72
+ If you cannot state the prediction, it is a vibe: sharpen or discard it.
91
73
 
92
- 1. the triggering input or state
93
- 2. the responsible code, configuration, or contract
94
- 3. the observed failure
74
+ ---
95
75
 
96
- When safe and read-only, vary one input or run a smaller focused command to
97
- confirm the connection. Do not change implementation or tests to prove the fix.
76
+ ### Phase 4: Targeted Instrumentation & Isolation
98
77
 
99
- Use one of these verdicts:
78
+ Test hypotheses by changing **one variable at a time**:
79
+ 1. **Tool preference**: Read-only inspection > REPL/debugger > Targeted probe logs.
80
+ 2. **Debug Tag Rule**: If temporary diagnostic logs are necessary, tag every log line with a unique prefix, e.g. `[DEBUG-a4f2]`. This guarantees a single `grep` can find and remove all probes.
81
+ 3. **Redaction**: Redact all secrets, tokens, and credentials in terminal outputs (`<REDACTED>`).
100
82
 
101
- - **Confirmed** - evidence identifies the cause and explains the failure.
102
- - **Likely** - evidence narrows the cause, but one specific proof is unavailable.
103
- - **Blocked** - the failure cannot be reproduced or required evidence is
104
- inaccessible.
83
+ ---
105
84
 
106
- ## Step 5 - report and hand off
85
+ ### Phase 5: Confirm Root Cause at Real Seam
107
86
 
108
- Give a concise debug report:
87
+ A root cause is **Confirmed** only when empirical evidence connects all three:
88
+ 1. The triggering input or state
89
+ 2. The responsible code / configuration boundary
90
+ 3. The observed failure
109
91
 
110
- - symptom and reproduction
111
- - verdict
112
- - root cause or leading hypothesis
113
- - evidence, including commands and relevant paths
114
- - affected behavior and likely repair boundary
115
- - what was not verified
116
- - exact next action
92
+ **Seam Identification**: Identify the exact architectural seam (per `devflow/context/coding-standards.md` Deep Modules) where the regression test must live. If no clean seam exists, note that as an architectural finding.
117
93
 
118
- Choose the next action without writing files:
94
+ ---
95
+
96
+ ### Phase 6: Report & Hand-off
97
+
98
+ Give a structured, concise debug report:
119
99
 
120
- - Active feature or fix caused the failure -> return the diagnosis to `/implement` with instructions to write a failing reproduction test ([TDD-Red]) first.
121
- - No active work item and the bug is confirmed -> recommend `/fix "<concise bug and confirmed cause>"` (which will write a failing test first before fixing).
122
- - Cause is only likely or blocked -> recommend the next diagnostic evidence, not a speculative repair.
123
- - The issue is planned product work rather than a defect -> point to `/feature`.
100
+ ```markdown
101
+ ### 🐞 Debug Report: <Concise Title>
102
+
103
+ - **Symptom**: <Exact user symptom observed>
104
+ - **Reproduction Command**: `<Single red-capable command>`
105
+ - **Verdict**: Confirmed | Likely | Blocked
106
+ - **Root Cause**: <Precise technical explanation of why it failed>
107
+ - **Responsible Seam**: `<path/to/file.ts#line>`
108
+ - **Evidence**:
109
+ - Test/Curl output confirming the red signal
110
+ - Trace connecting triggering state to failure
111
+ - **Next Action**:
112
+ - For active feature -> Hand back to `/implement` with instructions to write failing test first.
113
+ - For standalone bug -> Recommend `/fix "<concise description>"` to create spec and implement regression test.
114
+ ```
115
+
116
+ ---
124
117
 
125
118
  ## Rules
126
119
 
127
- - Diagnose, do not repair. Never edit source, tests, configuration, lockfiles, or
128
- Blueprint files.
129
- - Never create, switch, merge, or delete branches. Never commit or push.
130
- - Do not update the findings ledger. `/audit` owns recorded code-quality
131
- findings; `/debug` reports one investigated failure in chat.
132
- - Evidence outranks confidence. Label uncertainty and failed reproduction
133
- honestly.
134
- - Preserve the user's working tree and running processes.
135
- - Do not broaden one failure into a general audit or refactor.
136
-
137
- ## Formatting
138
-
139
- Format the output to match the project's conventions in
140
- `devflow/context/ai-interaction.md`: concise, scannable markdown with a short
141
- evidence list and a clear next action.
120
+ - **Diagnose, do not repair**: Never edit production source, package lockfiles, or DevFlow state inside `/debug`.
121
+ - **Evidence outranks confidence**: Label uncertainty honestly (`Likely` vs `Confirmed`).
122
+ - **Preserve git state**: Never switch branches, commit, reset, or clean the working tree.
123
+ - **Clean up probes**: Ensure any temporary test scripts in scratch/ are cleanly referenced.