super-opencode 1.1.2 → 1.2.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 (48) hide show
  1. package/.opencode/agents/architect.md +54 -31
  2. package/.opencode/agents/backend.md +61 -34
  3. package/.opencode/agents/data-agent.md +422 -0
  4. package/.opencode/agents/devops-agent.md +331 -0
  5. package/.opencode/agents/frontend.md +63 -36
  6. package/.opencode/agents/mobile-agent.md +636 -0
  7. package/.opencode/agents/optimizer.md +25 -18
  8. package/.opencode/agents/pm-agent.md +114 -50
  9. package/.opencode/agents/quality.md +36 -29
  10. package/.opencode/agents/researcher.md +30 -21
  11. package/.opencode/agents/reviewer.md +39 -32
  12. package/.opencode/agents/security.md +42 -34
  13. package/.opencode/agents/writer.md +42 -31
  14. package/.opencode/commands/soc-analyze.md +55 -31
  15. package/.opencode/commands/soc-brainstorm.md +48 -26
  16. package/.opencode/commands/soc-cleanup.md +47 -25
  17. package/.opencode/commands/soc-deploy.md +271 -0
  18. package/.opencode/commands/soc-design.md +51 -26
  19. package/.opencode/commands/soc-explain.md +46 -23
  20. package/.opencode/commands/soc-git.md +47 -25
  21. package/.opencode/commands/soc-help.md +35 -14
  22. package/.opencode/commands/soc-implement.md +59 -29
  23. package/.opencode/commands/soc-improve.md +42 -20
  24. package/.opencode/commands/soc-onboard.md +329 -0
  25. package/.opencode/commands/soc-plan.md +215 -0
  26. package/.opencode/commands/soc-pm.md +40 -18
  27. package/.opencode/commands/soc-research.md +43 -20
  28. package/.opencode/commands/soc-review.md +39 -18
  29. package/.opencode/commands/soc-test.md +43 -21
  30. package/.opencode/commands/soc-validate.md +221 -0
  31. package/.opencode/commands/soc-workflow.md +38 -17
  32. package/.opencode/skills/confidence-check/SKILL.md +26 -19
  33. package/.opencode/skills/debug-protocol/SKILL.md +27 -17
  34. package/.opencode/skills/decision-log/SKILL.md +236 -0
  35. package/.opencode/skills/doc-sync/SKILL.md +345 -0
  36. package/.opencode/skills/package-manager/SKILL.md +502 -0
  37. package/.opencode/skills/package-manager/scripts/README.md +106 -0
  38. package/.opencode/skills/package-manager/scripts/detect-package-manager.sh +796 -0
  39. package/.opencode/skills/reflexion/SKILL.md +18 -11
  40. package/.opencode/skills/security-audit/SKILL.md +19 -14
  41. package/.opencode/skills/self-check/SKILL.md +30 -14
  42. package/.opencode/skills/simplification/SKILL.md +19 -5
  43. package/.opencode/skills/tech-debt/SKILL.md +245 -0
  44. package/LICENSE +1 -1
  45. package/README.md +126 -9
  46. package/dist/cli.js +143 -41
  47. package/package.json +27 -12
  48. package/.opencode/settings.json +0 -3
