@c0x12c/spartan-ai-toolkit 1.0.1 → 1.1.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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +50 -18
- package/VERSION +1 -1
- package/claude-md/11-backend-micronaut.md +20 -0
- package/claude-md/20-frontend-react.md +21 -0
- package/claude-md/60-research.md +1 -1
- package/commands/spartan/build.md +230 -0
- package/commands/spartan/debug.md +6 -148
- package/commands/spartan/fix.md +221 -0
- package/commands/spartan/full-run.md +5 -70
- package/commands/spartan/onboard.md +222 -0
- package/commands/spartan/research.md +218 -9
- package/commands/spartan/startup.md +171 -0
- package/commands/spartan.md +121 -129
- package/package.json +1 -1
- package/packs/core.yaml +3 -0
- package/packs/packs.compiled.json +4 -0
- package/packs/research.yaml +1 -0
- package/templates/design-doc.md +128 -0
- package/templates/epic.md +100 -0
- package/templates/feature-spec.md +181 -0
- package/templates/implementation-plan.md +159 -0
- package/templates/prd-template.md +2 -0
- package/templates/quality-gates.md +167 -0
- package/templates/workflow-backend-micronaut.md +409 -0
- package/templates/workflow-frontend-react.md +233 -0
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
10
10
|
"name": "spartan-ai-toolkit",
|
|
11
|
-
"description": "
|
|
12
|
-
"source": "./",
|
|
13
|
-
"version": "1.0
|
|
11
|
+
"description": "5 workflows, 48 commands, 11 rules, 18 skills, 4 agents — organized in 11 packs with dependencies",
|
|
12
|
+
"source": "./toolkit",
|
|
13
|
+
"version": "1.1.0"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spartan-ai-toolkit",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Engineering discipline layer for Claude Code —
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Engineering discipline layer for Claude Code — 5 workflows, 48 commands, 11 rules, 18 skills, 4 agents organized in 11 packs",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Khoa Tran",
|
|
7
7
|
"url": "https://github.com/spartan-stratos"
|
package/README.md
CHANGED
|
@@ -51,6 +51,36 @@ After install, open any project, run `claude`, then type `/spartan`.
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
+
## How to Use — Pick Your Style
|
|
55
|
+
|
|
56
|
+
**Workflows** — guided multi-stage processes. Best for features, bug fixes, research. Uses more tokens but catches what you'd miss.
|
|
57
|
+
|
|
58
|
+
| Workflow | Command | What it does |
|
|
59
|
+
|----------|---------|-------------|
|
|
60
|
+
| **Build** | `/spartan:build [backend\|frontend] [feature]` | Requirement → plan → TDD → review → PR |
|
|
61
|
+
| **Fix** | `/spartan:fix [symptom]` | Reproduce → investigate → test-first fix → PR |
|
|
62
|
+
| **Research** | `/spartan:research [topic]` | Frame → gather → analyze → report |
|
|
63
|
+
| **Startup** | `/spartan:startup [idea]` | Brainstorm → validate → research → pitch |
|
|
64
|
+
| **Onboard** | `/spartan:onboard` | Scan → map architecture → set up tooling |
|
|
65
|
+
|
|
66
|
+
**Direct commands** — one command, one job. Best when you know what step you need. Saves tokens.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
/spartan:quickplan "task" ← just the planning step
|
|
70
|
+
/spartan:review ← just the code review
|
|
71
|
+
/spartan:pr-ready ← just the PR creation
|
|
72
|
+
/spartan:migration "desc" ← just the migration
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Rules only** — zero overhead. Rules load automatically and enforce coding standards every session. No commands needed.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install packs → rules work silently in every session
|
|
79
|
+
npx @c0x12c/spartan-ai-toolkit@latest --packs=backend-micronaut
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
54
84
|
## Pick Your Packs
|
|
55
85
|
|
|
56
86
|
Packs group commands, rules, skills, and agents by use case. **Core is always installed.** Pick the rest based on what you're building.
|
|
@@ -105,7 +135,7 @@ npx @c0x12c/spartan-ai-toolkit@latest --all
|
|
|
105
135
|
|
|
106
136
|
| Pack | Category | Depends on | What you get |
|
|
107
137
|
|------|----------|------------|--------------|
|
|
108
|
-
| **core** | Core | — | Always installed.
|
|
138
|
+
| **core** | Core | — | Always installed. Workflows (build, fix, onboard), quickplan, pr-ready, daily, safety commands |
|
|
109
139
|
| **backend-micronaut** | Backend | database, shared-backend | Kotlin service scaffold, code review, testcontainers, API/DB/Kotlin rules, 5 skills, 2 agents |
|
|
110
140
|
| **backend-nodejs** | Backend | database, shared-backend | Coming soon |
|
|
111
141
|
| **backend-python** | Backend | database, shared-backend | Coming soon |
|
|
@@ -113,7 +143,7 @@ npx @c0x12c/spartan-ai-toolkit@latest --all
|
|
|
113
143
|
| **project-mgmt** | Planning | — | Project lifecycle, phases, workstreams, GSD upgrade, forensics, brownfield, codebase mapping |
|
|
114
144
|
| **product** | Planning | — | Think-before-build, validate, teardown, interview, lean canvas, brainstorm |
|
|
115
145
|
| **ops** | Ship | — | Deploy + env-setup |
|
|
116
|
-
| **research** | Research | product |
|
|
146
|
+
| **research** | Research | product | Startup + research workflows, kickoff to investor outreach, 10 skills, 2 agents |
|
|
117
147
|
|
|
118
148
|
Hidden packs (`database`, `shared-backend`) get pulled in as dependencies — you don't pick them directly.
|
|
119
149
|
|
|
@@ -125,12 +155,20 @@ All commands start with `/spartan:` (e.g., `/spartan:quickplan "task"`).
|
|
|
125
155
|
|
|
126
156
|
Type `/spartan` to get the smart router — it asks what you need and picks the right command.
|
|
127
157
|
|
|
158
|
+
### Workflows (core + research packs)
|
|
159
|
+
| Command | What it does |
|
|
160
|
+
|---------|-------------|
|
|
161
|
+
| `build [mode] [feature]` | Build a feature end-to-end (backend, frontend, or auto-detect) |
|
|
162
|
+
| `fix [symptom]` | Find and fix a bug with structured investigation |
|
|
163
|
+
| `research [topic]` | Deep research with source tracking and report |
|
|
164
|
+
| `startup [idea]` | Full startup pipeline: brainstorm to investor-ready |
|
|
165
|
+
| `onboard` | Understand a new codebase and set up tooling |
|
|
166
|
+
|
|
128
167
|
### Core (always installed)
|
|
129
168
|
| Command | What it does |
|
|
130
169
|
|---------|-------------|
|
|
131
170
|
| `quickplan "task"` | Task < 1 day — spec + plan + branch in one shot |
|
|
132
171
|
| `daily` | Standup summary from git history |
|
|
133
|
-
| `debug "symptom"` | 4-phase root cause investigation |
|
|
134
172
|
| `pr-ready` | Full checklist before creating any PR |
|
|
135
173
|
| `init-project` | Auto-generate CLAUDE.md from codebase scan |
|
|
136
174
|
| `context-save` | Save session state to resume later |
|
|
@@ -187,15 +225,15 @@ Type `/spartan` to get the smart router — it asks what you need and picks the
|
|
|
187
225
|
### Research (research pack)
|
|
188
226
|
| Command | What it does |
|
|
189
227
|
|---------|-------------|
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `fundraise` | Pitch materials + investor outreach |
|
|
194
|
-
| `research` | Deep research with source checking |
|
|
195
|
-
| `pitch` | Investor-facing materials |
|
|
196
|
-
| `outreach` | Draft investor emails |
|
|
197
|
-
| `content` | Turn ideas into platform-native content |
|
|
198
|
-
| `write` | Write blog posts and articles |
|
|
228
|
+
| `startup [idea]` | Full pipeline from brainstorm to outreach |
|
|
229
|
+
| `kickoff [theme]` | Start new idea — brainstorm + validate |
|
|
230
|
+
| `deep-dive [project]` | Market research + competitor teardowns |
|
|
231
|
+
| `fundraise [project]` | Pitch materials + investor outreach |
|
|
232
|
+
| `research [topic]` | Deep research with source checking |
|
|
233
|
+
| `pitch [type]` | Investor-facing materials |
|
|
234
|
+
| `outreach [investor]` | Draft investor emails |
|
|
235
|
+
| `content [source]` | Turn ideas into platform-native content |
|
|
236
|
+
| `write [topic]` | Write blog posts and articles |
|
|
199
237
|
|
|
200
238
|
---
|
|
201
239
|
|
|
@@ -292,9 +330,3 @@ Rules and skills are tuned for this stack, but the command framework works with
|
|
|
292
330
|
|
|
293
331
|
> **Different stack?** Fork the repo, edit the rules and skills, run the installer. Commands work with any language or framework.
|
|
294
332
|
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## Credits
|
|
298
|
-
- [Superpowers](https://github.com/obra/superpowers) — Jesse Vincent
|
|
299
|
-
- [GSD](https://github.com/gsd-build/get-shit-done) — TÂCHES
|
|
300
|
-
- Inspired by [OpenSpec](https://github.com/Fission-AI/OpenSpec) fast-forward concept
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0
|
|
1
|
+
1.1.0
|
|
@@ -14,6 +14,26 @@ Rules in `rules/backend-micronaut/` enforce coding standards:
|
|
|
14
14
|
|
|
15
15
|
> Full patterns: use /kotlin-best-practices or /backend-api-design skill
|
|
16
16
|
|
|
17
|
+
### Feature Development Workflow (Backend)
|
|
18
|
+
|
|
19
|
+
When building a backend feature, follow this pipeline:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Epic → Spec → Plan → Build → Review
|
|
23
|
+
↑ ↑ ↑ ↑
|
|
24
|
+
Gate 1 Gate 2 Gate 3 Gate 4
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Build phases:** Database → Business Logic → API Layer → Tests
|
|
28
|
+
|
|
29
|
+
See `templates/workflow-backend-micronaut.md` for the full workflow with:
|
|
30
|
+
- Stack-specific quality gates (Kotlin rules, Exposed ORM checks, API conventions)
|
|
31
|
+
- Concrete code patterns (Controller, Manager, Repository, Factory, DTO, Test)
|
|
32
|
+
- Real file locations per module
|
|
33
|
+
- Parallel vs sequential task planning
|
|
34
|
+
|
|
35
|
+
For small tasks (< 1 day), `/spartan:quickplan` covers spec + plan in one shot.
|
|
36
|
+
|
|
17
37
|
### Backend Skills
|
|
18
38
|
|
|
19
39
|
- `/api-endpoint-creator` — Generate full Controller → Manager → Repository stack
|
|
@@ -8,6 +8,27 @@
|
|
|
8
8
|
Rules in `rules/frontend-react/`:
|
|
9
9
|
- `FRONTEND.md` — Build check before commit, API case conversion, null safety, optimistic updates
|
|
10
10
|
|
|
11
|
+
### Feature Development Workflow (Frontend)
|
|
12
|
+
|
|
13
|
+
When building a frontend feature, follow this pipeline:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Epic → Spec → Design → Plan → Build → Review
|
|
17
|
+
↑ ↑ ↑ ↑
|
|
18
|
+
Gate 1 Gate 2 Gate 3 Gate 4
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Build phases:** Types & API → Components → Pages/Routes → Tests
|
|
22
|
+
|
|
23
|
+
Design is NOT optional for frontend — always create a design doc for new screens.
|
|
24
|
+
|
|
25
|
+
See `templates/workflow-frontend-react.md` for the full workflow with:
|
|
26
|
+
- Stack-specific quality gates (TypeScript, React patterns, accessibility, responsive)
|
|
27
|
+
- File location guide (App Router conventions)
|
|
28
|
+
- Parallel vs sequential task planning
|
|
29
|
+
|
|
30
|
+
For small tasks (< 1 day), `/spartan:quickplan` covers spec + plan in one shot.
|
|
31
|
+
|
|
11
32
|
### Frontend Skills
|
|
12
33
|
|
|
13
34
|
- `/ui-ux-pro-max` — Design system with 67 styles, 96 palettes, 13 stacks
|
package/claude-md/60-research.md
CHANGED
|
@@ -64,7 +64,7 @@ These skills are used by the commands above. You can also use them directly.
|
|
|
64
64
|
|
|
65
65
|
Reference materials available in the toolkit:
|
|
66
66
|
- **12 frameworks**: Lean Canvas, Design Sprint, Business Model Canvas, JTBD, Mom Test, Value Proposition Canvas, and more
|
|
67
|
-
- **
|
|
67
|
+
- **13 templates**: Idea canvas, competitor analysis, user interview, validation checklist, PRD, project readme, epic, feature spec, implementation plan, quality gates, design doc, workflow-backend-micronaut, workflow-frontend-react
|
|
68
68
|
|
|
69
69
|
### Rules
|
|
70
70
|
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:build
|
|
3
|
+
description: "Build a new feature end-to-end — backend, frontend, or full-stack with auto-detection"
|
|
4
|
+
argument-hint: "[backend|frontend] [feature description]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Build: {{ args[0] | default: "a new feature" }}
|
|
8
|
+
|
|
9
|
+
You are running the **Build workflow** — the main way to go from requirement to merged PR.
|
|
10
|
+
|
|
11
|
+
This workflow has 4 stages with gates between each. Don't skip ahead.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
STAGE 1: UNDERSTAND STAGE 2: PLAN STAGE 3: IMPLEMENT STAGE 4: SHIP
|
|
15
|
+
─────────────────── ────────────── ────────────────── ──────────────
|
|
16
|
+
3 forcing questions Size check: Task by task, TDD Self-review
|
|
17
|
+
Scope: in / out Small → inline plan Right skills per stack Fix issues found
|
|
18
|
+
Stack detection Big → full /phase Tests after each task Create PR
|
|
19
|
+
|
|
20
|
+
Gate 1 Gate 2 Gate 3 Gate 4
|
|
21
|
+
"Scope right?" "Plan good?" "Tests pass?" "PR created"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Step 0: Detect Mode & Stack (silent — no questions)
|
|
27
|
+
|
|
28
|
+
Parse the user's input to find the mode:
|
|
29
|
+
- First arg is `backend` or `be` → **backend mode**
|
|
30
|
+
- First arg is `frontend` or `fe` → **frontend mode**
|
|
31
|
+
- No mode given → **auto-detect**
|
|
32
|
+
|
|
33
|
+
**Auto-detect logic** (check the project files):
|
|
34
|
+
```bash
|
|
35
|
+
ls build.gradle.kts settings.gradle.kts 2>/dev/null && echo "STACK:kotlin-micronaut"
|
|
36
|
+
ls package.json 2>/dev/null && cat package.json 2>/dev/null | grep -q '"next"' && echo "STACK:nextjs-react"
|
|
37
|
+
ls .planning/PROJECT.md 2>/dev/null && echo "GSD_ACTIVE"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Detected | Mode |
|
|
41
|
+
|----------|------|
|
|
42
|
+
| Kotlin only | Backend |
|
|
43
|
+
| Next.js only | Frontend |
|
|
44
|
+
| Both | Ask: "This is a full-stack project. Is this feature backend, frontend, or both?" |
|
|
45
|
+
| Neither | Ask the user what stack they're using |
|
|
46
|
+
|
|
47
|
+
**Check for installed skills:**
|
|
48
|
+
- If backend mode but no `kotlin-best-practices` skill found → warn: "You don't have the backend pack installed. Run `/spartan:update` and add it, or continue without stack-specific guidance."
|
|
49
|
+
- If frontend mode but no `ui-ux-pro-max` skill found → same warning for frontend pack.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Stage 1: Understand
|
|
54
|
+
|
|
55
|
+
**Ask 3 forcing questions. Always. Even in auto mode.**
|
|
56
|
+
|
|
57
|
+
1. **"What pain does this solve?"** — Not the feature. The pain. If the user says "add a profiles endpoint" ask what user problem it fixes.
|
|
58
|
+
2. **"What's the narrowest version we can ship?"** — Force MVP thinking. Cut scope until it hurts.
|
|
59
|
+
3. **"What assumption could be wrong?"** — Surface hidden risks early.
|
|
60
|
+
|
|
61
|
+
After the user answers, produce a scope block:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
## Scope: [feature name]
|
|
65
|
+
|
|
66
|
+
**Pain:** [one sentence]
|
|
67
|
+
**Stack:** [backend / frontend / full-stack] — [Kotlin+Micronaut / Next.js+React / both]
|
|
68
|
+
|
|
69
|
+
**IN:**
|
|
70
|
+
- [what will be built]
|
|
71
|
+
- [what will be built]
|
|
72
|
+
|
|
73
|
+
**OUT:**
|
|
74
|
+
- [what is NOT in scope]
|
|
75
|
+
- [what is NOT in scope]
|
|
76
|
+
|
|
77
|
+
**Risk:** [the assumption that could be wrong]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**GATE 1 — STOP and ask:**
|
|
81
|
+
> "Here's the scope. Anything to change before I plan?"
|
|
82
|
+
>
|
|
83
|
+
> **Auto mode on?** → Show scope, continue immediately without waiting.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Stage 2: Plan
|
|
88
|
+
|
|
89
|
+
### Size check
|
|
90
|
+
|
|
91
|
+
Count the expected work:
|
|
92
|
+
- **Small** (1-4 tasks, < 1 day): Inline plan right here. Like a mini-quickplan.
|
|
93
|
+
- **Big** (5+ tasks, multi-day): Use `/spartan:phase plan` for a full wave-parallel plan.
|
|
94
|
+
|
|
95
|
+
### Inline plan format (small features)
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## Plan: [feature name]
|
|
99
|
+
Branch: `feature/[slug]`
|
|
100
|
+
|
|
101
|
+
### Task 1: [name]
|
|
102
|
+
Files: [exact paths]
|
|
103
|
+
Test first: [what test to write]
|
|
104
|
+
Implementation: [what to change]
|
|
105
|
+
Verify: [how to confirm]
|
|
106
|
+
|
|
107
|
+
### Task 2: [name]
|
|
108
|
+
...
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Max 4 tasks for inline plan.** If you need more, it's a big feature — use `/spartan:phase`.
|
|
112
|
+
|
|
113
|
+
### What the plan includes (by mode)
|
|
114
|
+
|
|
115
|
+
**Backend mode** — tasks follow this order:
|
|
116
|
+
1. Migration (if new/changed table)
|
|
117
|
+
2. Entity + Table object + Repository + repo tests
|
|
118
|
+
3. Service/Manager + service tests
|
|
119
|
+
4. Controller + integration tests
|
|
120
|
+
|
|
121
|
+
Uses skills: `database-patterns`, `api-endpoint-creator`, `kotlin-best-practices`, `testing-strategies`, `security-checklist`
|
|
122
|
+
|
|
123
|
+
**Frontend mode** — tasks follow this order:
|
|
124
|
+
1. Types / interfaces
|
|
125
|
+
2. API client (if new endpoints needed — flag that backend work may be needed first)
|
|
126
|
+
3. Components (bottom-up: small → composed → page-level)
|
|
127
|
+
4. Page + routing + tests
|
|
128
|
+
|
|
129
|
+
Uses skills: `ui-ux-pro-max`, frontend rules
|
|
130
|
+
|
|
131
|
+
**Full-stack mode** — backend tasks first, then frontend tasks. Mark the integration point clearly (where frontend starts depending on backend API).
|
|
132
|
+
|
|
133
|
+
### Create branch
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
git checkout -b feature/[slug]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Write the first failing test for Task 1. Show it fails.
|
|
140
|
+
|
|
141
|
+
**GATE 2 — STOP and ask:**
|
|
142
|
+
> "Plan has [N] tasks. Does this make sense?"
|
|
143
|
+
>
|
|
144
|
+
> **Auto mode on?** → Show plan, start executing immediately.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Stage 3: Implement
|
|
149
|
+
|
|
150
|
+
Execute each task in order:
|
|
151
|
+
|
|
152
|
+
### For each task:
|
|
153
|
+
1. **Write test** → run it → confirm it fails (red)
|
|
154
|
+
2. **Write code** → run test → confirm it passes (green)
|
|
155
|
+
3. **Refactor** if needed (tests still green)
|
|
156
|
+
4. **Commit** with an atomic message:
|
|
157
|
+
```
|
|
158
|
+
feat([scope]): [what this task does]
|
|
159
|
+
```
|
|
160
|
+
5. Brief status: "Task [N]/[total] done. Moving to next."
|
|
161
|
+
|
|
162
|
+
### TDD override
|
|
163
|
+
If a task is hard to test-first (UI components, config changes), say so and switch to implement-then-test. But always have a test when the task is done.
|
|
164
|
+
|
|
165
|
+
### Skill routing during implementation
|
|
166
|
+
|
|
167
|
+
Call the right skills based on what you're doing:
|
|
168
|
+
|
|
169
|
+
| Working on... | Use skill |
|
|
170
|
+
|---------------|-----------|
|
|
171
|
+
| Database migration | `database-patterns` |
|
|
172
|
+
| New endpoint | `api-endpoint-creator` |
|
|
173
|
+
| Kotlin code | `kotlin-best-practices` |
|
|
174
|
+
| Writing tests | `testing-strategies` |
|
|
175
|
+
| React components | `ui-ux-pro-max` |
|
|
176
|
+
| Security-sensitive code | `security-checklist` |
|
|
177
|
+
|
|
178
|
+
### After all tasks
|
|
179
|
+
|
|
180
|
+
Run the full test suite:
|
|
181
|
+
```bash
|
|
182
|
+
# Backend
|
|
183
|
+
./gradlew test
|
|
184
|
+
|
|
185
|
+
# Frontend
|
|
186
|
+
npm test
|
|
187
|
+
|
|
188
|
+
# Both
|
|
189
|
+
./gradlew test && npm test
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**GATE 3 — STOP and ask:**
|
|
193
|
+
> "All [N] tasks done. [X] tests passing. Ready for review?"
|
|
194
|
+
>
|
|
195
|
+
> **Auto mode on?** → Continue to Ship immediately.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Stage 4: Ship
|
|
200
|
+
|
|
201
|
+
### Self-review
|
|
202
|
+
- **Backend code** → use the approach from `/spartan:review`
|
|
203
|
+
- **Frontend code** → use the approach from `/spartan:fe-review`
|
|
204
|
+
- **Both** → review backend first, then frontend
|
|
205
|
+
|
|
206
|
+
Fix any issues found during review. Commit fixes separately:
|
|
207
|
+
```
|
|
208
|
+
fix([scope]): [what review caught]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Create PR
|
|
212
|
+
Run the approach from `/spartan:pr-ready`:
|
|
213
|
+
- Rebase onto main
|
|
214
|
+
- Run all checks one final time
|
|
215
|
+
- Create PR with clear title, summary, and test plan
|
|
216
|
+
|
|
217
|
+
**GATE 4 — Done.**
|
|
218
|
+
> "PR created: [link]. Here's what's in it: [summary]."
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Rules
|
|
223
|
+
|
|
224
|
+
- **Always start at Stage 1.** Don't skip the 3 questions. They prevent building the wrong thing.
|
|
225
|
+
- **Gates are mandatory.** Even small features go through all 4 stages. The stages are fast for small work — that's fine.
|
|
226
|
+
- **TDD by default.** Write the test first. Override only when test-first doesn't make sense for that specific task.
|
|
227
|
+
- **One commit per task.** Don't batch. Each task = one commit with a clear message.
|
|
228
|
+
- **Security check always runs.** Whether backend or frontend, security patterns get checked at the end of Stage 3.
|
|
229
|
+
- **Frontend checks for backend needs.** If a new page needs data that doesn't exist yet, say so at Stage 2 and add backend tasks first.
|
|
230
|
+
- **Don't over-plan.** If the whole thing is 1-2 files and 30 minutes of work, don't force it into this workflow. Just do it. This workflow is for features that need structure — at least 2-3 tasks.
|
|
@@ -1,156 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spartan:debug
|
|
3
|
-
description:
|
|
3
|
+
description: "Alias for /spartan:fix — use that instead"
|
|
4
4
|
argument-hint: "[describe the symptom / error]"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Debug
|
|
7
|
+
# Debug → Fix
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
Do NOT guess. Do NOT try random fixes. Follow the 4 phases in order.
|
|
9
|
+
**This command has moved to `/spartan:fix`.**
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Phase 1: Reproduce & Characterize (understand before touching anything)
|
|
15
|
-
|
|
16
|
-
**Goal:** Make the failure deterministic and fully described.
|
|
17
|
-
|
|
18
|
-
1. Get the exact error message, stack trace, or symptom
|
|
19
|
-
2. Find the minimal reproduction case:
|
|
20
|
-
- What inputs trigger it?
|
|
21
|
-
- What inputs do NOT trigger it?
|
|
22
|
-
- Is it consistent or flaky?
|
|
23
|
-
- Environment-specific? (local / CI / prod)
|
|
24
|
-
|
|
25
|
-
3. Gather context:
|
|
26
|
-
```bash
|
|
27
|
-
# Recent changes that could have introduced this
|
|
28
|
-
git log --oneline -10
|
|
29
|
-
git diff HEAD~5 --stat
|
|
30
|
-
|
|
31
|
-
# Are tests failing?
|
|
32
|
-
./gradlew test --info 2>&1 | tail -40
|
|
33
|
-
|
|
34
|
-
# Logs around the failure time
|
|
35
|
-
# (ask user for relevant log snippets if not in repo)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Document findings. Do NOT proceed until the bug is reproducible.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Phase 2: Isolate the Root Cause (narrow the search space)
|
|
43
|
-
|
|
44
|
-
**Goal:** Find the exact line / decision / data that causes the failure.
|
|
45
|
-
|
|
46
|
-
Use binary isolation:
|
|
47
|
-
1. Start from the failure point, trace backwards through the call stack
|
|
48
|
-
2. At each layer, ask: "Is the data correct at this point?"
|
|
49
|
-
3. Keep narrowing until you find where correct data becomes incorrect data
|
|
50
|
-
|
|
51
|
-
For common Kotlin/Micronaut patterns, check:
|
|
52
|
-
- **Null safety violations**: Any `!!` operators? (BANNED — see CORE_RULES)
|
|
53
|
-
- **Either handling**: Is `.left()` / `.right()` used correctly? Missing error cases?
|
|
54
|
-
- **Coroutine scope leaks**: Is a coroutine cancelled before work completes?
|
|
55
|
-
- **Exposed transaction scope**: Is `newSuspendedTransaction {}` wrapping DB calls correctly?
|
|
56
|
-
- **Soft delete filtering**: Is `deleted_at IS NULL` included in queries? (DATABASE_RULES)
|
|
57
|
-
- **Testcontainers state**: Is a previous test leaving dirty data?
|
|
58
|
-
|
|
59
|
-
```kotlin
|
|
60
|
-
// Add strategic logging to narrow the search
|
|
61
|
-
log.debug("State at boundary: entity={}, dto={}", entity, dto)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Document: "The root cause is [X] because [evidence]."
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Phase 3: Fix with Test First (TDD the fix)
|
|
69
|
-
|
|
70
|
-
**Goal:** Fix correctly and ensure it cannot regress.
|
|
71
|
-
|
|
72
|
-
1. **Write a failing test that captures the bug FIRST:**
|
|
73
|
-
```kotlin
|
|
74
|
-
@Test
|
|
75
|
-
fun `given [condition that triggers bug], when [action], then [correct behavior]`() {
|
|
76
|
-
// Reproduce the exact scenario that fails
|
|
77
|
-
// This test must FAIL right now
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
2. **Confirm test is red** — if it passes, you haven't reproduced the bug in the test
|
|
82
|
-
|
|
83
|
-
3. **Write the minimal fix** — change as little as possible
|
|
84
|
-
|
|
85
|
-
4. **Confirm test is green**
|
|
86
|
-
|
|
87
|
-
5. **Check for similar patterns** in the codebase:
|
|
88
|
-
```bash
|
|
89
|
-
# Find similar code that might have the same bug
|
|
90
|
-
grep -r "[pattern from the bug]" --include="*.kt" src/
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Phase 4: Verify & Harden
|
|
96
|
-
|
|
97
|
-
**Goal:** Confirm fix is complete and add protection layers.
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# Full test suite must pass
|
|
101
|
-
./gradlew test
|
|
102
|
-
|
|
103
|
-
# Integration tests specifically
|
|
104
|
-
./gradlew integrationTest 2>/dev/null || ./gradlew test -Dmicronaut.environments=test
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Check:
|
|
108
|
-
- [ ] Fix addresses root cause, not symptom
|
|
109
|
-
- [ ] No regression in existing tests
|
|
110
|
-
- [ ] Edge cases covered in new test
|
|
111
|
-
- [ ] Similar patterns in codebase checked and fixed if needed
|
|
112
|
-
- [ ] Logging/observability added if this was hard to debug
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Output: Debug Report
|
|
117
|
-
|
|
118
|
-
After completing all phases, produce a brief report:
|
|
119
|
-
|
|
120
|
-
```markdown
|
|
121
|
-
## Debug Report: [symptom]
|
|
122
|
-
|
|
123
|
-
**Root Cause:** [exact cause in one sentence]
|
|
124
|
-
|
|
125
|
-
**Why it happened:**
|
|
126
|
-
[2-3 sentences explaining the chain of events]
|
|
127
|
-
|
|
128
|
-
**Fix:**
|
|
129
|
-
[what was changed and why it fixes the root cause]
|
|
130
|
-
|
|
131
|
-
**Test added:**
|
|
132
|
-
[name of the regression test]
|
|
133
|
-
|
|
134
|
-
**Similar patterns checked:**
|
|
135
|
-
[files checked / changes made]
|
|
136
|
-
|
|
137
|
-
**Prevention:**
|
|
138
|
-
[what could prevent this class of bug in future — linting rule, convention, etc.]
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Commit with:
|
|
142
|
-
```
|
|
143
|
-
fix([scope]): [root cause description]
|
|
144
|
-
|
|
145
|
-
- Root cause: [one line]
|
|
146
|
-
- Add regression test: [test name]
|
|
147
|
-
- Checked [N] similar patterns
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Rules
|
|
11
|
+
`/spartan:debug` still works, but `/spartan:fix` is the new name.
|
|
12
|
+
It covers the full cycle: reproduce → investigate → fix → ship to PR.
|
|
151
13
|
|
|
152
|
-
|
|
153
|
-
- Never guess — every hypothesis must have evidence
|
|
154
|
-
- Write a failing test before writing the fix
|
|
155
|
-
- Change as little as possible — minimal fix, not refactor
|
|
156
|
-
- Check for similar patterns in the codebase after fixing
|
|
14
|
+
Run `/spartan:fix {{ args[0] | default: "" }}` now.
|