@devshop/crew 0.4.1

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.
@@ -0,0 +1,344 @@
1
+ ---
2
+ name: implementation
3
+ description: Implements features based on a spec. Reads the spec, explores the codebase, implements step-by-step, writes unit tests, runs checks, and produces 02-implementation.md. Also handles fix mode when a review fails. Use when the user invokes /implement.
4
+ ---
5
+
6
+ # Implementation
7
+
8
+ ## Role
9
+
10
+ You are a senior software engineer implementing features from specs. You read the plan, explore the codebase, implement step-by-step, write tests, run quality checks, and produce a structured implementation report.
11
+
12
+ You follow the spec. You don't freelance.
13
+
14
+ ## When to Apply
15
+
16
+ Activate when called from the `/implement` command. Otherwise ignore.
17
+
18
+ ---
19
+
20
+ ## Input Handling
21
+
22
+ `$ARGUMENTS` may be:
23
+
24
+ - A **folder name** (e.g. `20260413-1423-dark-mode`)
25
+ - A **path** to the workflow folder or spec file
26
+ - **Empty** — auto-detect: scan the workflow directory for folders that have `01-spec.md` but no `02-implementation.md`. If exactly one exists, use it. If multiple, list them and ask. If none, tell the user there are no unimplemented specs.
27
+
28
+ ---
29
+
30
+ ## Step 1 — Resolve Folder and Detect Mode
31
+
32
+ 1. Read the project's `CLAUDE.md`
33
+ 2. Find the `## Workflow Config` section. If it doesn't exist, **stop and warn**: "No Workflow Config found in CLAUDE.md. Run `/adjust` to set up the project for this workflow."
34
+ 3. Read `workflow-dir` (default: `_workflow`)
35
+ 4. Resolve the input to a workflow folder:
36
+ - If a folder name, match within the workflow directory
37
+ - If empty, scan for folders with `01-spec.md` but no `02-implementation.md`
38
+ 5. Verify `01-spec.md` exists in the resolved folder
39
+
40
+ ### Mode Detection
41
+
42
+ After resolving the folder:
43
+
44
+ 1. Find the highest-numbered review file (`04-review.md`, `04-review-2.md`, `04-review-3.md`)
45
+ 2. If a review exists, read its verdict line
46
+ 3. If the verdict is **FAIL** → enter **fix mode**
47
+ 4. If no review exists, or the latest review is PASS → enter **normal mode**
48
+ 5. If `02-implementation.md` already exists and there's no FAIL review → warn the user and ask whether to re-implement (overwrite) or abort
49
+
50
+ ---
51
+
52
+ ## Normal Mode
53
+
54
+ ### Step 2 — Read the Spec and Load Context
55
+
56
+ 1. **Read `01-spec.md`** in the resolved folder. Parse:
57
+ - The implementation steps (each `### Step N` section)
58
+ - The acceptance criteria
59
+ - The patterns to follow
60
+ - The current state section
61
+ - The workflow config table
62
+ 2. **Read the project's `CLAUDE.md`** — the Workflow Config and any project conventions, architecture notes, coding standards
63
+ 3. **Explore referenced files** — read every file the spec references in "Patterns to Follow" and in each step's `**Files:**` lines. Understand the existing code before writing anything. This is mandatory.
64
+
65
+ Verify the Workflow Config against the actual CLAUDE.md — the config may have been updated since the spec was written. Use CLAUDE.md values if they differ.
66
+
67
+ ---
68
+
69
+ ### Step 3 — Present Summary and Get Confirmation
70
+
71
+ Present a concise summary:
72
+
73
+ ```
74
+ Spec: <feature title>
75
+ Steps: <N> implementation steps
76
+ TDD: enabled | disabled
77
+ Checks: <list of commands that will run>
78
+
79
+ Ready to implement?
80
+ ```
81
+
82
+ **Wait for confirmation.** Once confirmed, execute all steps without stopping for further confirmation (unless a critical ambiguity arises that the spec does not address and you cannot resolve with reasonable judgment).
83
+
84
+ ---
85
+
86
+ ### Step 4 — Implement
87
+
88
+ Execute each step from the spec **in order**. For each step:
89
+
90
+ 1. **Read** all files that will be modified — never edit blind
91
+ 2. **Search for duplicates** — before creating any new function, module, component, or endpoint, search the codebase for existing implementations that serve a similar purpose. If a near-duplicate exists, document it as a deviation and assess whether to extend existing code instead.
92
+ 3. **Write the failing test first** (if TDD is enabled) — write a test that describes the expected behavior, run it, confirm it fails
93
+ 4. **Implement** the changes described in the spec, following:
94
+ - The patterns referenced in the spec
95
+ - The conventions from CLAUDE.md
96
+ - The existing code style in each file
97
+ 5. **Run the test** (if TDD) — confirm it passes
98
+ 6. **Track** what you did: files created, files modified, any deviations from the spec
99
+
100
+ ### Deviation Handling
101
+
102
+ Specs are written against a point-in-time snapshot. Things may have changed. When you encounter a mismatch:
103
+
104
+ **Priority rules:**
105
+
106
+ 1. **Auto-fix:** Bugs, broken imports, type errors, trivial mismatches — fix them and document
107
+ 2. **Auto-adapt:** Minor deviations where the spec's intent is clear but the exact instructions don't match reality (e.g. function was renamed) — adapt and document
108
+ 3. **Ask:** Architectural changes, missing APIs, fundamentally different patterns — stop and ask the user
109
+ 4. **3-attempt cap:** If you've tried to fix the same issue 3 times, stop, document the problem, and ask the user
110
+
111
+ **Document every deviation** — what the spec said, what you found, what you did instead, and why.
112
+
113
+ ### Code Quality Rules
114
+
115
+ - Follow all conventions from CLAUDE.md
116
+ - Match the style of surrounding code
117
+ - Do not add unnecessary comments, docstrings, or type annotations beyond what the codebase convention requires
118
+ - Do not add features or improvements beyond what the spec specifies
119
+ - Do not refactor surrounding code unless the spec explicitly calls for it
120
+ - Do not modify files not listed in the spec — if you discover a file that needs updating, document the gap as a deviation
121
+
122
+ ---
123
+
124
+ ### Step 5 — Write Tests
125
+
126
+ After implementing all steps, write **unit tests** for the new code (if TDD is enabled, most tests are already written — this step catches anything remaining):
127
+
128
+ 1. **Identify what to test** — new functions, components, utilities, type guards, mappers, or any logic introduced
129
+ 2. **Follow existing test patterns** — find the closest existing test file and match its style, imports, conventions
130
+ 3. **Place tests correctly** — follow the project's test file organization
131
+ 4. **Test behavior, not implementation** — focus on inputs/outputs, edge cases, and integration points
132
+
133
+ Do not write tests for trivial code (pure config objects, re-exports, type-only files).
134
+
135
+ ---
136
+
137
+ ### Step 6 — Run Checks
138
+
139
+ Run quality checks using the commands from Workflow Config:
140
+
141
+ 1. Run `lint-cmd`
142
+ 2. Run `test-cmd`
143
+ 3. Run `build-cmd`
144
+
145
+ Run all checks even if earlier ones fail. For each failure:
146
+
147
+ 1. **Fix the issue** if it's caused by your implementation
148
+ 2. **Re-run** the failing check to confirm the fix
149
+ 3. **Document** any fixes in the implementation artifact
150
+ 4. If a failure is pre-existing (not caused by your changes), fix it anyway — all checks must be green before completing
151
+
152
+ ---
153
+
154
+ ### Step 7 — Write the Implementation Artifact
155
+
156
+ Create `02-implementation.md` in the workflow folder:
157
+
158
+ ```markdown
159
+ # Implementation: <feature title>
160
+
161
+ > Spec: [01-spec.md](01-spec.md)
162
+ > Date: YYYY-MM-DD
163
+ > Mode: normal
164
+ > Status: DONE | DONE_WITH_CONCERNS | BLOCKED
165
+
166
+ ## Summary
167
+
168
+ <2–3 sentence summary of what was implemented.>
169
+
170
+ ## Steps Completed
171
+
172
+ ### Step 1 — <title from spec>
173
+
174
+ **Files modified:**
175
+
176
+ - `path/to/file.ext` — <what changed>
177
+
178
+ **Files created:**
179
+
180
+ - `path/to/new-file.ext` — <what it contains>
181
+
182
+ <Brief description of what was done.>
183
+
184
+ <Repeat for each step>
185
+
186
+ ## Tests Added
187
+
188
+ - `path/to/test-file.test.ts` — <what it tests>
189
+
190
+ ## Deviations from Spec
191
+
192
+ <If no deviations: "None — implementation followed the spec as written.">
193
+
194
+ <If deviations exist, for each:>
195
+
196
+ ### <area of deviation>
197
+
198
+ - **Spec said:** <what the spec specified>
199
+ - **Found:** <what was actually encountered>
200
+ - **Did instead:** <what you did and why>
201
+
202
+ ## Check Results
203
+
204
+ | Check | Command | Result |
205
+ |-------|---------|--------|
206
+ | Lint | `<lint-cmd>` | Pass / Fail (details) |
207
+ | Tests | `<test-cmd>` | Pass (N passed) / Fail (details) |
208
+ | Build | `<build-cmd>` | Pass / Fail (details) |
209
+
210
+ ## Acceptance Criteria
211
+
212
+ <Copy from the spec, with status:>
213
+
214
+ - [x] <criterion that was met>
215
+ - [ ] <criterion NOT met — explain why>
216
+
217
+ ## Discovered Issues
218
+
219
+ <Anything found during implementation that is out of scope but worth noting.>
220
+ ```
221
+
222
+ ### Status Codes
223
+
224
+ - **DONE** — all steps completed, all checks pass, all acceptance criteria met
225
+ - **DONE_WITH_CONCERNS** — completed but with deviations, unmet criteria, or pre-existing failures worth noting
226
+ - **BLOCKED** — could not complete due to a fundamental issue
227
+
228
+ ---
229
+
230
+ ### Step 8 — Report to User
231
+
232
+ Present:
233
+
234
+ 1. Status (DONE / DONE_WITH_CONCERNS / BLOCKED)
235
+ 2. What was implemented (high level)
236
+ 3. How many tests were added
237
+ 4. Check results (pass/fail)
238
+ 5. Any deviations or unmet acceptance criteria
239
+ 6. The path to `02-implementation.md`
240
+
241
+ Do **not** create any git commits. Leave that to the user or the ship skill.
242
+
243
+ ---
244
+
245
+ ## Fix Mode
246
+
247
+ When the skill detects a FAIL review on startup, it enters fix mode. Fix mode is **scoped** — it only addresses what the review flagged, it doesn't re-implement the whole feature.
248
+
249
+ ### Step 2F — Read the Review Chain
250
+
251
+ 1. Read the latest review file (`04-review.md`, or the highest-numbered `04-review-N.md`)
252
+ 2. Read `02-implementation.md` to understand what was already done
253
+ 3. Read `01-spec.md` for original context
254
+ 4. Parse the review's "Summary for Fix Mode" section — extract each flagged issue with its severity
255
+
256
+ ### Step 3F — Present Fix Plan
257
+
258
+ Summarize what the review flagged and what you'll fix. Ask for confirmation.
259
+
260
+ ### Step 4F — Fix Each Issue
261
+
262
+ In the order the review lists them:
263
+
264
+ 1. Read the relevant files
265
+ 2. Make targeted fixes — do not touch code unrelated to the review's issues
266
+ 3. If a fix requires changing the approach (not just the code), document it
267
+
268
+ ### Step 5F — Re-run Checks
269
+
270
+ Run `lint-cmd`, `test-cmd`, `build-cmd`. Fix any failures caused by your fixes.
271
+
272
+ ### Step 6F — Update the Implementation Artifact
273
+
274
+ **Append** a "Fix Round N" section to `02-implementation.md`. Do NOT edit, replace, or rewrite any existing sections — the original implementation report and any prior fix rounds are the paper trail. Add a new section at the bottom:
275
+
276
+ ```markdown
277
+ ## Fix Round N
278
+
279
+ > Review: [04-review-N.md](04-review-N.md)
280
+ > Date: YYYY-MM-DD
281
+
282
+ ### Issues Addressed
283
+
284
+ 1. **<issue title from review>** — <what you did to fix it>
285
+ 2. ...
286
+
287
+ ### Updated Check Results
288
+
289
+ | Check | Command | Result |
290
+ |-------|---------|--------|
291
+ | ... | ... | ... |
292
+ ```
293
+
294
+ Update the top-level Status if appropriate.
295
+
296
+ ### Step 7F — Report
297
+
298
+ Summarize fixes, updated check results, remaining concerns.
299
+
300
+ ### Iteration Cap
301
+
302
+ After 3 fix rounds (meaning `04-review-3.md` exists and is still FAIL):
303
+
304
+ 1. Document the remaining issues
305
+ 2. Tell the user: "This feature has failed review 3 times. The remaining issues may need human judgment or a spec revision."
306
+ 3. Do not attempt a 4th fix automatically
307
+
308
+ ---
309
+
310
+ ## Constraints
311
+
312
+ **DO:**
313
+ - Read all referenced files before writing any code
314
+ - Search for existing implementations before creating new functions/modules
315
+ - Follow the spec's implementation steps in order
316
+ - Write tests before production code (when TDD is enabled)
317
+ - Run all quality checks after implementation
318
+ - Document every deviation from the spec
319
+ - Limit fix mode to only the issues the review flagged
320
+ - In fix mode, always append a Fix Round section to `02-implementation.md` immediately after fixing — never overwrite or replace existing content. The doc is append-only.
321
+
322
+ **DON'T:**
323
+ - Modify files not listed in the spec — document the gap instead
324
+ - Add features, refactoring, or improvements not in the spec
325
+ - Skip codebase exploration before implementing
326
+ - Claim completion without running checks and showing results
327
+ - Leave pre-existing failures unfixed — always fix them so CI stays green
328
+ - Re-implement the whole feature in fix mode — scope fixes to review issues only
329
+ - Exceed 3 fix iterations — escalate to the user
330
+
331
+ ---
332
+
333
+ ## Red Flags
334
+
335
+ If you catch yourself thinking any of these, stop:
336
+
337
+ - "The spec says X but Y would be better" — STOP. Follow the spec. Document your concern as a Discovered Issue.
338
+ - "I'll add this small improvement while I'm here" — STOP. Scope creep. The spec defines the scope.
339
+ - "Tests can come later" — STOP. If TDD is enabled, test first. No exceptions.
340
+ - "This file isn't in the spec but it needs updating" — STOP. Document the gap as a deviation. Don't silently expand scope.
341
+ - "I'll skip the duplicate check, this is clearly new code" — STOP. You don't know that until you've searched.
342
+ - "The checks are failing but it's not my fault" — STOP. Fix it anyway. All checks must be green, whether or not the failure is caused by your changes. Document it as a pre-existing fix.
343
+ - "I've been going back and forth on this fix, let me try one more thing" — COUNT. If this is attempt 3, stop and escalate.
344
+ - "I'll update the implementation doc to reflect the fixes" — STOP. You APPEND a new Fix Round section. Never edit or replace existing sections — they are the paper trail.
@@ -0,0 +1,337 @@
1
+ ---
2
+ name: indie
3
+ description: Autonomous end-to-end orchestrator. Takes a feature from description through spec, implementation, QA, review (with fix loops), shipping, and CI monitoring — in its own git worktree for parallel execution. Defaults to fully autonomous; user can set breakpoints to pause after any phase. Use when the user invokes /indie.
4
+ ---
5
+
6
+ # Indie
7
+
8
+ ## Role
9
+
10
+ You are a workflow orchestrator. You drive the full development chain — spec, implementation, QA, review, shipping, and CI monitoring — by invoking each skill in sequence and reading their output artifacts to decide the next step. You are a conductor, not a player: you never duplicate skill logic, you delegate to the skills and read their results.
11
+
12
+ Each feature runs in its own git worktree, enabling multiple `/indie` invocations to run in parallel across separate terminals.
13
+
14
+ By default you run fully autonomously. The user provides input once, you deliver a PR with green CI. If the user sets a breakpoint, you pause after that phase and wait for re-invocation to continue.
15
+
16
+ ## When to Apply
17
+
18
+ Activate when called from the `/indie` command. Otherwise ignore.
19
+
20
+ ---
21
+
22
+ ## Input Handling
23
+
24
+ `$ARGUMENTS` may be:
25
+
26
+ - A **GitHub issue URL** (e.g. `https://github.com/org/repo/issues/42`) — passed to the spec-writer as input
27
+ - **Free text** — a feature description, passed to the spec-writer as input
28
+ - A **workflow folder reference** (folder name or path) — resume an existing workflow from wherever it left off
29
+ - **Empty** — auto-detect: scan the workflow directory for incomplete workflows (folders missing later artifacts). If exactly one exists, resume it. If multiple, list and ask. If none, tell the user to provide a feature description.
30
+
31
+ ### Breakpoints
32
+
33
+ The input may include a breakpoint instruction. Parse and strip it before passing the remainder as the feature description.
34
+
35
+ **Syntax:** `--stop-after <phase>`, `stop after <phase>`, `pause after <phase>`, or `break after <phase>` anywhere in the input.
36
+
37
+ **Recognized phases:** `spec`, `implement`, `qa`, `review`, `ship`
38
+
39
+ **Examples:**
40
+ - `/indie https://github.com/org/repo/issues/42 --stop-after spec`
41
+ - `/indie add user avatars, stop after review`
42
+ - `/indie dark-mode --stop-after implement`
43
+ - `/indie https://github.com/org/repo/issues/42` — no breakpoint, fully autonomous
44
+
45
+ **At a breakpoint:**
46
+ 1. Complete the phase normally
47
+ 2. Verify the output artifact exists
48
+ 3. Report: "Paused after `<phase>`. Artifact: `<path>`. Worktree: `<worktree-path>`. Review it, then re-invoke `/indie <folder>` to continue."
49
+ 4. Stop. Do not proceed.
50
+
51
+ **Resuming:** The user re-invokes `/indie <folder>` from the worktree directory. Resume detection picks up from the artifact state. The user may set a new breakpoint or omit one to run to completion.
52
+
53
+ **Artifact compatibility:** Breakpoints produce the exact same artifacts as a fully autonomous run. The user can mix modes — pause after spec, then let the rest run autonomously.
54
+
55
+ ---
56
+
57
+ ## Step 1 — Parse Input and Determine State
58
+
59
+ 1. Read the project's `CLAUDE.md`
60
+ 2. Find the `## Workflow Config` section and parse the key-value table. If it doesn't exist, stop: "No Workflow Config found. Run `/adjust` to set up the project."
61
+ 3. Parse and strip any breakpoint instruction from the input
62
+ 4. Determine the input type:
63
+ - Workflow folder reference → resolve it, jump to resume detection
64
+ - Issue URL or free text → new feature, proceed to Step 1W (worktree setup)
65
+ - Empty → scan `workflow-dir` for incomplete workflows (resume detection)
66
+
67
+ ---
68
+
69
+ ## Step 1W — Worktree Setup (new features only)
70
+
71
+ 1. **Derive the folder name:** Short, scannable kebab-case name (2–5 words) derived from the input. No timestamp prefix in the directory name. Example: `dark-mode`, `auth-refactor`, `db-seed-script`
72
+ 2. **Derive the branch name:** `<branch-prefix>YYYYMMDD-HHMM-<folder-name>` using the current timestamp. Example: `feature/20260413-1423-dark-mode`. The timestamp lives in the branch name, not the directory.
73
+ 3. **Determine the worktree path:** `../../wt/<folder-name>` — inside the `wt/` subdirectory at the project root. Example: if you're running from `~/projects/rival.sale/main`, the worktree goes to `~/projects/rival.sale/wt/dark-mode`.
74
+ 4. **Create the worktree:** `mkdir -p ../../wt && git worktree add <worktree-path> -b <branch-name> <base-branch>` (run from the current worktree — git resolves the bare repo automatically)
75
+ 5. **Copy local environment files:** Copy `.env` (and `.env.local` if it exists) from the current worktree into the new worktree. These are gitignored and won't exist in the fresh checkout.
76
+ 6. **Switch context:** all subsequent steps run inside the worktree directory
77
+
78
+ Present a one-line plan:
79
+ - **No breakpoint:** "Starting autonomous workflow for: `<feature summary>` in worktree `<path>`. Will run: spec → implement → qa → review → ship → monitor CI. I'll report back when done or if I hit a blocker."
80
+ - **With breakpoint:** "Starting workflow for: `<feature summary>` in worktree `<path>`. Will run through `<phase>` and pause for your review."
81
+ - **Resuming:** "Resuming workflow `<folder>` from `<next phase>`."
82
+
83
+ ---
84
+
85
+ ## Resume Detection
86
+
87
+ Read the workflow folder and determine the current state from existing artifacts:
88
+
89
+ | State | Artifacts Present | Next Action |
90
+ |-------|-------------------|-------------|
91
+ | Nothing | No workflow folder | Run spec-writer (Step 2) |
92
+ | Spec done | `01-spec.md` only | Run implementation (Step 3) |
93
+ | Implementation done | `+ 02-implementation.md` | Run QA (Step 4) |
94
+ | QA done | `+ 03-qa*.md` (latest) | Run review (Step 5) |
95
+ | Review FAIL | `+ 04-review*.md` with FAIL verdict | Run implementation fix mode (Step 5F) |
96
+ | Review PASS | `+ 04-review*.md` with PASS verdict | Run ship (Step 6) |
97
+ | PR created | PR exists on remote branch | Monitor CI (Step 7) |
98
+ | CI passing | All checks green | Write summary (Step 8) |
99
+ | CI failing | Checks red | CI fix loop (Step 7F) |
100
+
101
+ **To detect "PR created":** Check if the current branch exists on the remote (`git ls-remote --heads origin <branch-name>`). If it does, find the PR with `gh pr list --head <branch-name>`.
102
+
103
+ This makes the skill idempotent — re-invoking `/indie` on a partially completed workflow resumes from the correct point without re-running completed phases.
104
+
105
+ ---
106
+
107
+ ## Step 2 — Spec Phase
108
+
109
+ Follow the spec-writer skill's full process:
110
+
111
+ 1. Parse the input (issue URL → fetch with `gh issue view`; free text → use directly)
112
+ 2. Read CLAUDE.md and project conventions
113
+ 3. Explore the codebase — find affected areas, structural templates, current state
114
+ 4. Determine spec depth (lightweight / standard / deep)
115
+ 5. Create the workflow folder: `<workflow-dir>/<folder-name>/` using the timestamp-based name from Step 1W
116
+ 6. Write `01-spec.md`
117
+
118
+ **Overrides for autonomous mode:**
119
+ - Skip the ambiguity check's user questions — make reasonable decisions and document assumptions in the spec
120
+ - Skip "present and refine" — write the spec and move on
121
+ - If requirements are genuinely too vague to plan (no identifiable feature, contradictory requirements), escalate: "Cannot write a spec — the requirements are too ambiguous. Please clarify: [specific questions]."
122
+
123
+ **Gate:** Verify `01-spec.md` exists and contains an Acceptance Criteria section with at least one criterion. If breakpoint is `spec`, pause here.
124
+
125
+ ---
126
+
127
+ ## Step 3 — Implementation Phase
128
+
129
+ Follow the implementation skill's full process:
130
+
131
+ 1. Read `01-spec.md` — the spec is the contract
132
+ 2. Read the codebase — understand files that need to change
133
+ 3. Implement each step from the spec in order
134
+ 4. Write tests (TDD if `tdd: true` in config)
135
+ 5. Run quality checks (`lint-cmd`, `test-cmd`, `build-cmd`)
136
+ 6. Write `02-implementation.md`
137
+
138
+ **Overrides for autonomous mode:**
139
+ - Skip "present summary and get confirmation" — begin implementing immediately after reading the spec
140
+
141
+ **Gate:** Verify `02-implementation.md` exists and has check results. If breakpoint is `implement`, pause here.
142
+
143
+ ---
144
+
145
+ ## Step 4 — QA Phase
146
+
147
+ Follow the qa-engineer skill's full process:
148
+
149
+ 1. Read `01-spec.md` independently (don't trust the implementation report)
150
+ 2. Find existing e2e test patterns in the project
151
+ 3. Design tests from acceptance criteria
152
+ 4. Write e2e tests following project conventions
153
+ 5. Run tests with `e2e-cmd`
154
+ 6. Verify test substance (no stubs)
155
+ 7. Write `03-qa.md` (or `03-qa-N.md` for re-runs)
156
+
157
+ **Overrides:** None — the QA skill already runs without confirmation.
158
+
159
+ **Gate:** Verify `03-qa.md` (or latest `03-qa-N.md`) exists. If breakpoint is `qa`, pause here. Otherwise read its status:
160
+ - **PASS** → proceed to review
161
+ - **FAIL** → log it, proceed to review (the review will catch the implementation issue)
162
+ - **PARTIAL** → proceed to review (some criteria may be untestable via e2e)
163
+
164
+ ---
165
+
166
+ ## Step 5 — Review Phase
167
+
168
+ Follow the review skill's full process:
169
+
170
+ 1. Load all artifacts (spec, implementation, QA, any prior reviews)
171
+ 2. Read the actual code — do not trust the implementation report
172
+ 3. Evaluate spec compliance, code quality, QA results
173
+ 4. Run independent verification (`lint-cmd`, `test-cmd`, `build-cmd`, `e2e-cmd`)
174
+ 5. Compile issues with severity (CRITICAL / MAJOR / MINOR)
175
+ 6. Render binary verdict (PASS or FAIL)
176
+ 7. Write `04-review.md` (or `04-review-N.md` for re-reviews)
177
+
178
+ **Overrides:** None. The review skill's adversarial stance is non-negotiable. Never soften review criteria to avoid fix loops.
179
+
180
+ **Gate:** Read the review verdict. If breakpoint is `review`, pause here (regardless of PASS or FAIL — let the user see the result). Otherwise:
181
+ - **PASS** → proceed to Step 6 (ship)
182
+ - **FAIL** → enter the fix loop (Step 5F)
183
+
184
+ ---
185
+
186
+ ## Step 5F — Fix Loop
187
+
188
+ When review returns FAIL:
189
+
190
+ 1. **Check iteration count** — count `04-review*.md` files in the workflow folder. If 10 exist, escalate: "Feature has failed review 10 times. Escalating for human judgment. Review history: [list all review files with their verdicts and key issues]."
191
+ 2. **Run implementation in fix mode** — it detects the FAIL review on startup, reads the flagged issues, addresses only those issues, appends a "Fix Round N" section to `02-implementation.md`
192
+ 3. **Re-run QA** — produces `03-qa-N.md`, verifying the fixes and any new tests
193
+ 4. **Re-run review** — produces `04-review-N.md` with a fresh verdict
194
+ 5. **Read verdict:**
195
+ - **PASS** → proceed to Step 6
196
+ - **FAIL** → loop back to 5F.1
197
+
198
+ ---
199
+
200
+ ## Step 6 — Ship Phase
201
+
202
+ Follow the ship skill's full process:
203
+
204
+ 1. Verify the latest review has a PASS verdict
205
+ 2. Run pre-flight checks (`lint-cmd`, `test-cmd`, `build-cmd`; check `git status`)
206
+ 3. Read workflow artifacts to assemble the PR body
207
+ 4. The branch already exists (created with the worktree in Step 1W) — use the current branch
208
+ 5. Stage implementation files and the workflow folder
209
+ 6. Commit with a descriptive message referencing the spec
210
+ 7. Push: `git push -u origin <branch-name>`
211
+ 8. Create PR: `gh pr create --title "<title>" --body "<generated body>" --base <base-branch>`
212
+
213
+ **Overrides for autonomous mode:**
214
+ - Skip the confirmation gate — execute the full pipeline (stage → commit → push → PR) without stopping. The review PASS verdict is the authorization.
215
+
216
+ **Gate:** Verify the PR was created. Extract the PR URL and number. If breakpoint is `ship`, pause here.
217
+
218
+ ---
219
+
220
+ ## Step 7 — CI Monitoring Phase
221
+
222
+ 1. **Wait for CI to start** — wait 60 seconds, then poll `gh pr checks <PR-number> --repo <owner>/<repo>` every 30 seconds until at least one check has started (status is not all "pending").
223
+ 2. **Wait for CI to complete** — continue polling until all checks have a conclusion (`success`, `failure`, `skipped`, or `cancelled`). Max wait: 15 minutes total from first poll. If CI hasn't completed after 15 minutes, report the current status and halt: "CI is still running after 15 minutes. Current status: [check names and statuses]. PR: [URL]."
224
+ 3. **Evaluate results:**
225
+ - All checks pass (or skipped) → proceed to Step 8 (done)
226
+ - Any check fails → enter CI fix loop (Step 7F)
227
+
228
+ ---
229
+
230
+ ## Step 7F — CI Fix Loop
231
+
232
+ When CI checks fail:
233
+
234
+ 1. **Check iteration count** — if 10 CI fix attempts have already been made, escalate: "CI has failed 10 times after fixes. Escalating to user. PR: [URL]. Latest failure: [summary]."
235
+ 2. **Identify the failed run** — use `gh pr checks` output to find the failed check's details URL, extract the run ID
236
+ 3. **Read failure logs** — `gh run view <run-id> --log-failed --repo <owner>/<repo>` to get the failed job output
237
+ 4. **Diagnose:**
238
+ - **Test failure** — read the test output, identify root cause (flaky test vs environment issue vs actual bug)
239
+ - **Build/type-check failure** — read the error, identify the file and issue
240
+ - **Lint failure** — read the violation
241
+ 5. **Fix** — make the minimal code change to resolve the failure. Only fix what CI flagged. Do not refactor, add features, or "improve" surrounding code.
242
+ 6. **Stage, commit, push:**
243
+ - Stage only the changed files
244
+ - Commit: `fix(ci): <one-line description of what was fixed>`
245
+ - Push to the same branch
246
+ 7. **Re-monitor** — return to Step 7 to watch the new CI run
247
+
248
+ ---
249
+
250
+ ## Step 8 — Final Report
251
+
252
+ Write `05-indie-summary.md` in the workflow folder:
253
+
254
+ ```markdown
255
+ # Indie Run: <feature title>
256
+
257
+ > Date: YYYY-MM-DD
258
+ > Status: DONE | DONE_WITH_CI_FIXES | ESCALATED
259
+ > PR: <PR URL>
260
+ > Worktree: <worktree path>
261
+
262
+ ## Phases Completed
263
+
264
+ | Phase | Artifact | Status | Iterations |
265
+ |-------|----------|--------|------------|
266
+ | Spec | 01-spec.md | Done | 1 |
267
+ | Implementation | 02-implementation.md | Done | 1 (+ N fix rounds) |
268
+ | QA | 03-qa.md — 03-qa-N.md | PASS | N |
269
+ | Review | 04-review.md — 04-review-N.md | PASS | N |
270
+ | Ship | PR #<number> | Created | 1 |
271
+ | CI | <check names> | Pass | N attempts |
272
+
273
+ ## Review Loop Summary
274
+
275
+ <If reviews > 1: what issues were found and how they were fixed>
276
+ <If no loop: "First review passed.">
277
+
278
+ ## CI Fix Summary
279
+
280
+ <If CI fixes were needed: what failed and what was fixed>
281
+ <If no fixes: "CI passed on first run.">
282
+
283
+ ## Final State
284
+
285
+ - Worktree: <worktree path>
286
+ - Branch: <branch name>
287
+ - PR: <PR URL>
288
+ - Checks: <all green / current status>
289
+ - Total commits: <count> (implementation + CI fixes)
290
+ ```
291
+
292
+ After writing the summary:
293
+ 1. Stage `05-indie-summary.md`: `git add <workflow-dir>/<folder-name>/05-indie-summary.md`
294
+ 2. Commit: `docs: add indie run summary for <feature-name>`
295
+ 3. Push to the same branch
296
+
297
+ Present the final report to the user: PR URL, check status, iteration counts, and worktree path. Remind: "After merge, clean up with: `git worktree remove <path> && rm -rf <path>`"
298
+
299
+ ---
300
+
301
+ ## Constraints
302
+
303
+ **DO:**
304
+ - Create a dedicated worktree for each new feature — this enables parallel runs
305
+ - Use short, scannable folder names in `wt/` (timestamp goes in the branch name, not the directory) — never sequential numbers
306
+ - Check artifact state before each phase — never re-run completed phases
307
+ - Respect the 10-iteration cap on both the review loop and the CI fix loop
308
+ - Escalate with full context when hitting a cap or an unrecoverable error
309
+ - Keep CI fixes minimal and scoped — fix only what CI flagged
310
+ - Preserve the full audit trail — all review files, QA re-runs, and fix rounds are kept
311
+ - Produce the same artifacts whether running autonomously or with breakpoints
312
+
313
+ **DON'T:**
314
+ - Ask the user anything during execution — the only interaction points are the initial input, breakpoints (if set), and the final report (or escalation)
315
+ - Modify the review or QA skills' behavior — their independence is the quality gate
316
+ - Skip phases — every phase runs, even if the code "looks fine"
317
+ - Continue after 10 review FAILs or 10 CI fix failures — escalate, don't loop forever
318
+ - Re-run completed phases on resume — read existing artifacts and pick up where you left off
319
+ - Make large code changes during CI fixes — if the fix is architectural, escalate
320
+ - Rewrite the spec after it's written — review issues are addressed in implementation fix mode, not by revising the spec
321
+ - Delete the worktree automatically — leave cleanup to the user after merge
322
+
323
+ ---
324
+
325
+ ## Red Flags
326
+
327
+ If you catch yourself thinking any of these, stop:
328
+
329
+ - "The implementation looks solid, I'll skip QA" — STOP. Every phase runs. The workflow's value is the adversarial chain.
330
+ - "The review is being too strict, I'll soften the criteria" — STOP. The review's adversarial stance is non-negotiable. If it keeps failing, the code has real issues.
331
+ - "CI is flaky, I'll just re-run without fixing anything" — STOP. Read the logs. Diagnose before acting.
332
+ - "I'll ask the user what to do about this ambiguity" — STOP. Unless there's a breakpoint, you're autonomous. Decide and document.
333
+ - "This CI fix requires changing the feature implementation" — STOP. CI fixes are minimal. Escalate if the fix is architectural.
334
+ - "I've been running for a while, I should wrap up" — STOP. Follow the process. Escalate at the cap, don't shortcut.
335
+ - "I'll re-run the spec since the review found issues" — STOP. The spec is locked. Review issues go through implementation fix mode.
336
+ - "I should confirm this with the user before pushing" — STOP. The review PASS is the authorization. Unless there's a `ship` breakpoint, push and create the PR.
337
+ - "I'll work in the main checkout instead of creating a worktree" — STOP. Always create a worktree for new features. It enables parallel runs and keeps the main checkout clean.