@@ -0,0 +1,221 @@
1
+ ---
2
+ description: "Requirements validation, traceability matrices, and acceptance criteria verification"
3
+ ---
4
+
5
+ # /soc-validate
6
+
7
+ ## 1. Command Overview
8
+
9
+ The `/soc-validate` command is the "Quality Gate" between design and implementation. It ensures requirements are complete, unambiguous, and testable before coding begins. It creates traceability matrices that map requirements to tests, designs, and implementation artifacts—ensuring nothing falls through the cracks.
10
+
11
+ ## 2. Triggers & Routing
12
+
13
+ The command activates validation modes based on what needs verification.
14
+
15
+ | Trigger Scenario | Flag | Target Agent | Context Injected |
16
+ | :--- | :--- | :--- | :--- |
17
+ | **Requirements Review** | `--type requirements` | `[pm-agent]` | User Stories, Acceptance Criteria |
18
+ | **Design Validation** | `--type design` | `[architect]` | ADRs, API Contracts, Schemas |
19
+ | **Test Coverage Check** | `--type coverage` | `[quality]` | Test Plans, Code Coverage Reports |
20
+ | **Full Validation** | `--type full` | `[pm-agent]` + `[quality]` + `[architect]` | All artifacts |
21
+
22
+ ## 3. Usage & Arguments
23
+
24
+ ```bash
25
+ /soc-validate [target] [flags]
26
+ ```
27
+
28
+ ### Arguments
29
+
30
+ - **`[target]`**: The artifact to validate (e.g., "User Auth Requirements", "API v2 Design", "Sprint 5").
31
+
32
+ ### Flags
33
+
34
+ - **`--type [requirements|design|coverage|full]`**: **MANDATORY**. Specifies validation scope.
35
+ - **`--strict [lenient|normal|strict]`**: Validation strictness (default: normal).
36
+ - **`--output [report|matrix|checklist]`**: Output format (default: report).
37
+ - **`--block-on-fail`**: Return non-zero exit code if validation fails (for CI/CD).
38
+
39
+ ## 4. Behavioral Flow (Orchestration)
40
+
41
+ ### Phase 1: Artifact Discovery
42
+
43
+ 1. **Read**: Parse target requirements/design documents.
44
+ 2. **Collect**: Gather related artifacts (tests, code, ADRs).
45
+ 3. **Baseline**: Establish validation criteria based on `--strict` level.
46
+
47
+ ### Phase 2: Validation Checks
48
+
49
+ #### Requirements Validation (`--type requirements`):
50
+ - **INVEST Check**: Are stories Independent, Negotiable, Valuable, Estimable, Small, Testable?
51
+ - **Acceptance Criteria**: Are Gherkin-style Given/When/Then statements present?
52
+ - **Ambiguity Scan**: Flag vague terms ("fast", "user-friendly", "soon").
53
+ - **Completeness**: Verify all user personas have journeys.
54
+
55
+ #### Design Validation (`--type design`):
56
+ - **ADR Completeness**: Does every major decision have an ADR?
57
+ - **API Contract**: Are request/response schemas defined?
58
+ - **Security Review**: Does design address authZ, authN, data protection?
59
+ - **Scalability**: Are load/performance targets specified?
60
+
61
+ #### Coverage Validation (`--type coverage`):
62
+ - **Traceability Matrix**: Map each requirement to test cases.
63
+ - **Coverage Gaps**: Identify requirements with no tests.
64
+ - **Orphan Tests**: Find tests that don't map to requirements.
65
+
66
+ ### Phase 3: Report Generation
67
+
68
+ - **Consolidate**: Aggregate all validation findings.
69
+ - **Score**: Calculate validation score (% of criteria met).
70
+ - **Blocker Flag**: Mark items that must be resolved before implementation.
71
+ - **Export**: Generate validation report.
72
+
73
+ ## 5. Output Guidelines (The Contract)
74
+
75
+ ### Validation Report Template
76
+
77
+ ```markdown
78
+ # Validation Report: [Target Name]
79
+
80
+ ## Summary
81
+ **Validation Type**: Requirements
82
+ **Strictness Level**: Normal
83
+ **Overall Score**: 87% (✅ PASS / ❌ FAIL)
84
+ **Blockers**: 2 (Must resolve before implementation)
85
+ **Warnings**: 5 (Should address)
86
+ **Date**: 2026-01-30
87
+
88
+ ## Detailed Findings
89
+
90
+ ### ✅ Passed Checks
91
+
92
+ | Check | Details |
93
+ |:-----|:--------|
94
+ | INVEST - Independent | All stories are self-contained |
95
+ | INVEST - Testable | Acceptance criteria use Gherkin syntax |
96
+ | API Contracts | All endpoints have Zod schemas |
97
+
98
+ ### ⚠️ Warnings (Should Fix)
99
+
100
+ | ID | Category | Issue | Recommendation | Severity |
101
+ |:---|:---------|:------|:---------------|:--------:|
102
+ | W-001 | Ambiguity | Story US-004 says "fast response" | Define specific SLA (<200ms) | Medium |
103
+ | W-002 | Completeness | No error handling requirements | Add failure scenarios | Medium |
104
+
105
+ ### 🛑 Blockers (Must Fix)
106
+
107
+ | ID | Category | Issue | Recommendation | Severity |
108
+ |:---|:---------|:------|:---------------|:--------:|
109
+ | B-001 | Security | No authentication requirements | Add auth flows and token handling | Critical |
110
+ | B-002 | Testability | US-007 lacks acceptance criteria | Add Given/When/Then scenarios | High |
111
+
112
+ ## Traceability Matrix
113
+
114
+ | Requirement | Design | Test Case | Status |
115
+ |:------------|:-------|:----------|:------:|
116
+ | US-001: User login | ADR-003 | TC-001, TC-002 | ✅ Covered |
117
+ | US-002: Password reset | ADR-003 | ❌ None | ❌ Gap |
118
+ | US-003: OAuth | ADR-005 | TC-003 | ✅ Covered |
119
+
120
+ ## Recommendations
121
+
122
+ 1. **Immediate**: Resolve B-001 (security) before any implementation.
123
+ 2. **Before Sprint**: Add acceptance criteria to US-007.
124
+ 3. **Nice to Have**: Quantify performance requirements (replace "fast" with SLA).
125
+
126
+ ## Sign-off
127
+
128
+ - [ ] Requirements validated
129
+ - [ ] Blockers resolved
130
+ - [ ] Ready for implementation
131
+ ```
132
+
133
+ ### Quick Checklist Output
134
+
135
+ ```markdown
136
+ ## Validation Checklist: [Target]
137
+
138
+ ### Requirements
139
+ - [x] All stories follow INVEST principles
140
+ - [x] Acceptance criteria present
141
+ - [ ] No ambiguous language (2 found)
142
+ - [x] User personas defined
143
+
144
+ ### Design
145
+ - [x] ADRs for major decisions
146
+ - [ ] API contracts complete (1 missing)
147
+ - [x] Security considerations documented
148
+
149
+ ### Test Coverage
150
+ - [x] Traceability matrix created
151
+ - [ ] 100% requirement coverage (87% actual)
152
+ - [x] Orphan tests identified
153
+
154
+ **Result**: ⚠️ PARTIAL - Address 3 items before proceeding
155
+ ```
156
+
157
+ ## 6. Examples
158
+
159
+ ### A. Requirements Validation
160
+
161
+ ```bash
162
+ /soc-validate "User Authentication Epic" --type requirements --strict strict
163
+ ```
164
+
165
+ *Effect:* Validates all user stories in the auth epic against INVEST principles, flags ambiguous language, and ensures acceptance criteria follow Gherkin syntax.
166
+
167
+ ### B. Full Project Validation
168
+
169
+ ```bash
170
+ /soc-validate "v2.0 Release" --type full --output matrix --block-on-fail
171
+ ```
172
+
173
+ *Effect:* Runs comprehensive validation across requirements, design, and test coverage. Generates a traceability matrix and exits with error code if blockers found (for CI/CD gates).
174
+
175
+ ### C. Design-Only Check
176
+
177
+ ```bash
178
+ /soc-validate "Payment API Design" --type design --output checklist
179
+ ```
180
+
181
+ *Effect:* Validates the payment API design has complete ADRs, proper schemas, security considerations, and scalability plans. Outputs a quick checklist format.
182
+
183
+ ## 7. Dependencies & Capabilities
184
+
185
+ ### Agents
186
+
187
+ - **Orchestrator**: `[pm-agent]` - Requirements validation and acceptance criteria review.
188
+ - **Technical Validator**: `[architect]` - Design and ADR validation.
189
+ - **Quality Validator**: `[quality]` - Test coverage and traceability analysis.
190
+
191
+ ### Skills
192
+
193
+ - **Confidence Check**: `@[.opencode/skills/confidence-check/SKILL.md]` - Ensures validation criteria are clear.
194
+ - **Security Audit**: `@[.opencode/skills/security-audit/SKILL.md]` - Validates security requirements.
195
+ - **Self Check**: `@[.opencode/skills/self-check/SKILL.md]` - Validates validation process itself (meta!).
196
+
197
+ ### MCP Integration
198
+
199
+ - **`read_file`**: Parse requirements, designs, and test files.
200
+ - **`grep`**: Search for patterns (e.g., "TODO", "FIXME", ambiguous terms).
201
+ - **`sequential-thinking`**: Analyze complex requirement dependencies.
202
+
203
+ ## 8. Boundaries
204
+
205
+ **Will:**
206
+
207
+ - Validate requirements against industry standards (INVEST, SMART, Gherkin).
208
+ - Create traceability matrices linking requirements to tests and designs.
209
+ - Flag ambiguous or incomplete requirements.
210
+ - Block implementation if critical gaps found (with `--block-on-fail`).
211
+
212
+ **Will Not:**
213
+
214
+ - **Auto-Fix Issues**: Identifies problems but doesn't rewrite requirements.
215
+ - **Write Tests**: Validates test coverage exists, but doesn't create tests.
216
+ - **Override Business Decisions**: Flags concerns but doesn't change requirements without user approval.
217
+ - **Validate Implementation**: Checks design/requirements only—use `/soc-review` for code review.
218
+
219
+ ## User Instruction
220
+
221
+ The user have executed the `/soc-validate` command by parsing the user's arguments provided in `<user-instruction>$ARGUMENTS</user-instruction>`, then route to the appropriate validation type (requirements, design, coverage, or full), read and parse the target artifacts (requirements documents, ADRs, test files), apply validation checks based on strictness level (INVEST, Gherkin, ambiguity detection, coverage analysis), identify blockers that must be resolved before implementation, generate a comprehensive validation report with traceability matrix, output findings in the requested format (report, matrix, or checklist), and if `--block-on-fail` is set, signal failure when blockers are present.
@@ -5,9 +5,11 @@ description: Custom workflow creation and execution
5
5
  # /soc-workflow
