@c0x12c/spartan-ai-toolkit 1.6.4 → 1.6.5
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/VERSION +1 -1
- package/agents/phase-reviewer.md +39 -6
- package/claude-md/01-core.md +2 -2
- package/commands/spartan/build.md +131 -27
- package/commands/spartan/contribute.md +1 -1
- package/commands/spartan/debug.md +301 -7
- package/commands/spartan/kickoff.md +59 -38
- package/commands/spartan.md +5 -5
- package/package.json +1 -1
- package/packs/core.yaml +1 -2
- package/packs/packs.compiled.json +1 -3
- package/packs/research.yaml +0 -1
- package/skills/startup-pipeline/SKILL.md +1 -1
- package/commands/spartan/fix.md +0 -260
- package/commands/spartan/full-run.md +0 -13
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.5
|
package/agents/phase-reviewer.md
CHANGED
|
@@ -81,11 +81,33 @@ Pick the right checks based on file types:
|
|
|
81
81
|
|
|
82
82
|
## How You Work
|
|
83
83
|
|
|
84
|
-
1. **
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
1. **Load project rules first.** Before looking at any code, read the rule files that match the stack. These are the source of truth — they override your defaults.
|
|
85
|
+
|
|
86
|
+
**Find rules in this order** (use the first location that exists):
|
|
87
|
+
```bash
|
|
88
|
+
ls rules/ 2>/dev/null # project root
|
|
89
|
+
ls .claude/rules/ 2>/dev/null # project .claude dir
|
|
90
|
+
ls ~/.claude/rules/ 2>/dev/null # global install
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Backend rules (read if .kt files changed):**
|
|
94
|
+
- `rules/backend-micronaut/KOTLIN.md`
|
|
95
|
+
- `rules/backend-micronaut/CONTROLLERS.md`
|
|
96
|
+
- `rules/backend-micronaut/API_DESIGN.md`
|
|
97
|
+
- `rules/backend-micronaut/SERVICES_AND_BEANS.md`
|
|
98
|
+
- `rules/database/SCHEMA.md`
|
|
99
|
+
- `rules/database/ORM_AND_REPO.md`
|
|
100
|
+
- `rules/database/TRANSACTIONS.md`
|
|
101
|
+
|
|
102
|
+
**Frontend rules (read if .tsx/.ts files changed):**
|
|
103
|
+
- `rules/frontend-react/FRONTEND.md`
|
|
104
|
+
|
|
105
|
+
If a rule file doesn't exist, skip it. Don't guess what it says.
|
|
106
|
+
|
|
107
|
+
2. **Read the spec and plan** if provided. Check that code matches what was specified and planned. Flag anything missing or different.
|
|
108
|
+
3. **Read every changed file.** Don't skim. Read line by line.
|
|
109
|
+
4. **Check against the rules you loaded**, then the checklists below.
|
|
110
|
+
5. **Compare to the design doc** if one exists. UI must match the approved design.
|
|
89
111
|
|
|
90
112
|
## Your Output
|
|
91
113
|
|
|
@@ -98,14 +120,23 @@ Pick the right checks based on file types:
|
|
|
98
120
|
[Only if NEEDS CHANGES]
|
|
99
121
|
|
|
100
122
|
1. **[severity: HIGH/MEDIUM]** [file:line] — [what's wrong]
|
|
123
|
+
- Rule: [which rule file or checklist item this breaks]
|
|
101
124
|
- Why: [why this matters]
|
|
102
125
|
- Fix: [what to do]
|
|
103
126
|
|
|
104
127
|
2. ...
|
|
105
128
|
|
|
129
|
+
### Spec Compliance
|
|
130
|
+
- [does the code match the spec? anything missing?]
|
|
131
|
+
- [if no spec provided: "No spec to check against"]
|
|
132
|
+
|
|
106
133
|
### What's Clean
|
|
107
134
|
- [what was done well — always include this]
|
|
108
135
|
|
|
136
|
+
### Documentation Updates Needed
|
|
137
|
+
- [rule file]: [what to add/update] — OR "none"
|
|
138
|
+
- [.memory/patterns/]: [new pattern worth saving] — OR "none"
|
|
139
|
+
|
|
109
140
|
### Notes
|
|
110
141
|
- [anything else worth mentioning]
|
|
111
142
|
```
|
|
@@ -113,8 +144,10 @@ Pick the right checks based on file types:
|
|
|
113
144
|
## Rules
|
|
114
145
|
|
|
115
146
|
- **Be specific.** Every issue must have a file and line number.
|
|
147
|
+
- **Cite the rule.** Every issue must reference which rule file or checklist item it breaks. If it's not in a rule, say which checklist section.
|
|
116
148
|
- **Separate must-fix from nice-to-have.** HIGH = must fix before shipping. MEDIUM = fix if time allows.
|
|
117
|
-
- **Don't invent rules.** Only flag things from the checklists above or from project rules files.
|
|
149
|
+
- **Don't invent rules.** Only flag things from the checklists above or from project rules files you actually read.
|
|
118
150
|
- **Praise good code.** Reviews aren't just for finding problems.
|
|
119
151
|
- **One round of discussion.** If the builder disagrees with a finding, hear them out. Change your mind if they're right. Hold firm if they're wrong. No ego.
|
|
120
152
|
- **ACCEPT means ACCEPT.** Don't say "accept with reservations." Either it passes or it doesn't.
|
|
153
|
+
- **Flag documentation gaps.** If you see a new pattern, convention, or recurring issue that should be documented, add it to "Documentation Updates Needed". Don't skip this section.
|
package/claude-md/01-core.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
## Core Principles (Always Enforce)
|
|
5
5
|
|
|
6
6
|
### 1. Match the User's Language
|
|
7
|
-
**Detect the language of the user's message and respond entirely in that same language.** This is not optional — it overrides the default English behavior of all commands. If the user writes in Vietnamese, ALL output must be in Vietnamese. If in French, respond in French. If in English, respond in English. This applies to everything: explanations, questions, gate prompts, debug reports, summaries, and PR descriptions. Only code syntax, variable names, file paths, and command names (e.g., `/spartan:
|
|
7
|
+
**Detect the language of the user's message and respond entirely in that same language.** This is not optional — it overrides the default English behavior of all commands. If the user writes in Vietnamese, ALL output must be in Vietnamese. If in French, respond in French. If in English, respond in English. This applies to everything: explanations, questions, gate prompts, debug reports, summaries, and PR descriptions. Only code syntax, variable names, file paths, and command names (e.g., `/spartan:debug`) stay in their original form.
|
|
8
8
|
|
|
9
9
|
### 2. Spec Before Code
|
|
10
10
|
- Task < 1 day → `/spartan:spec` + `/spartan:plan` + `/spartan:build`
|
|
@@ -80,7 +80,7 @@ Auto mode is ideal for experienced users who trust the workflow and want maximum
|
|
|
80
80
|
|---|---|
|
|
81
81
|
| `/spartan` | **Smart router** — routes to the right workflow or command |
|
|
82
82
|
| `/spartan:build [backend\|frontend] "feature"` | Full feature workflow: understand → plan → TDD → review → PR |
|
|
83
|
-
| `/spartan:
|
|
83
|
+
| `/spartan:debug "symptom"` | Bug workflow: reproduce → investigate → fix → review → PR |
|
|
84
84
|
| `/spartan:onboard` | Codebase understanding: scan → map → setup |
|
|
85
85
|
|
|
86
86
|
### Spec & Plan (saved artifacts)
|
|
@@ -403,45 +403,130 @@ npm test && npm run build
|
|
|
403
403
|
|
|
404
404
|
**This is NOT a self-review.** Spawn a separate review agent to get a fresh perspective. The reviewer finds issues, you fix them, repeat until clean.
|
|
405
405
|
|
|
406
|
-
### Step 1:
|
|
406
|
+
### Step 1: Gather review context
|
|
407
407
|
|
|
408
|
-
|
|
408
|
+
Before spawning the reviewer, collect everything it needs:
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# 1. Get changed files by type
|
|
412
|
+
git diff main...HEAD --name-only | grep '\.kt$' # backend files
|
|
413
|
+
git diff main...HEAD --name-only | grep '\.tsx\?$' # frontend files
|
|
414
|
+
git diff main...HEAD --name-only | grep '\.sql$' # migration files
|
|
415
|
+
|
|
416
|
+
# 2. Find spec and plan for this feature
|
|
417
|
+
ls .planning/specs/*.md .planning/plans/*.md .planning/designs/*.md 2>/dev/null
|
|
418
|
+
|
|
419
|
+
# 3. Find installed rules (pick based on mode)
|
|
420
|
+
ls rules/backend-micronaut/ rules/database/ rules/frontend-react/ 2>/dev/null
|
|
421
|
+
# Also check ~/.claude/rules/ if project rules/ not found
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Step 2: Spawn the review agent
|
|
425
|
+
|
|
426
|
+
Use the `Agent` tool to spawn a reviewer. **The prompt changes based on mode.**
|
|
427
|
+
|
|
428
|
+
Build the prompt from these blocks — include only what matches the mode:
|
|
409
429
|
|
|
410
430
|
```
|
|
411
431
|
Agent:
|
|
412
432
|
name: "reviewer"
|
|
413
|
-
subagent_type: "phase-reviewer"
|
|
433
|
+
subagent_type: "phase-reviewer"
|
|
414
434
|
prompt: |
|
|
415
435
|
You are reviewing code changes for the feature: {feature name}.
|
|
416
436
|
|
|
417
|
-
|
|
418
|
-
- Backend
|
|
419
|
-
- Frontend
|
|
437
|
+
## What changed
|
|
438
|
+
- Backend files: {list .kt files from git diff, or "none"}
|
|
439
|
+
- Frontend files: {list .tsx/.ts files from git diff, or "none"}
|
|
440
|
+
- Migration files: {list .sql files from git diff, or "none"}
|
|
420
441
|
- Design doc: {path if exists, or "none"}
|
|
421
442
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
-
|
|
443
|
+
## Spec and plan
|
|
444
|
+
- Spec: {path to spec file, or inline scope block from Stage 1}
|
|
445
|
+
- Plan: {path to plan file, or inline plan from Stage 3}
|
|
446
|
+
Check that the code matches what was specified and planned. Flag missing pieces.
|
|
447
|
+
|
|
448
|
+
## Rules to check against
|
|
449
|
+
Read these rule files BEFORE reviewing code. They are the source of truth.
|
|
450
|
+
|
|
451
|
+
{IF backend or full-stack mode, include:}
|
|
452
|
+
**Backend rules (read all of these):**
|
|
453
|
+
- `rules/backend-micronaut/KOTLIN.md` — null safety, Either error handling, coroutines, no `!!`
|
|
454
|
+
- `rules/backend-micronaut/CONTROLLERS.md` — thin controllers, @ExecuteOn, @Secured, delegate to Manager
|
|
455
|
+
- `rules/backend-micronaut/API_DESIGN.md` — query params only, RPC-style URLs, no path params
|
|
456
|
+
- `rules/backend-micronaut/SERVICES_AND_BEANS.md` — Manager returns Either, service layer patterns
|
|
457
|
+
- `rules/database/SCHEMA.md` — TEXT not VARCHAR, no FK, soft deletes, UUID PKs, standard columns
|
|
458
|
+
- `rules/database/ORM_AND_REPO.md` — Exposed ORM, repository pattern
|
|
459
|
+
- `rules/database/TRANSACTIONS.md` — transaction(db.primary) {} for multi-table ops
|
|
460
|
+
|
|
461
|
+
{IF frontend or full-stack mode, include:}
|
|
462
|
+
**Frontend rules (read all of these):**
|
|
463
|
+
- `rules/frontend-react/FRONTEND.md` — build check before commit, API case conversion, null safety, optimistic updates
|
|
464
|
+
|
|
465
|
+
{IF design doc exists, include:}
|
|
466
|
+
**Design compliance:**
|
|
467
|
+
- Read the design doc at {path}. Check that UI matches the approved design.
|
|
468
|
+
- Flag any component that looks different from the design spec.
|
|
469
|
+
|
|
470
|
+
## Review stages (check all that apply)
|
|
471
|
+
|
|
472
|
+
**Stage 1 — Correctness & Requirements**
|
|
473
|
+
- Does the code match the spec? Any missing requirements?
|
|
474
|
+
- Are all edge cases handled?
|
|
475
|
+
- Is error handling using Either (not thrown exceptions)?
|
|
476
|
+
|
|
477
|
+
**Stage 2 — Stack Conventions**
|
|
478
|
+
{backend}: Controllers thin? Manager has business logic? Either<ClientException, T>? No `!!`? @ExecuteOn on blocking calls? @Secured on controllers?
|
|
479
|
+
{frontend}: Strict TypeScript? No `any`? Hooks rules followed? Server vs client components correct?
|
|
480
|
+
|
|
481
|
+
**Stage 3 — Test Coverage**
|
|
482
|
+
- New endpoints have @MicronautTest integration tests?
|
|
483
|
+
- Tests are independent (no order dependency)?
|
|
484
|
+
- Edge cases tested? Happy path + error paths?
|
|
485
|
+
- Frontend: components tested with Testing Library?
|
|
486
|
+
|
|
487
|
+
**Stage 4 — Architecture & Clean Code**
|
|
488
|
+
- Layered: Controller → Manager → Service/Repository?
|
|
489
|
+
- No business logic in controllers or repositories?
|
|
490
|
+
- Functions small and focused? No deep nesting?
|
|
491
|
+
- No duplication, no dead code?
|
|
492
|
+
|
|
493
|
+
**Stage 5 — Database & API**
|
|
494
|
+
- Migration uses TEXT not VARCHAR? No FK constraints?
|
|
495
|
+
- Soft delete with deleted_at? Standard columns (id, created_at, updated_at, deleted_at)?
|
|
496
|
+
- UUID primary keys? Input validation on public endpoints?
|
|
497
|
+
- API URLs follow RPC style?
|
|
498
|
+
|
|
499
|
+
**Stage 6 — Security**
|
|
500
|
+
- Auth checks on all endpoints?
|
|
501
|
+
- Input validated and sanitized?
|
|
502
|
+
- No sensitive data logged or exposed in responses?
|
|
503
|
+
- No SQL injection, XSS, or command injection risks?
|
|
504
|
+
|
|
505
|
+
**Stage 7 — Documentation Gaps**
|
|
506
|
+
- New pattern used that should be documented? → flag for rules update
|
|
507
|
+
- New convention established? → flag for .memory/patterns/
|
|
508
|
+
- Recurring issue that should become a rule? → flag it
|
|
509
|
+
|
|
510
|
+
## Output format
|
|
511
|
+
|
|
512
|
+
For each issue:
|
|
513
|
+
- File and line number
|
|
433
514
|
- What's wrong
|
|
515
|
+
- Which rule it breaks (with rule file reference)
|
|
434
516
|
- Severity: HIGH (must fix) / MEDIUM (should fix) / LOW (nice to have)
|
|
435
517
|
- Suggested fix
|
|
436
518
|
|
|
437
|
-
End with
|
|
519
|
+
End with:
|
|
520
|
+
- **PASS** or **NEEDS CHANGES** (list all HIGH/MEDIUM issues)
|
|
521
|
+
- **Documentation updates needed** (list any rule/pattern updates from Stage 7, or "none")
|
|
522
|
+
- **What's clean** (always include — praise good code)
|
|
438
523
|
```
|
|
439
524
|
|
|
440
|
-
### Step
|
|
525
|
+
### Step 3: Fix loop
|
|
441
526
|
|
|
442
527
|
When the reviewer reports back:
|
|
443
528
|
|
|
444
|
-
**If PASS** → continue to Ship.
|
|
529
|
+
**If PASS** → save any documentation updates the reviewer flagged, then continue to Ship.
|
|
445
530
|
|
|
446
531
|
**If NEEDS CHANGES:**
|
|
447
532
|
|
|
@@ -458,23 +543,42 @@ When the reviewer reports back:
|
|
|
458
543
|
**Max 3 review rounds.** If still failing after 3 rounds, stop and ask the user:
|
|
459
544
|
> "Review found issues I can't fully fix. Here's what's left: [list]. Want to continue anyway or address these manually?"
|
|
460
545
|
|
|
461
|
-
### Step
|
|
546
|
+
### Step 4: Capture review learnings
|
|
547
|
+
|
|
548
|
+
After the reviewer says PASS, check its output for:
|
|
549
|
+
|
|
550
|
+
- **Documentation updates needed** → save to `.memory/knowledge/` so the next build knows
|
|
551
|
+
- **New pattern flagged** → save to `.memory/patterns/`
|
|
552
|
+
- **Rule violation that keeps showing up** → note it for the user to consider adding to rules
|
|
553
|
+
|
|
554
|
+
### Step 5: Parallel review with Agent Teams
|
|
462
555
|
|
|
463
556
|
```bash
|
|
464
557
|
echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
|
|
465
558
|
```
|
|
466
559
|
|
|
467
|
-
**If Agent Teams is enabled**,
|
|
560
|
+
**If Agent Teams is enabled**, spawn parallel review agents for deeper coverage. Each agent gets the same rule files from Step 1, but focuses on its area:
|
|
468
561
|
|
|
469
562
|
```
|
|
470
|
-
Agent 1: "quality-reviewer"
|
|
471
|
-
|
|
472
|
-
|
|
563
|
+
Agent 1: "quality-reviewer"
|
|
564
|
+
Focus: Stages 1-2, 4 (correctness, stack conventions, architecture)
|
|
565
|
+
Rules: all backend or frontend rules based on mode
|
|
566
|
+
Extra: check against spec and plan
|
|
567
|
+
|
|
568
|
+
Agent 2: "test-reviewer"
|
|
569
|
+
Focus: Stage 3 (test coverage, edge cases, test quality)
|
|
570
|
+
Rules: testing-strategies skill patterns
|
|
571
|
+
Extra: check test independence, proper assertions, no test duplication
|
|
572
|
+
|
|
573
|
+
Agent 3: "security-reviewer" (only if auth/input/data code changed)
|
|
574
|
+
Focus: Stage 6 (security)
|
|
575
|
+
Rules: security-checklist skill + OWASP top 10
|
|
576
|
+
Extra: check for injection, auth bypass, data exposure
|
|
473
577
|
```
|
|
474
578
|
|
|
475
|
-
All agents review at the same time. Combine their findings. All must PASS before moving to Ship. If any says NEEDS CHANGES → fix loop applies to the combined findings.
|
|
579
|
+
All agents review at the same time. Combine their findings. All must PASS before moving to Ship. If any says NEEDS CHANGES → fix loop (Step 3) applies to the combined findings.
|
|
476
580
|
|
|
477
|
-
**If Agent Teams is NOT enabled**, use a single review agent (
|
|
581
|
+
**If Agent Teams is NOT enabled**, use a single review agent (Steps 1-2 above).
|
|
478
582
|
|
|
479
583
|
---
|
|
480
584
|
|
|
@@ -117,7 +117,7 @@ If the user asks for deeper analysis, group reports by command and show:
|
|
|
117
117
|
| Command | Reports | Avg Score | Lowest | Top Issue |
|
|
118
118
|
|---------|---------|-----------|--------|-----------|
|
|
119
119
|
| /spartan:build | N | X.X | X | [most common complaint] |
|
|
120
|
-
| /spartan:
|
|
120
|
+
| /spartan:debug | N | X.X | X | [most common complaint] |
|
|
121
121
|
|
|
122
122
|
{% else %}
|
|
123
123
|
## Unknown argument: {{ args[0] }}
|
|
@@ -1,14 +1,308 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spartan:debug
|
|
3
|
-
description: "
|
|
4
|
-
argument-hint: "[describe the symptom
|
|
3
|
+
description: "Find and fix a bug end-to-end — structured investigation, root cause, test-first fix, and PR"
|
|
4
|
+
argument-hint: "[describe the symptom or error]"
|
|
5
|
+
preamble-tier: 3
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
# Debug
|
|
8
|
+
# Debug: {{ args[0] | default: "a bug" }}
|
|
8
9
|
|
|
9
|
-
**
|
|
10
|
+
You are the **Debug workflow leader** — structured debugging from symptom to merged PR.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
It covers the full cycle: reproduce → investigate → fix → ship to PR.
|
|
12
|
+
You decide when to investigate deeper, when to check memory for known issues, and when to ship. Don't guess. Don't try random fixes. Follow the pipeline.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```
|
|
15
|
+
PIPELINE:
|
|
16
|
+
|
|
17
|
+
Check Context → Reproduce → Investigate → Fix → Review Agent → Fix Loop → Ship
|
|
18
|
+
│ │ │ │ │ │ │
|
|
19
|
+
.memory/ Gate 1 Gate 2 Gate 3 Spawn agent Loop Gate 4
|
|
20
|
+
known issues fix until OK
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step 0: Check Context (silent — no questions)
|
|
26
|
+
|
|
27
|
+
Before touching anything, check if this is a known issue.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Check memory for known blockers and gotchas
|
|
31
|
+
ls .memory/blockers/ .memory/knowledge/ 2>/dev/null
|
|
32
|
+
|
|
33
|
+
# Check for handoff from a previous debug session
|
|
34
|
+
ls .handoff/*.md 2>/dev/null
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**If `.memory/blockers/` has files**, scan them for anything matching the symptom. If you find a match:
|
|
38
|
+
> "This might be a known issue. Found in `.memory/blockers/[file]`: [summary]. Let me verify if this is the same problem."
|
|
39
|
+
|
|
40
|
+
**If `.memory/knowledge/` has files**, scan for related gotchas or patterns that might explain the bug.
|
|
41
|
+
|
|
42
|
+
**If a handoff exists**, check if someone was already debugging this:
|
|
43
|
+
> "Found a previous debug session for this. Resuming from: [last stage]."
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Stage 1: Reproduce
|
|
48
|
+
|
|
49
|
+
**Goal:** Make the bug deterministic. Understand it fully before touching anything.
|
|
50
|
+
|
|
51
|
+
### Gather info
|
|
52
|
+
1. Get the exact error message, stack trace, or symptom
|
|
53
|
+
2. Ask if not clear:
|
|
54
|
+
- What inputs trigger it?
|
|
55
|
+
- What inputs do NOT trigger it?
|
|
56
|
+
- Consistent or flaky?
|
|
57
|
+
- Which environment? (local / CI / prod)
|
|
58
|
+
|
|
59
|
+
### Check recent changes
|
|
60
|
+
```bash
|
|
61
|
+
# What changed recently?
|
|
62
|
+
git log --oneline -15
|
|
63
|
+
git diff HEAD~5 --stat
|
|
64
|
+
|
|
65
|
+
# Are tests already failing?
|
|
66
|
+
./gradlew test --info 2>&1 | tail -40
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Find minimal reproduction
|
|
70
|
+
- Trace the code path from the symptom
|
|
71
|
+
- Identify the smallest input that triggers the bug
|
|
72
|
+
- Confirm you can make it happen on demand
|
|
73
|
+
|
|
74
|
+
**If you can't reproduce it:**
|
|
75
|
+
> Stop. Ask for more context — logs, steps, environment details. Don't move forward until you can see the bug happen.
|
|
76
|
+
|
|
77
|
+
**GATE 1 — STOP and ask:**
|
|
78
|
+
> "I can reproduce the bug. Here's what happens: [symptoms]. Here's how to trigger it: [steps]. Moving to investigation?"
|
|
79
|
+
>
|
|
80
|
+
> **Auto mode on?** → Show findings, continue immediately.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Stage 2: Investigate
|
|
85
|
+
|
|
86
|
+
**Goal:** Find the exact line, value, or decision that causes the failure.
|
|
87
|
+
|
|
88
|
+
### Binary isolation
|
|
89
|
+
Start from the failure point. Trace backwards:
|
|
90
|
+
|
|
91
|
+
1. At the crash/error point — what's the value?
|
|
92
|
+
2. One layer up — is the data correct here?
|
|
93
|
+
3. Keep going back until you find where correct data becomes wrong data
|
|
94
|
+
|
|
95
|
+
### Common patterns to check
|
|
96
|
+
|
|
97
|
+
**Kotlin/Micronaut:**
|
|
98
|
+
- `!!` operators (banned — null safety violation)
|
|
99
|
+
- Either handling — is `.left()` / `.right()` correct? Missing error branch?
|
|
100
|
+
- Coroutine scope — is a job cancelled before it finishes?
|
|
101
|
+
- `newSuspendedTransaction {}` — is it wrapping the right calls?
|
|
102
|
+
- Soft delete — is `deleted_at IS NULL` in the query?
|
|
103
|
+
|
|
104
|
+
**React/Next.js:**
|
|
105
|
+
- Missing dependency in `useEffect` array
|
|
106
|
+
- State update after unmount
|
|
107
|
+
- Server/client hydration mismatch
|
|
108
|
+
- Missing error boundary
|
|
109
|
+
- Wrong key prop in list rendering
|
|
110
|
+
|
|
111
|
+
**General:**
|
|
112
|
+
- Race condition — does order of execution matter?
|
|
113
|
+
- Stale cache — is old data being served?
|
|
114
|
+
- Config mismatch — different values between environments?
|
|
115
|
+
|
|
116
|
+
### Form a hypothesis
|
|
117
|
+
Write it down: "The root cause is [X] because [evidence]."
|
|
118
|
+
|
|
119
|
+
If your first hypothesis is wrong, try the next one. **Max 3 hypotheses** before stopping and asking for help. Don't go in circles.
|
|
120
|
+
|
|
121
|
+
**GATE 2 — STOP and ask:**
|
|
122
|
+
> "Root cause: [one sentence]. Evidence: [what proves it]. Here's my fix plan: [approach]. Sound right?"
|
|
123
|
+
>
|
|
124
|
+
> **Auto mode on?** → Show root cause, continue to fix.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Stage 3: Fix
|
|
129
|
+
|
|
130
|
+
**Goal:** Fix correctly. Make sure it can't come back.
|
|
131
|
+
|
|
132
|
+
### Step 1: Write failing test
|
|
133
|
+
```
|
|
134
|
+
Write a test that captures the exact bug scenario.
|
|
135
|
+
This test MUST FAIL right now — if it passes, you haven't reproduced the bug in the test.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Run it. Confirm red.
|
|
139
|
+
|
|
140
|
+
### Step 2: Write the minimal fix
|
|
141
|
+
Change as little as possible. This is a fix, not a refactor. Don't clean up nearby code. Don't "improve" things while you're here.
|
|
142
|
+
|
|
143
|
+
Run the test. Confirm green.
|
|
144
|
+
|
|
145
|
+
### Step 3: Check for similar patterns
|
|
146
|
+
The same mistake might exist elsewhere:
|
|
147
|
+
```bash
|
|
148
|
+
# Find code with the same pattern as the bug
|
|
149
|
+
grep -rn "[pattern from the bug]" --include="*.kt" --include="*.tsx" src/
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
If you find similar issues, fix them too. Each gets its own test.
|
|
153
|
+
|
|
154
|
+
### Step 4: Run full test suite
|
|
155
|
+
```bash
|
|
156
|
+
# Make sure nothing else broke
|
|
157
|
+
./gradlew test
|
|
158
|
+
# or
|
|
159
|
+
npm test
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Commit
|
|
163
|
+
```
|
|
164
|
+
fix([scope]): [root cause description]
|
|
165
|
+
|
|
166
|
+
- Root cause: [one line]
|
|
167
|
+
- Add regression test: [test name]
|
|
168
|
+
- Checked [N] similar patterns
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**GATE 3 — Implementation complete.**
|
|
172
|
+
> "Fixed. [X] tests passing, including the new regression test. Found [N] similar patterns — [fixed/clean]. Starting review."
|
|
173
|
+
>
|
|
174
|
+
> **Auto mode on?** → Go straight to review.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Stage 4: Review (agent-based — mandatory)
|
|
179
|
+
|
|
180
|
+
**Don't self-review bug fixes.** Spawn a separate review agent to catch things you missed.
|
|
181
|
+
|
|
182
|
+
### Spawn the review agent
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Use the `Agent` tool to spawn a reviewer:
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Agent:
|
|
192
|
+
name: "reviewer"
|
|
193
|
+
subagent_type: "phase-reviewer" (or "general-purpose" if not available)
|
|
194
|
+
prompt: |
|
|
195
|
+
You are reviewing a bug fix for: {symptom description}.
|
|
196
|
+
|
|
197
|
+
Root cause: {root cause}
|
|
198
|
+
Fix: {what was changed}
|
|
199
|
+
|
|
200
|
+
Run `git diff main...HEAD` to see all changes.
|
|
201
|
+
|
|
202
|
+
Review checklist:
|
|
203
|
+
**Root cause:** Does the fix address the root cause, not just the symptom?
|
|
204
|
+
**Regression test:** Does the test cover the exact scenario that failed?
|
|
205
|
+
**Side effects:** Could this fix break anything else?
|
|
206
|
+
**Similar patterns:** Were similar patterns in the codebase checked?
|
|
207
|
+
**No extras:** Is the change minimal? No unrelated cleanup?
|
|
208
|
+
|
|
209
|
+
Verdict: **PASS** or **NEEDS CHANGES** (with the list of issues).
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**If Agent Teams is enabled**, also spawn a test-reviewer in parallel:
|
|
213
|
+
```
|
|
214
|
+
Agent 2: "test-reviewer" — checks test quality, edge cases, coverage gaps
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Fix loop
|
|
218
|
+
|
|
219
|
+
**If PASS** → continue to Ship.
|
|
220
|
+
|
|
221
|
+
**If NEEDS CHANGES:**
|
|
222
|
+
1. Fix the issues
|
|
223
|
+
2. Commit: `fix([scope]): address review feedback`
|
|
224
|
+
3. Run tests
|
|
225
|
+
4. Spawn reviewer AGAIN with updated diff
|
|
226
|
+
5. Repeat until PASS
|
|
227
|
+
|
|
228
|
+
**Max 3 rounds.** If stuck, ask the user.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Stage 5: Ship
|
|
233
|
+
|
|
234
|
+
### Create PR
|
|
235
|
+
Clear description matters more for bug fixes than features:
|
|
236
|
+
|
|
237
|
+
```markdown
|
|
238
|
+
## What was broken
|
|
239
|
+
[User-visible symptom]
|
|
240
|
+
|
|
241
|
+
## Root cause
|
|
242
|
+
[One paragraph — what went wrong and why]
|
|
243
|
+
|
|
244
|
+
## Fix
|
|
245
|
+
[What was changed and why it fixes the root cause]
|
|
246
|
+
|
|
247
|
+
## How to verify
|
|
248
|
+
[Steps to confirm the bug is gone]
|
|
249
|
+
|
|
250
|
+
## Regression test
|
|
251
|
+
[Name of the test that guards against this]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Save to memory (if this bug reveals a pattern)
|
|
255
|
+
|
|
256
|
+
After the PR, check if this bug is worth remembering:
|
|
257
|
+
|
|
258
|
+
- **Recurring pattern?** (same type of bug seen before) → Save to `.memory/knowledge/`
|
|
259
|
+
- **Known blocker for other work?** → Save to `.memory/blockers/`
|
|
260
|
+
- **One-off typo or simple mistake?** → Don't save. Not worth remembering.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
mkdir -p .memory/knowledge .memory/blockers
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Update `.memory/index.md` if you saved anything.
|
|
267
|
+
|
|
268
|
+
**GATE 4 — Done.**
|
|
269
|
+
> "PR created: [link]. Bug: [symptom]. Root cause: [one line]. Fix: [one line]."
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Debug Report
|
|
274
|
+
|
|
275
|
+
After the PR is created, produce this summary:
|
|
276
|
+
|
|
277
|
+
```markdown
|
|
278
|
+
## Debug Report: [symptom]
|
|
279
|
+
|
|
280
|
+
**Root Cause:** [exact cause in one sentence]
|
|
281
|
+
|
|
282
|
+
**Why it happened:** [2-3 sentences — the chain of events]
|
|
283
|
+
|
|
284
|
+
**Fix:** [what changed and why]
|
|
285
|
+
|
|
286
|
+
**Test added:** [test name]
|
|
287
|
+
|
|
288
|
+
**Similar patterns checked:** [files checked / changes made]
|
|
289
|
+
|
|
290
|
+
**Prevention:** [what could stop this class of bug — lint rule, convention, type change, etc.]
|
|
291
|
+
|
|
292
|
+
**Saved to memory:** [yes/no — what was saved and why]
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Rules
|
|
298
|
+
|
|
299
|
+
- **You are the leader.** Check memory, investigate, fix, review, ship — all in one flow. Don't tell the user to run separate commands.
|
|
300
|
+
- **Follow the pipeline in order.** Don't skip to fixing. Understanding comes first.
|
|
301
|
+
- **Never guess.** Every hypothesis needs evidence. "I think it might be..." is not enough.
|
|
302
|
+
- **Write a failing test before writing the fix.** Always.
|
|
303
|
+
- **Minimal fix.** Change as little as possible. Don't refactor while fixing.
|
|
304
|
+
- **Check for siblings.** The same bug pattern might exist nearby. Always look.
|
|
305
|
+
- **Max 3 hypotheses in Stage 2.** If none pan out, stop and ask for help. Don't spiral.
|
|
306
|
+
- **Review is always an agent.** Never self-review. Spawn a reviewer, fix until PASS.
|
|
307
|
+
- **Save patterns to memory.** If this bug type could happen again, save it so future sessions know.
|
|
308
|
+
- **Small bugs don't need this workflow.** If you can see the typo, just fix it. This is for bugs that aren't obvious.
|
|
@@ -2,51 +2,72 @@
|
|
|
2
2
|
name: spartan:kickoff
|
|
3
3
|
description: "Start a new idea: create project folder, brainstorm, then validate top picks (Stages 1-2)"
|
|
4
4
|
argument-hint: "[theme or problem space]"
|
|
5
|
+
preamble-tier: 3
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Kickoff: {{ args[0] | default: "new idea" }}
|
|
8
9
|
|
|
9
|
-
Runs
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
10
|
+
Runs Brainstorm + Validate back to back. Gets you to a GO / PASS decision fast.
|
|
11
|
+
|
|
12
|
+
If the user already has a specific idea (not a theme), skip brainstorm and go straight to validate.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Step 1: Setup
|
|
17
|
+
|
|
18
|
+
Create project folder with stage subfolders:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
mkdir -p "projects/{{ args[0] | default: "new-idea" }}"/{01-brainstorm,02-interviews,03-validation,04-research,05-pitch}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Step 2: Brainstorm
|
|
27
|
+
|
|
28
|
+
Run `/spartan:brainstorm {{ args[0] | default: "" }}` internally — don't tell the user to run it separately.
|
|
29
|
+
|
|
30
|
+
This will:
|
|
31
|
+
1. Set the frame: space, target user, limits, goal
|
|
32
|
+
2. Generate 8-15 ideas
|
|
33
|
+
3. Rate each: demand signal, buildability, moat (0-5)
|
|
34
|
+
4. Pick top 3
|
|
35
|
+
5. Save to `projects/{{ args[0] }}/01-brainstorm/brainstorm-session.md`
|
|
36
|
+
|
|
37
|
+
### Gate 1
|
|
38
|
+
|
|
39
|
+
Show top 3 to user. Ask:
|
|
40
|
+
> "Which ones should I validate? Or brainstorm more?"
|
|
41
|
+
|
|
42
|
+
Wait for answer before continuing.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Step 3: Validate
|
|
47
|
+
|
|
48
|
+
Run `/spartan:validate` internally for each picked idea.
|
|
49
|
+
|
|
50
|
+
This will:
|
|
51
|
+
1. Problem check (real pain or nice-to-have?)
|
|
52
|
+
2. Quick market check
|
|
53
|
+
3. Quick competitor check
|
|
54
|
+
4. Distribution check
|
|
55
|
+
5. Build check
|
|
56
|
+
6. Give verdict: GO / TEST MORE / PASS
|
|
57
|
+
7. Save to `projects/{{ args[0] }}/03-validation/validation-{idea-name}.md`
|
|
58
|
+
|
|
59
|
+
### Gate 2
|
|
60
|
+
|
|
61
|
+
Show verdicts:
|
|
62
|
+
- If any **GO**: "Want me to run `/spartan:deep-dive` on this?"
|
|
63
|
+
- If all **PASS**: "These didn't make it. Want to `/spartan:brainstorm` a different space?"
|
|
64
|
+
- If **TEST MORE**: "Here's the cheapest test for each. Try those first."
|
|
65
|
+
|
|
66
|
+
---
|
|
47
67
|
|
|
48
68
|
## Rules
|
|
49
69
|
|
|
50
70
|
- Don't rush through gates. Pause and ask.
|
|
51
71
|
- It's fine if nothing passes. That saves months of building the wrong thing.
|
|
52
72
|
- If the user already has a specific idea (not a theme), skip brainstorm and go straight to validate.
|
|
73
|
+
- You are the orchestrator — run brainstorm and validate yourself, don't tell the user to chain commands.
|
package/commands/spartan.md
CHANGED
|
@@ -90,7 +90,7 @@ These are the 5 leaders. Each one runs a full pipeline. Route here first.
|
|
|
90
90
|
| User says something like... | Route to | What the leader does |
|
|
91
91
|
|---|---|---|
|
|
92
92
|
| "build feature X", "add Y", "implement Z", "new endpoint", "new page" | `/spartan:build` | Checks context → spec → design? → plan → implement → review → ship |
|
|
93
|
-
| "bug", "broken", "error", "not working", "fix this", "debug" | `/spartan:
|
|
93
|
+
| "bug", "broken", "error", "not working", "fix this", "debug" | `/spartan:debug` | Checks known issues → reproduce → investigate → fix → ship |
|
|
94
94
|
| "research X", "dig into", "find out about", "what's the market for" | `/spartan:research` | Frame question → gather sources → analyze → report |
|
|
95
95
|
| "startup idea", "new idea", "validate idea", "full pipeline" | `/spartan:startup` | Auto-resumes → brainstorm → validate → research → pitch |
|
|
96
96
|
| "new project", "just joined", "understand this codebase", "onboard" | `/spartan:onboard` | Checks memory → scan → map → setup → save findings |
|
|
@@ -202,7 +202,7 @@ Before running the routed command, give a 1-sentence reason:
|
|
|
202
202
|
|
|
203
203
|
Examples:
|
|
204
204
|
- "Building a feature → `/spartan:build` walks you through understand → plan → implement → ship."
|
|
205
|
-
- "Sounds like a bug → `/spartan:
|
|
205
|
+
- "Sounds like a bug → `/spartan:debug` does structured investigation before touching code."
|
|
206
206
|
- "New codebase → `/spartan:onboard` scans and maps everything before you start."
|
|
207
207
|
|
|
208
208
|
Then run the command. Don't ask "shall I proceed?" — just do it.
|
|
@@ -215,7 +215,7 @@ Not every command needs the same amount of context. Check the command/skill's `p
|
|
|
215
215
|
|------|---------------|---------|----------|
|
|
216
216
|
| **1** | Minimal — just run | Toggles, simple actions | `/spartan:careful`, `/spartan:freeze`, `/spartan:sessions` |
|
|
217
217
|
| **2** | Light — project context only | Quick tasks, status checks | `/spartan:daily`, `/spartan:contribute`, `/spartan:context-save` |
|
|
218
|
-
| **3** | Standard — project + stack context | Most commands | `/spartan:build`, `/spartan:
|
|
218
|
+
| **3** | Standard — project + stack context | Most commands | `/spartan:build`, `/spartan:debug`, `/spartan:review` |
|
|
219
219
|
| **4** | Full — everything, deep context | Complex workflows, multi-phase | `/spartan:project`, `/spartan:phase`, `/spartan:onboard` |
|
|
220
220
|
|
|
221
221
|
**How tiers affect behavior:**
|
|
@@ -246,7 +246,7 @@ You don't have to wait for the user to type `/spartan`. When you notice these pa
|
|
|
246
246
|
|---|---|
|
|
247
247
|
| User describes a product idea or feature concept | "This sounds like a good fit for `/spartan:think` before we code." |
|
|
248
248
|
| User just finished building/coding something | "Ready to test? `/spartan:qa` can check it in a real browser." |
|
|
249
|
-
| User says something is broken or not working | "Want me to run `/spartan:
|
|
249
|
+
| User says something is broken or not working | "Want me to run `/spartan:debug`? It does structured debugging." |
|
|
250
250
|
| User is about to merge or says "ready for PR" | "Run `/spartan:pr-ready` to do the full pre-PR checklist." |
|
|
251
251
|
| User asks about competitors or market | "I can dig deeper with `/spartan:research`." |
|
|
252
252
|
| User mentions deploying or going live | "Want to use `/spartan:deploy` for a proper deploy checklist?" |
|
|
@@ -322,7 +322,7 @@ Show the 5 workflow leaders first, then mention commands exist for specific task
|
|
|
322
322
|
**Build** — `/spartan:build [backend|frontend] [feature]`
|
|
323
323
|
The main orchestrator. Checks for existing specs/plans, runs spec → design → plan → implement → review → ship. For small work, does everything inline. For big work, saves artifacts and can resume across sessions.
|
|
324
324
|
|
|
325
|
-
**
|
|
325
|
+
**Debug** — `/spartan:debug [symptom]`
|
|
326
326
|
Checks memory for known issues, then runs reproduce → investigate → fix → ship. Saves recurring patterns for future sessions.
|
|
327
327
|
|
|
328
328
|
**Startup** — `/spartan:startup [idea]`
|
package/package.json
CHANGED
package/packs/core.yaml
CHANGED
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
"spec",
|
|
12
12
|
"plan",
|
|
13
13
|
"build",
|
|
14
|
-
"
|
|
14
|
+
"debug",
|
|
15
15
|
"onboard",
|
|
16
16
|
"daily",
|
|
17
17
|
"context-save",
|
|
18
18
|
"update",
|
|
19
|
-
"debug",
|
|
20
19
|
"pr-ready",
|
|
21
20
|
"init-project",
|
|
22
21
|
"careful",
|
|
@@ -299,7 +298,6 @@
|
|
|
299
298
|
"startup",
|
|
300
299
|
"kickoff",
|
|
301
300
|
"deep-dive",
|
|
302
|
-
"full-run",
|
|
303
301
|
"fundraise",
|
|
304
302
|
"research",
|
|
305
303
|
"pitch",
|
package/packs/research.yaml
CHANGED
|
@@ -107,7 +107,7 @@ projects/my-idea/
|
|
|
107
107
|
| `/kickoff [theme]` | 1 → 2 | Brainstorm + validate top ideas |
|
|
108
108
|
| `/deep-dive [project]` | 3 | Research + teardown competitors |
|
|
109
109
|
| `/fundraise [project]` | 4 | Pitch materials + outreach drafts |
|
|
110
|
-
| `/
|
|
110
|
+
| `/startup [theme]` | 1 → 2 → 3 → 4 | Everything, with pauses at each gate |
|
|
111
111
|
|
|
112
112
|
## Interaction Style
|
|
113
113
|
|
package/commands/spartan/fix.md
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: spartan:fix
|
|
3
|
-
description: "Find and fix a bug end-to-end — structured investigation, root cause, test-first fix, and PR"
|
|
4
|
-
argument-hint: "[describe the symptom or error]"
|
|
5
|
-
preamble-tier: 3
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Fix: {{ args[0] | default: "a bug" }}
|
|
9
|
-
|
|
10
|
-
You are the **Fix workflow leader** — structured debugging from symptom to merged PR.
|
|
11
|
-
|
|
12
|
-
You decide when to investigate deeper, when to check memory for known issues, and when to ship. Don't guess. Don't try random fixes. Follow the pipeline.
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
PIPELINE:
|
|
16
|
-
|
|
17
|
-
Check Context → Reproduce → Investigate → Fix → Ship
|
|
18
|
-
│ │ │ │ │
|
|
19
|
-
.memory/ Gate 1 Gate 2 Gate 3 Gate 4
|
|
20
|
-
known issues
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Step 0: Check Context (silent — no questions)
|
|
26
|
-
|
|
27
|
-
Before touching anything, check if this is a known issue.
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# Check memory for known blockers and gotchas
|
|
31
|
-
ls .memory/blockers/ .memory/knowledge/ 2>/dev/null
|
|
32
|
-
|
|
33
|
-
# Check for handoff from a previous debug session
|
|
34
|
-
ls .handoff/*.md 2>/dev/null
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
**If `.memory/blockers/` has files**, scan them for anything matching the symptom. If you find a match:
|
|
38
|
-
> "This might be a known issue. Found in `.memory/blockers/[file]`: [summary]. Let me verify if this is the same problem."
|
|
39
|
-
|
|
40
|
-
**If `.memory/knowledge/` has files**, scan for related gotchas or patterns that might explain the bug.
|
|
41
|
-
|
|
42
|
-
**If a handoff exists**, check if someone was already debugging this:
|
|
43
|
-
> "Found a previous debug session for this. Resuming from: [last stage]."
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Stage 1: Reproduce
|
|
48
|
-
|
|
49
|
-
**Goal:** Make the bug deterministic. Understand it fully before touching anything.
|
|
50
|
-
|
|
51
|
-
### Gather info
|
|
52
|
-
1. Get the exact error message, stack trace, or symptom
|
|
53
|
-
2. Ask if not clear:
|
|
54
|
-
- What inputs trigger it?
|
|
55
|
-
- What inputs do NOT trigger it?
|
|
56
|
-
- Consistent or flaky?
|
|
57
|
-
- Which environment? (local / CI / prod)
|
|
58
|
-
|
|
59
|
-
### Check recent changes
|
|
60
|
-
```bash
|
|
61
|
-
# What changed recently?
|
|
62
|
-
git log --oneline -15
|
|
63
|
-
git diff HEAD~5 --stat
|
|
64
|
-
|
|
65
|
-
# Are tests already failing?
|
|
66
|
-
./gradlew test --info 2>&1 | tail -40
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Find minimal reproduction
|
|
70
|
-
- Trace the code path from the symptom
|
|
71
|
-
- Identify the smallest input that triggers the bug
|
|
72
|
-
- Confirm you can make it happen on demand
|
|
73
|
-
|
|
74
|
-
**If you can't reproduce it:**
|
|
75
|
-
> Stop. Ask for more context — logs, steps, environment details. Don't move forward until you can see the bug happen.
|
|
76
|
-
|
|
77
|
-
**GATE 1 — STOP and ask:**
|
|
78
|
-
> "I can reproduce the bug. Here's what happens: [symptoms]. Here's how to trigger it: [steps]. Moving to investigation?"
|
|
79
|
-
>
|
|
80
|
-
> **Auto mode on?** → Show findings, continue immediately.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Stage 2: Investigate
|
|
85
|
-
|
|
86
|
-
**Goal:** Find the exact line, value, or decision that causes the failure.
|
|
87
|
-
|
|
88
|
-
### Binary isolation
|
|
89
|
-
Start from the failure point. Trace backwards:
|
|
90
|
-
|
|
91
|
-
1. At the crash/error point — what's the value?
|
|
92
|
-
2. One layer up — is the data correct here?
|
|
93
|
-
3. Keep going back until you find where correct data becomes wrong data
|
|
94
|
-
|
|
95
|
-
### Common patterns to check
|
|
96
|
-
|
|
97
|
-
**Kotlin/Micronaut:**
|
|
98
|
-
- `!!` operators (banned — null safety violation)
|
|
99
|
-
- Either handling — is `.left()` / `.right()` correct? Missing error branch?
|
|
100
|
-
- Coroutine scope — is a job cancelled before it finishes?
|
|
101
|
-
- `newSuspendedTransaction {}` — is it wrapping the right calls?
|
|
102
|
-
- Soft delete — is `deleted_at IS NULL` in the query?
|
|
103
|
-
|
|
104
|
-
**React/Next.js:**
|
|
105
|
-
- Missing dependency in `useEffect` array
|
|
106
|
-
- State update after unmount
|
|
107
|
-
- Server/client hydration mismatch
|
|
108
|
-
- Missing error boundary
|
|
109
|
-
- Wrong key prop in list rendering
|
|
110
|
-
|
|
111
|
-
**General:**
|
|
112
|
-
- Race condition — does order of execution matter?
|
|
113
|
-
- Stale cache — is old data being served?
|
|
114
|
-
- Config mismatch — different values between environments?
|
|
115
|
-
|
|
116
|
-
### Form a hypothesis
|
|
117
|
-
Write it down: "The root cause is [X] because [evidence]."
|
|
118
|
-
|
|
119
|
-
If your first hypothesis is wrong, try the next one. **Max 3 hypotheses** before stopping and asking for help. Don't go in circles.
|
|
120
|
-
|
|
121
|
-
**GATE 2 — STOP and ask:**
|
|
122
|
-
> "Root cause: [one sentence]. Evidence: [what proves it]. Here's my fix plan: [approach]. Sound right?"
|
|
123
|
-
>
|
|
124
|
-
> **Auto mode on?** → Show root cause, continue to fix.
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Stage 3: Fix
|
|
129
|
-
|
|
130
|
-
**Goal:** Fix correctly. Make sure it can't come back.
|
|
131
|
-
|
|
132
|
-
### Step 1: Write failing test
|
|
133
|
-
```
|
|
134
|
-
Write a test that captures the exact bug scenario.
|
|
135
|
-
This test MUST FAIL right now — if it passes, you haven't reproduced the bug in the test.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Run it. Confirm red.
|
|
139
|
-
|
|
140
|
-
### Step 2: Write the minimal fix
|
|
141
|
-
Change as little as possible. This is a fix, not a refactor. Don't clean up nearby code. Don't "improve" things while you're here.
|
|
142
|
-
|
|
143
|
-
Run the test. Confirm green.
|
|
144
|
-
|
|
145
|
-
### Step 3: Check for similar patterns
|
|
146
|
-
The same mistake might exist elsewhere:
|
|
147
|
-
```bash
|
|
148
|
-
# Find code with the same pattern as the bug
|
|
149
|
-
grep -rn "[pattern from the bug]" --include="*.kt" --include="*.tsx" src/
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
If you find similar issues, fix them too. Each gets its own test.
|
|
153
|
-
|
|
154
|
-
### Step 4: Run full test suite
|
|
155
|
-
```bash
|
|
156
|
-
# Make sure nothing else broke
|
|
157
|
-
./gradlew test
|
|
158
|
-
# or
|
|
159
|
-
npm test
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Commit
|
|
163
|
-
```
|
|
164
|
-
fix([scope]): [root cause description]
|
|
165
|
-
|
|
166
|
-
- Root cause: [one line]
|
|
167
|
-
- Add regression test: [test name]
|
|
168
|
-
- Checked [N] similar patterns
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**GATE 3 — STOP and ask:**
|
|
172
|
-
> "Fixed. [X] tests passing, including the new regression test. Found [N] similar patterns — [fixed/clean]. Ready for review?"
|
|
173
|
-
>
|
|
174
|
-
> **Auto mode on?** → Continue to Ship.
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Stage 4: Ship
|
|
179
|
-
|
|
180
|
-
### Self-review
|
|
181
|
-
Quick self-review:
|
|
182
|
-
- Fix addresses root cause, not just symptom?
|
|
183
|
-
- No leftover debug code (log statements, commented code)?
|
|
184
|
-
- Test covers the exact scenario that failed?
|
|
185
|
-
- Similar patterns in codebase checked?
|
|
186
|
-
|
|
187
|
-
### Create PR
|
|
188
|
-
Clear description matters more for bug fixes than features:
|
|
189
|
-
|
|
190
|
-
```markdown
|
|
191
|
-
## What was broken
|
|
192
|
-
[User-visible symptom]
|
|
193
|
-
|
|
194
|
-
## Root cause
|
|
195
|
-
[One paragraph — what went wrong and why]
|
|
196
|
-
|
|
197
|
-
## Fix
|
|
198
|
-
[What was changed and why it fixes the root cause]
|
|
199
|
-
|
|
200
|
-
## How to verify
|
|
201
|
-
[Steps to confirm the bug is gone]
|
|
202
|
-
|
|
203
|
-
## Regression test
|
|
204
|
-
[Name of the test that guards against this]
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Save to memory (if this bug reveals a pattern)
|
|
208
|
-
|
|
209
|
-
After the PR, check if this bug is worth remembering:
|
|
210
|
-
|
|
211
|
-
- **Recurring pattern?** (same type of bug seen before) → Save to `.memory/knowledge/`
|
|
212
|
-
- **Known blocker for other work?** → Save to `.memory/blockers/`
|
|
213
|
-
- **One-off typo or simple mistake?** → Don't save. Not worth remembering.
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
mkdir -p .memory/knowledge .memory/blockers
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Update `.memory/index.md` if you saved anything.
|
|
220
|
-
|
|
221
|
-
**GATE 4 — Done.**
|
|
222
|
-
> "PR created: [link]. Bug: [symptom]. Root cause: [one line]. Fix: [one line]."
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## Debug Report
|
|
227
|
-
|
|
228
|
-
After the PR is created, produce this summary:
|
|
229
|
-
|
|
230
|
-
```markdown
|
|
231
|
-
## Debug Report: [symptom]
|
|
232
|
-
|
|
233
|
-
**Root Cause:** [exact cause in one sentence]
|
|
234
|
-
|
|
235
|
-
**Why it happened:** [2-3 sentences — the chain of events]
|
|
236
|
-
|
|
237
|
-
**Fix:** [what changed and why]
|
|
238
|
-
|
|
239
|
-
**Test added:** [test name]
|
|
240
|
-
|
|
241
|
-
**Similar patterns checked:** [files checked / changes made]
|
|
242
|
-
|
|
243
|
-
**Prevention:** [what could stop this class of bug — lint rule, convention, type change, etc.]
|
|
244
|
-
|
|
245
|
-
**Saved to memory:** [yes/no — what was saved and why]
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Rules
|
|
251
|
-
|
|
252
|
-
- **You are the leader.** Check memory, investigate, fix, ship — all in one flow. Don't tell the user to run separate commands.
|
|
253
|
-
- **Follow the pipeline in order.** Don't skip to fixing. Understanding comes first.
|
|
254
|
-
- **Never guess.** Every hypothesis needs evidence. "I think it might be..." is not enough.
|
|
255
|
-
- **Write a failing test before writing the fix.** Always.
|
|
256
|
-
- **Minimal fix.** Change as little as possible. Don't refactor while fixing.
|
|
257
|
-
- **Check for siblings.** The same bug pattern might exist nearby. Always look.
|
|
258
|
-
- **Max 3 hypotheses in Stage 2.** If none pan out, stop and ask for help. Don't spiral.
|
|
259
|
-
- **Save patterns to memory.** If this bug type could happen again, save it so future sessions know.
|
|
260
|
-
- **Small bugs don't need this workflow.** If you can see the typo, just fix it. This is for bugs that aren't obvious.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: spartan:full-run
|
|
3
|
-
description: "Alias for /spartan:startup — use that instead"
|
|
4
|
-
argument-hint: "[theme or problem space]"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Full Run → Startup
|
|
8
|
-
|
|
9
|
-
**This command has moved to `/spartan:startup`.**
|
|
10
|
-
|
|
11
|
-
`/spartan:full-run` still works, but `/spartan:startup` is the new name.
|
|
12
|
-
|
|
13
|
-
Run `/spartan:startup {{ args[0] | default: "" }}` now.
|