6
6
 
7
7
  ## 1. Command Overview
8
+
8
9
  The `/soc-workflow` command is the "Factory." It allows users to create, list, and run custom sequences of agent commands. It turns a manual, multi-step process (e.g., "Check status -> Pull -> Build -> Deploy") into a single executable command.
9
10
 
10
11
  ## 2. Triggers & Routing
12
+
11
13
  The command is a meta-orchestrator.
12
14
 
13
15
  | Trigger Scenario | Flag | Action |
@@ -17,29 +19,34 @@ The command is a meta-orchestrator.
17
19
  | **List Available** | `list` | Scans directory for `.md` files |
18
20
 
19
21
  ## 3. Usage & Arguments
22
+
20
23
  ```bash
21
24
  /soc-workflow [action] [name]
22
25
  ```
23
26
 
24
27
  ### Arguments
25
- - **`[action]`**: `create`, `run`, `list`, `edit`, `delete`.
26
- - **`[name]`**: Name of the workflow (e.g., `deploy`).
28
+
29
+ - **`[action]`**: `create`, `run`, `list`, `edit`, `delete`.
30
+ - **`[name]`**: Name of the workflow (e.g., `deploy`).
27
31
 
28
32
  ## 4. Behavioral Flow (Orchestration)
29
33
 
30
34
  ### Phase 1: Definition (Create)
31
- 1. **Template**: Creates a standard markdown file with "Steps."
32
- 2. **Define**: User fills in shell commands or agent commands (`/soc-git`, `/soc-test`).
35
+
36
+ 1. **Template**: Creates a standard markdown file with "Steps."
37
+ 2. **Define**: User fills in shell commands or agent commands (`/soc-git`, `/soc-test`).
33
38
 
34
39
  ### Phase 2: Execution (Run)
35
- 1. **Parse**: Reads the markdown.
36
- 2. **Step**: Executes step 1.
37
- 3. **Check**: If step 1 fails, stop (unless `continue_on_error: true`).
38
- 4. **Next**: Proceed to step 2.
40
+
41
+ 1. **Parse**: Reads the markdown.
42
+ 2. **Step**: Executes step 1.
43
+ 3. **Check**: If step 1 fails, stop (unless `continue_on_error: true`).
44
+ 4. **Next**: Proceed to step 2.
39
45
 
40
46
  ## 5. Output Guidelines (The Contract)
41
47
 
42
48
  ### Workflow Definition (Template)
49
+
43
50
  ```markdown
44
51
  ---
45
52
  description: Deploy to Staging
@@ -51,6 +58,7 @@ description: Deploy to Staging
51
58
  ```
52
59
 
53
60
  ### Execution Log
61
+
54
62
  ```markdown
55
63
  ## Workflow: Deploy Staging
56
64
  1. [x] **Test**: Passed (2s)
@@ -62,36 +70,49 @@ description: Deploy to Staging
62
70
  ## 6. Examples
63
71
 
64
72
  ### A. Create Release Workflow
73
+
65
74
  ```bash
66
75
  /soc-workflow create release
67
76
  ```
77
+
68
78
  *Effect:* Creates `.agent/workflows/release.md` for the user to edit.
69
79
 
70
80
  ### B. Run Nightly Build
81
+
71
82
  ```bash
72
83
  /soc-workflow run nightly
73
84
  ```
85
+
74
86
  *Effect:* Runs the sequence defined in `nightly.md`.
75
87
 
76
88
  ## 7. Dependencies & Capabilities
77
89
 
78
90
  ### Agents
79
- - **PM Agent**: `@[.opencode/agents/pm-agent.md]` - For oversight.
91
+
92
+ - **PM Agent**: `@[.opencode/agents/pm-agent.md]` - For oversight.
80
93
 
81
94
  ### Skills
82
- - **None**: It relies on other commands.
95
+
96
+ - **None**: It relies on other commands.
83
97
 
84
98
  ### MCP Integration
85
- - **`filesystem`**: Reading/Writing workflow files.
86
- - **`run_command`**: Executing shell steps.
99
+
100
+ - **`filesystem`**: Reading/Writing workflow files.
101
+ - **`run_command`**: Executing shell steps.
87
102
 
88
103
  ## 8. Boundaries
89
104
 
90
105
  **Will:**
91
- - Execute commands in sequence.
92
- - Stop on error.
93
- - Pass context between steps.
106
+
107
+ - Execute commands in sequence.
108
+ - Stop on error.
109
+ - Pass context between steps.
94
110
 
95
111
  **Will Not:**
96
- - **Auto-Debug**: If a step fails, the workflow just stops.
97
- - **Parallize**: Steps are currently sequential only.
112
+
113
+ - **Auto-Debug**: If a step fails, the workflow just stops.
114
+ - **Parallize**: Steps are currently sequential only.
115
+
116
+ ## User Instruction
117
+
118
+ The user have executed the `/soc-workflow` command by parsing the user's arguments provided in `<user-instruction>$ARGUMENTS</user-instruction>`, then perform the specified action (create, run, list, edit, or delete) on the named workflow, create a new workflow template in `.agent/workflows/` when the action is `create`, list all available workflows when the action is `list`, parse and execute workflow steps in sequence when the action is `run`—stopping on error unless `continue_on_error` is specified, pass context between steps, and generate an execution log showing the status of each step and overall workflow completion.
@@ -6,11 +6,13 @@ description: Pre-execution risk assessment to prevent hallucinations and archite
6
6
  # Confidence Check Skill
7
7
 
8
8
  ## Purpose
9
+
9
10
  To calculate a probabilistic "Success Score" (0.0 - 1.0) **before** generating code. This acts as a circuit breaker for the `execution` mode.
10
11
 
11
12
  **ROI Metric**: A 200-token analysis prevents 2,000+ tokens of incorrect code generation and subsequent debugging time.
12
13
 
13
14
  ## When to Use
15
+
14
16
  - **Automatic Trigger**: Before any `write_file` operation affecting > 50 lines of code.
15
17
  - **Manual Trigger**: When requirements are vague (e.g., "Fix the bug").
16
18
  - **Agent Handoff**: When `pm-agent` assigns a task to `backend` or `frontend`.
@@ -28,20 +30,23 @@ To calculate a probabilistic "Success Score" (0.0 - 1.0) **before** generating c
28
30
  ## Scoring & Protocols
29
31
 
30
32
  ### 🟢 High Confidence (≥ 0.90)
33
+
31
34
  **Action**: **PROCEED** to `execution` mode.
32
- * *Definition:* You have the file paths, the schema is defined, you have verified the library version, and you have a rollback plan.
35
+ - *Definition:* You have the file paths, the schema is defined, you have verified the library version, and you have a rollback plan.
33
36
 
34
37
  ### 🟡 Medium Confidence (0.70 - 0.89)
38
+
35
39
  **Action**: **REFINE** before coding.
36
- * *Protocol:* Identify the weak pillar and fix it.
37
- * *Weak Docs?* -> Trigger `researcher` to fetch API refs.
38
- * *Weak Specs?* -> Trigger `architect` to define the interface.
39
- * *Weak Context?* -> Run `grep` to find usages.
40
+ - *Protocol:* Identify the weak pillar and fix it.
41
+ - *Weak Docs?* -> Trigger `researcher` to fetch API refs.
42
+ - *Weak Specs?* -> Trigger `architect` to define the interface.
43
+ - *Weak Context?* -> Run `grep` to find usages.
40
44
 
41
45
  ### 🔴 Low Confidence (< 0.70)
46
+
42
47
  **Action**: **HALT**.
43
- * *Protocol:* Do not write code. Return control to `pm-agent` or ask the user clarifying questions.
44
- * *Example:* "I cannot proceed. I do not know the expected return type of the API, and I cannot find a design pattern for this module."
48
+ - *Protocol:* Do not write code. Return control to `pm-agent` or ask the user clarifying questions.
49
+ - *Example:* "I cannot proceed. I do not know the expected return type of the API, and I cannot find a design pattern for this module."
45
50
 
46
51
  ## Execution Template
47
52
 
@@ -81,17 +86,19 @@ To calculate a probabilistic "Success Score" (0.0 - 1.0) **before** generating c
81
86
  ## Scenario Examples
82
87
 
83
88
  ### Scenario A: Adding a new API Endpoint
84
- * **Context**: Read `server.ts`? Yes.
85
- * **Spec**: No request schema defined. (**0**)
86
- * **Docs**: Know Express well. (0.2)
87
- * **Pattern**: Copied existing controller style. (0.15)
88
- * **Risk**: Low. (0.15)
89
- * **Total**: **0.75 (Medium)**
90
- * **Action**: *STOP. Call `backend` agent to define Zod schema first. Then Proceed.*
89
+
90
+ * **Context**: Read `server.ts`? Yes.
91
+ - **Spec**: No request schema defined. (**0**)
92
+ - **Docs**: Know Express well. (0.2)
93
+ - **Pattern**: Copied existing controller style. (0.15)
94
+ - **Risk**: Low. (0.15)
95
+ - **Total**: **0.75 (Medium)**
96
+ - **Action**: *STOP. Call `backend` agent to define Zod schema first. Then Proceed.*
91
97
 
92
98
  ### Scenario B: "Fix the white screen"
93
- * **Context**: No error logs provided. (**0**)
94
- * **Spec**: Unknown. (**0**)
95
- * **Docs**: N/A.
96
- * **Total**: **0.15 (Low)**
97
- * **Action**: *HALT. Ask user for logs or reproduction steps. Trigger `brainstorming` mode.*
99
+
100
+ * **Context**: No error logs provided. (**0**)
101
+ - **Spec**: Unknown. (**0**)
102
+ - **Docs**: N/A.
103
+ - **Total**: **0.15 (Low)**
104
+ - **Action**: *HALT. Ask user for logs or reproduction steps. Trigger `brainstorming` mode.*
@@ -6,42 +6,52 @@ description: Scientific debugging workflow using Root Cause Analysis and Minimal
6
6
  # Debug Protocol Skill
7
7
 
8
8
  ## Purpose
9
+
9
10
  To replace "Shotgun Debugging" (randomly changing code) with a deterministic, scientific process.
10
11
  **Goal:** Fix the *root cause*, not just the symptom.
11
12
 
12
13
  ## When to Use
14
+
13
15
  - **Trigger**: When a test fails, an exception is thrown, or output is unexpected.
14
16
  - **Agent**: Primarily used by `execution` mode.
15
17
  - **Support**:
16
- - Call `quality` to write the reproduction test.
17
- - Call `researcher` if the error message is obscure/undocumented.
18
+ - Call `quality` to write the reproduction test.
19
+ - Call `researcher` if the error message is obscure/undocumented.
18
20
 
19
21
  ## The Scientific Method (4-Step Protocol)
20
22
 
21
23
  ### Phase 1: Observation (The MRE)
24
+
22
25
  **Rule**: *If you cannot reproduce it, you cannot fix it.*
23
- 1. **Isolate**: Create a standalone script or test case that fails 100% of the time.
24
- 2. **Minimize**: Remove all code not strictly necessary to produce the error.
25
- 3. **Log**: Do not guess variables. Log them.
26
+
27
+ 1. **Isolate**: Create a standalone script or test case that fails 100% of the time.
28
+ 2. **Minimize**: Remove all code not strictly necessary to produce the error.
29
+ 3. **Log**: Do not guess variables. Log them.
26
30
 
27
31
  ### Phase 2: Localization (The "Wolf Fence")
32
+
28
33
  **Rule**: *Divide and Conquer.*
29
- 1. **Binary Search**: Is the data wrong at the Database? No? At the API? No? At the UI?
30
- 2. **Trace**: Follow the data flow. Find the *exact line* where the reality diverges from expectation.
34
+
35
+ 1. **Binary Search**: Is the data wrong at the Database? No? At the API? No? At the UI?
36
+ 2. **Trace**: Follow the data flow. Find the *exact line* where the reality diverges from expectation.
31
37
 
32
38
  ### Phase 3: Hypothesis (The "5 Whys")
39
+
33
40
  **Rule**: *Do not fix the symptom.*
34
- 1. **Identify**: "Variable X is null."
35
- 2. **Ask Why**: "Why is X null?" -> "Because the API returned 404."
36
- 3. **Ask Why**: "Why 404?" -> "Because the ID was undefined."
37
- 4. **Ask Why**: "Why undefined?" -> "Because of a typo in the frontend."
38
- 5. **Root Cause**: Typo in the frontend payload.
41
+
42
+ 1. **Identify**: "Variable X is null."
43
+ 2. **Ask Why**: "Why is X null?" -> "Because the API returned 404."
44
+ 3. **Ask Why**: "Why 404?" -> "Because the ID was undefined."
45
+ 4. **Ask Why**: "Why undefined?" -> "Because of a typo in the frontend."
46
+ 5. **Root Cause**: Typo in the frontend payload.
39
47
 
40
48
  ### Phase 4: Resolution & Verification
49
+
41
50
  **Rule**: *Prove it.*
42
- 1. **Apply Fix**: Correct the root cause.
43
- 2. **Verify**: Run the MRE from Phase 1. It must pass.
44
- 3. **Regression**: Run the full test suite. Ensure nothing else broke.
51
+
52
+ 1. **Apply Fix**: Correct the root cause.
53
+ 2. **Verify**: Run the MRE from Phase 1. It must pass.
54
+ 3. **Regression**: Run the full test suite. Ensure nothing else broke.
45
55
 
46
56
  ## Debugging Scratchpad Template
47
57
 
@@ -79,5 +89,5 @@ To replace "Shotgun Debugging" (randomly changing code) with a deterministic, sc
79
89
 
80
90
  ## Integration with Agents
81
91
 
82
- - **`quality` agent**: If you are stuck on **Phase 1 (Reproduction)**, delegate to `quality`. *"I see the error, but I can't write a test for it. Quality Agent, please create a Cypress test for this UI bug."*
83
- - **`researcher` agent**: If you are stuck on **Phase 3 (Hypothesis)**. *"I have the error 'Heap Out of Memory'. Researcher, what are the common causes for this in Node.js 18?"*
92
+ - **`quality` agent**: If you are stuck on **Phase 1 (Reproduction)**, delegate to `quality`. *"I see the error, but I can't write a test for it. Quality Agent, please create a Cypress test for this UI bug."*
93
+ - **`researcher` agent**: If you are stuck on **Phase 3 (Hypothesis)**. *"I have the error 'Heap Out of Memory'. Researcher, what are the common causes for this in Node.js 18?"*