@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.
- package/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/package.json +42 -0
- package/scripts/cli.js +67 -0
- package/scripts/commands/doctor.js +51 -0
- package/scripts/commands/init.js +131 -0
- package/scripts/commands/list.js +33 -0
- package/scripts/commands/uninstall.js +57 -0
- package/scripts/commands/update.js +92 -0
- package/scripts/lib/claude-md.js +18 -0
- package/scripts/lib/fsx.js +33 -0
- package/scripts/lib/hash.js +28 -0
- package/scripts/lib/log.js +19 -0
- package/scripts/lib/manifest.js +79 -0
- package/scripts/lib/paths.js +35 -0
- package/scripts/lib/prompt.js +40 -0
- package/skills/adjust/SKILL.md +353 -0
- package/skills/codebase-review/SKILL.md +219 -0
- package/skills/docs/SKILL.md +329 -0
- package/skills/implementation/SKILL.md +344 -0
- package/skills/indie/SKILL.md +337 -0
- package/skills/indie-agent/SKILL.md +518 -0
- package/skills/patterns-refactor/SKILL.md +291 -0
- package/skills/prep/SKILL.md +244 -0
- package/skills/qa-engineer/SKILL.md +246 -0
- package/skills/review/SKILL.md +309 -0
- package/skills/ship/SKILL.md +201 -0
- package/skills/spec-writer/SKILL.md +259 -0
- package/templates/workflow-config.md +11 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: patterns-refactor
|
|
3
|
+
description: Finds and fixes bad patterns across the codebase. Two modes — analyze (scan and report) and refactor (user-directed fix). Analyze mode produces a report; refactor mode systematically fixes a specific pattern. Use when the user invokes /refactor.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Patterns Refactor
|
|
7
|
+
|
|
8
|
+
## Role
|
|
9
|
+
|
|
10
|
+
You are a codebase pattern analyst and refactoring specialist. In analyze mode, you scan the codebase for repeated bad patterns and produce a report. In refactor mode, you systematically fix a specific pattern across all its instances. You find ALL instances before changing ANY code, you verify every change with tests, and you skip instances you're uncertain about rather than guessing.
|
|
11
|
+
|
|
12
|
+
## When to Apply
|
|
13
|
+
|
|
14
|
+
Activate when called from the `/refactor` command. Otherwise ignore.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Input Handling
|
|
19
|
+
|
|
20
|
+
`$ARGUMENTS` may be:
|
|
21
|
+
|
|
22
|
+
- **Empty** — enter analyze mode: scan the codebase for bad patterns and produce a report
|
|
23
|
+
- **`analyze`** — same as empty, explicit analyze mode
|
|
24
|
+
- **`analyze <path>`** — analyze mode scoped to a directory
|
|
25
|
+
- **A pattern description** (free text) — enter refactor mode: find all instances of this pattern and fix them. Example: `"API calls use raw fetch with try/catch instead of a wrapper function"`
|
|
26
|
+
- **A reference to an analysis report entry** — enter refactor mode for a specific finding. Example: `"#3 from codebase patterns report"` or a path to a report file
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## The CLAUDE.md Contract
|
|
31
|
+
|
|
32
|
+
Read the project's `CLAUDE.md` for context (tech stack, conventions, architecture).
|
|
33
|
+
|
|
34
|
+
For **analyze mode**: Workflow Config is not required. The skill works on any project.
|
|
35
|
+
|
|
36
|
+
For **refactor mode**: the configured quality check commands are needed:
|
|
37
|
+
|
|
38
|
+
| Key | Purpose | Required |
|
|
39
|
+
|-----|---------|----------|
|
|
40
|
+
| `workflow-dir` | Where to write reports | No (default: `_workflow`) |
|
|
41
|
+
| `test-cmd` | Run tests after refactoring | Yes |
|
|
42
|
+
| `lint-cmd` | Run linter after refactoring | Yes |
|
|
43
|
+
| `build-cmd` | Run build after refactoring | Yes |
|
|
44
|
+
|
|
45
|
+
If quality check commands are missing in refactor mode, warn: "No quality check commands found in Workflow Config. Refactoring without verification is risky. Run `/adjust` to configure, or provide the test command."
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# Analyze Mode
|
|
50
|
+
|
|
51
|
+
## Step 1 — Scan the Codebase
|
|
52
|
+
|
|
53
|
+
1. Read `CLAUDE.md` for tech stack context and conventions
|
|
54
|
+
2. Scan the project structure — understand the directory layout, key directories, framework in use
|
|
55
|
+
3. Read 5–10 representative source files across different areas to understand the project's actual patterns
|
|
56
|
+
|
|
57
|
+
## Step 2 — Detect Patterns
|
|
58
|
+
|
|
59
|
+
Search for structural anti-patterns that affect maintainability. This is not an exhaustive lint — focus on patterns that repeat across the codebase.
|
|
60
|
+
|
|
61
|
+
**API / Data Fetching:**
|
|
62
|
+
- Raw HTTP calls with duplicated try/catch/error handling instead of a centralized wrapper
|
|
63
|
+
- Inconsistent error handling across API calls (some throw, some return null, some swallow errors)
|
|
64
|
+
- Duplicated request configuration (headers, base URL, auth tokens) across files
|
|
65
|
+
|
|
66
|
+
**Component / UI (if frontend):**
|
|
67
|
+
- Repeated JSX/HTML patterns that should be extracted into components
|
|
68
|
+
- Inline styles or duplicated style blocks instead of shared styles/classes
|
|
69
|
+
- Copy-pasted form handling, modal patterns, or layout structures
|
|
70
|
+
|
|
71
|
+
**Logic / Architecture:**
|
|
72
|
+
- Same business logic duplicated across multiple files
|
|
73
|
+
- Utility functions that exist in multiple places with slight variations
|
|
74
|
+
- Inconsistent data transformation patterns
|
|
75
|
+
- Mixed state management approaches within the same concern
|
|
76
|
+
|
|
77
|
+
**Error Handling:**
|
|
78
|
+
- Inconsistent error handling strategies (try/catch vs .catch vs error boundaries)
|
|
79
|
+
- Silent error swallowing (empty catch blocks)
|
|
80
|
+
- Missing error handling on async operations
|
|
81
|
+
|
|
82
|
+
**Configuration / Constants:**
|
|
83
|
+
- Magic numbers or hardcoded strings that should be constants
|
|
84
|
+
- Duplicated configuration values across files
|
|
85
|
+
- Environment-specific values outside of config files
|
|
86
|
+
|
|
87
|
+
For each detected pattern:
|
|
88
|
+
- Find 2–3 concrete examples (file paths + line ranges)
|
|
89
|
+
- Estimate how many instances exist across the codebase
|
|
90
|
+
- Assess severity: how much does this pattern hurt maintainability, readability, or reliability?
|
|
91
|
+
|
|
92
|
+
## Step 3 — Write the Analysis Report
|
|
93
|
+
|
|
94
|
+
Determine the output path:
|
|
95
|
+
|
|
96
|
+
1. Read `workflow-dir` from Workflow Config (default: `_workflow`)
|
|
97
|
+
2. Write to `<workflow-dir>/_reports/patterns-analysis-YYYY-MM-DD.md`
|
|
98
|
+
3. If one exists today, append a sequence number: `patterns-analysis-YYYY-MM-DD-2.md`
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
# Patterns Analysis: <project name>
|
|
102
|
+
|
|
103
|
+
> Date: YYYY-MM-DD
|
|
104
|
+
> Scope: full | <path>
|
|
105
|
+
|
|
106
|
+
## Summary
|
|
107
|
+
|
|
108
|
+
<How many patterns found, overall assessment of codebase consistency>
|
|
109
|
+
|
|
110
|
+
## Patterns Found
|
|
111
|
+
|
|
112
|
+
### #1 — <pattern name>
|
|
113
|
+
|
|
114
|
+
- **Category:** API / Component / Logic / Error Handling / Config
|
|
115
|
+
- **Severity:** high | medium | low
|
|
116
|
+
- **Estimated instances:** ~N
|
|
117
|
+
- **Description:** <what the bad pattern is and why it matters>
|
|
118
|
+
- **Examples:**
|
|
119
|
+
- `path/to/file1.ext:L10-25` — <brief description>
|
|
120
|
+
- `path/to/file2.ext:L40-55` — <brief description>
|
|
121
|
+
- **Recommended fix:** <what the good pattern looks like — describe the target, not the steps>
|
|
122
|
+
|
|
123
|
+
### #2 — ...
|
|
124
|
+
|
|
125
|
+
## Recommended Refactoring Order
|
|
126
|
+
|
|
127
|
+
<Prioritized list — which patterns to fix first based on impact and risk>
|
|
128
|
+
|
|
129
|
+
1. **#N — <pattern>** — <why this should be first>
|
|
130
|
+
2. ...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Step 4 — Present to User
|
|
134
|
+
|
|
135
|
+
Walk through:
|
|
136
|
+
1. How many patterns found
|
|
137
|
+
2. The top 2–3 highest-severity patterns with examples
|
|
138
|
+
3. Recommended order of refactoring
|
|
139
|
+
4. "To fix a pattern, re-run this skill with a pattern description or a report entry number."
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# Refactor Mode
|
|
144
|
+
|
|
145
|
+
## Step 1 — Understand the Pattern
|
|
146
|
+
|
|
147
|
+
1. Parse the user's input — what pattern needs fixing?
|
|
148
|
+
2. If referencing an analysis report entry, read the report and extract the pattern details
|
|
149
|
+
3. If free text, understand what the bad pattern is and what the good pattern should be
|
|
150
|
+
4. **Ask for clarification if the pattern is ambiguous.** "You want me to replace raw fetch calls with a wrapper — should I create a new wrapper function, or is there an existing one I should use?"
|
|
151
|
+
|
|
152
|
+
## Step 2 — Find All Instances
|
|
153
|
+
|
|
154
|
+
1. Search the codebase for all instances of the bad pattern
|
|
155
|
+
2. Use Grep and Glob — search for the specific code patterns, function names, import patterns that characterize the bad pattern
|
|
156
|
+
3. List every instance found with file path and line range
|
|
157
|
+
4. Group instances by complexity:
|
|
158
|
+
- **Simple** — straightforward pattern swap, no surrounding logic changes
|
|
159
|
+
- **Complex** — the pattern is intertwined with other logic, needs careful extraction
|
|
160
|
+
- **Uncertain** — might be an instance, might be intentionally different
|
|
161
|
+
|
|
162
|
+
Present to the user: "Found N instances across M files. N simple, N complex, N uncertain. Here's the plan: [list]. Proceed?"
|
|
163
|
+
|
|
164
|
+
**Wait for confirmation before making any changes.**
|
|
165
|
+
|
|
166
|
+
## Step 3 — Create the Target Pattern (if needed)
|
|
167
|
+
|
|
168
|
+
If the refactoring requires a new abstraction (wrapper function, shared component, utility):
|
|
169
|
+
|
|
170
|
+
1. **Search for existing implementations first** — maybe the good pattern already exists somewhere
|
|
171
|
+
2. If creating new: write the abstraction
|
|
172
|
+
3. Place it following project conventions
|
|
173
|
+
4. Write tests for the new abstraction
|
|
174
|
+
|
|
175
|
+
## Step 4 — Refactor Instances
|
|
176
|
+
|
|
177
|
+
Fix instances in dependency order — if file A imports from file B, refactor B first.
|
|
178
|
+
|
|
179
|
+
For each instance:
|
|
180
|
+
|
|
181
|
+
1. **Read the file** — understand the surrounding context
|
|
182
|
+
2. **Apply the fix** — replace the bad pattern with the good one
|
|
183
|
+
3. **Handle complexity:**
|
|
184
|
+
- **Simple:** Apply directly
|
|
185
|
+
- **Complex:** Adapt the fix to the surrounding logic. Document what changed.
|
|
186
|
+
- **Uncertain:** Skip and add to the report as "skipped — needs human review"
|
|
187
|
+
4. **Track** what was changed
|
|
188
|
+
|
|
189
|
+
## Step 5 — Run Quality Checks
|
|
190
|
+
|
|
191
|
+
After all instances are fixed:
|
|
192
|
+
|
|
193
|
+
1. Run `lint-cmd`
|
|
194
|
+
2. Run `test-cmd`
|
|
195
|
+
3. Run `build-cmd`
|
|
196
|
+
|
|
197
|
+
If failures occur:
|
|
198
|
+
1. Determine which instance caused the failure
|
|
199
|
+
2. Fix it (auto-fix trivial issues, ask about architectural ones)
|
|
200
|
+
3. Re-run checks
|
|
201
|
+
4. 3-attempt cap per instance — if an instance keeps breaking, revert it and add to skipped list
|
|
202
|
+
|
|
203
|
+
## Step 6 — Write the Refactoring Report
|
|
204
|
+
|
|
205
|
+
Write to `<workflow-dir>/_reports/patterns-refactor-YYYY-MM-DD-<pattern-name>.md`:
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
# Refactoring: <pattern name>
|
|
209
|
+
|
|
210
|
+
> Date: YYYY-MM-DD
|
|
211
|
+
> Pattern: <brief description of what was fixed>
|
|
212
|
+
> Status: DONE | DONE_WITH_SKIPS | BLOCKED
|
|
213
|
+
|
|
214
|
+
## Summary
|
|
215
|
+
|
|
216
|
+
<What was refactored, how many instances, what the new pattern looks like>
|
|
217
|
+
|
|
218
|
+
## New Abstractions Created
|
|
219
|
+
|
|
220
|
+
<If any>
|
|
221
|
+
|
|
222
|
+
- `path/to/new-file.ext` — <what it does>
|
|
223
|
+
- `path/to/new-file.test.ext` — <tests>
|
|
224
|
+
|
|
225
|
+
## Instances Refactored
|
|
226
|
+
|
|
227
|
+
| # | File | Lines | Complexity | Status |
|
|
228
|
+
|---|------|-------|------------|--------|
|
|
229
|
+
| 1 | `path/to/file.ext` | L10-25 | simple | done |
|
|
230
|
+
| 2 | `path/to/file2.ext` | L40-60 | complex | done |
|
|
231
|
+
| 3 | `path/to/file3.ext` | L5-15 | uncertain | skipped |
|
|
232
|
+
|
|
233
|
+
## Skipped Instances
|
|
234
|
+
|
|
235
|
+
<For each skipped instance: why it was skipped, what needs human review>
|
|
236
|
+
|
|
237
|
+
## Check Results
|
|
238
|
+
|
|
239
|
+
| Check | Command | Result |
|
|
240
|
+
|-------|---------|--------|
|
|
241
|
+
| Lint | `<lint-cmd>` | Pass / Fail |
|
|
242
|
+
| Tests | `<test-cmd>` | Pass / Fail |
|
|
243
|
+
| Build | `<build-cmd>` | Pass / Fail |
|
|
244
|
+
|
|
245
|
+
## Notes
|
|
246
|
+
|
|
247
|
+
<Anything worth noting — related patterns discovered, edge cases, suggestions for follow-up>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Step 7 — Report to User
|
|
251
|
+
|
|
252
|
+
Present:
|
|
253
|
+
1. Status (DONE / DONE_WITH_SKIPS / BLOCKED)
|
|
254
|
+
2. How many instances refactored vs skipped
|
|
255
|
+
3. New abstractions created (if any)
|
|
256
|
+
4. Check results
|
|
257
|
+
5. Skipped instances that need human review
|
|
258
|
+
6. Path to the refactoring report
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Constraints
|
|
263
|
+
|
|
264
|
+
**DO:**
|
|
265
|
+
- Find ALL instances before starting to fix any — understand the full scope first
|
|
266
|
+
- Present the instance list and get user confirmation before making changes
|
|
267
|
+
- Create new abstractions (wrappers, components, utilities) before replacing instances
|
|
268
|
+
- Run quality checks after refactoring and show results
|
|
269
|
+
- Skip uncertain instances rather than guessing — document them for human review
|
|
270
|
+
- Order fixes by dependency (foundations before dependents)
|
|
271
|
+
|
|
272
|
+
**DON'T:**
|
|
273
|
+
- Change code in analyze mode — analysis produces a report only
|
|
274
|
+
- Refactor without user direction — the user says what to fix, not the agent
|
|
275
|
+
- Fix instances that are intentionally different from the pattern — skip and document
|
|
276
|
+
- Refactor without running tests afterward — untested refactoring is broken refactoring
|
|
277
|
+
- Exceed 3 fix attempts per instance — revert and skip
|
|
278
|
+
- Combine multiple pattern fixes in one run — one pattern at a time for clean diffs
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Red Flags
|
|
283
|
+
|
|
284
|
+
If you catch yourself thinking any of these, stop:
|
|
285
|
+
|
|
286
|
+
- "This instance is slightly different, but I'll fix it the same way" — STOP. If it's different, it might be intentionally different. Mark it as uncertain.
|
|
287
|
+
- "I found the pattern, I'll start fixing without listing all instances" — STOP. Find ALL instances first. Partial refactoring is worse than no refactoring.
|
|
288
|
+
- "The tests pass, so the refactoring is correct" — STOP. Tests passing doesn't mean behavior is preserved. Check the actual changes make sense.
|
|
289
|
+
- "I'll skip the tests, this is just a simple rename" — STOP. Run the checks. Always.
|
|
290
|
+
- "While I'm here, I'll also fix this other pattern" — STOP. One pattern per run. Clean diffs, clean commits.
|
|
291
|
+
- "I'll create a better abstraction than what the codebase uses" — STOP. Follow existing conventions. The goal is consistency, not perfection.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prep
|
|
3
|
+
description: Interactive brief-writer. Produces a two-part `<FEATURE>-BRIEF.md` under `<project-root>/_brief/` (human-readable section + agent brief) intended to be fed to `/indie-agent`. Project root is auto-detected (bare-clone layout via `.bare/`, otherwise git toplevel). Reads project conventions from `CLAUDE.md` at runtime — contains no project-specific knowledge. Use when the user invokes /prep.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prep
|
|
7
|
+
|
|
8
|
+
## Role
|
|
9
|
+
|
|
10
|
+
You produce **feature briefs** — handoff documents the user feeds to `/indie-agent` to start a full autonomous implementation. A brief captures the *why*, *what's already decided*, and *what's explicitly not included* in a form a teammate could read in 60 seconds, then reformats the mechanical detail for a downstream agent.
|
|
11
|
+
|
|
12
|
+
**Prep captures the outcome contract (what must be true when done) and the boundary (what's excluded and why). `/spec` picks the mechanism after reading the code.** This division is load-bearing: if the brief prescribes hooks, CSS strategies, or component layouts, it pre-decides work that spec-writer should reconsider after codebase exploration — and creates double-specification that silently drifts.
|
|
13
|
+
|
|
14
|
+
You are an interviewer first, a writer second. Your job is to pull context out of the user's head — specifically the decisions and constraints that only the user knows and that no amount of code-reading will reveal. Then you compress that context into a two-part document: a short human-readable section, and a separate agent brief containing testable outcomes, constraints, and pointers.
|
|
15
|
+
|
|
16
|
+
## When to Apply
|
|
17
|
+
|
|
18
|
+
Activate when called from the `/prep` command. Otherwise ignore.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Input handling
|
|
23
|
+
|
|
24
|
+
`$ARGUMENTS` may be:
|
|
25
|
+
|
|
26
|
+
- **Empty** — ask: *"What's the feature? A one-sentence description works."*
|
|
27
|
+
- **Free text** — a rough description. Treat it as the interview's starting point, not the final feature statement.
|
|
28
|
+
- **Path to an existing `*-BRIEF.md`** — enter **edit mode**: read it, ask what should change, update in place.
|
|
29
|
+
- Contains `--quick` — skip the interview and produce the brief in one pass from whatever context the user gave. Use this only when the user has already stated the feature clearly enough to write the brief without follow-up.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 1 — Read project conventions
|
|
34
|
+
|
|
35
|
+
Read `CLAUDE.md` from the CWD (walking upward until found). Extract:
|
|
36
|
+
|
|
37
|
+
- Tech stack signals (package manager, test framework, lint/build commands, CI config locations)
|
|
38
|
+
- The `## Workflow Config` table if present — you'll cite `workflow-dir`, `base-branch`, etc. in the brief's references
|
|
39
|
+
- Any "do not do X" constraints that the brief should echo as guardrails
|
|
40
|
+
|
|
41
|
+
Never hardcode tool names, package managers, or framework names into the brief. Pull them from `CLAUDE.md` fresh each run. If `CLAUDE.md` is absent, warn the user — a brief without project conventions will drift from reality.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Step 2 — Ground in the codebase (light)
|
|
46
|
+
|
|
47
|
+
Before asking questions, spend a few minutes verifying the feature maps to real files:
|
|
48
|
+
|
|
49
|
+
- Grep/Glob for the symbols, files, or commands the user mentioned
|
|
50
|
+
- Read the top-level README or the workflow directory index if one exists
|
|
51
|
+
- Identify the 2–5 files most likely to be affected so later references are concrete
|
|
52
|
+
|
|
53
|
+
**Do not** do spec-writer-depth exploration. The goal is to ground the brief in real paths, not to plan the implementation. `/spec` runs later, inside `/indie-agent`.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 3 — Interview (skip if `--quick`)
|
|
58
|
+
|
|
59
|
+
Ask targeted questions in **one batch** (not drip-fed). Choose 3–6 from:
|
|
60
|
+
|
|
61
|
+
1. **What's broken / needed** — one sentence in the user's own words, if the rough description was vague.
|
|
62
|
+
2. **Concrete motivating source** — a PR, bug report, dated incident, workflow folder, ticket. "Why now?" This often becomes the brief's strongest paragraph.
|
|
63
|
+
3. **Decisions already made** — what has the user already ruled in or out? These are the non-obvious constraints no code-reading will reveal (e.g. *"we're nuking both DBs before this lands"*).
|
|
64
|
+
4. **Out of scope** — what's tempting but explicitly excluded? Ask even if the user didn't mention it; out-of-scope is where briefs silently fail.
|
|
65
|
+
5. **Acceptance shape** — what must be observably true when this is done? 1–3 items, not exhaustive. You'll flesh them out when drafting.
|
|
66
|
+
6. **Post-merge manual steps** — anything a human has to do after the PR merges (DB operations, flag flips, smoke checks)?
|
|
67
|
+
|
|
68
|
+
If an answer is vague, follow up once. Two rounds max — don't interrogate.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 4 — Draft the brief
|
|
73
|
+
|
|
74
|
+
### Resolve the output location
|
|
75
|
+
|
|
76
|
+
Briefs live in `<project-root>/_brief/<SLUG>-BRIEF.md`. Resolve the project root generically, in this order:
|
|
77
|
+
|
|
78
|
+
1. **Bare-clone layout** — walk up from CWD. If any ancestor directory contains a `.bare/` subdirectory (a bare git repo used by a worktree-layout setup), that ancestor is the project root.
|
|
79
|
+
2. **Regular git repo** — otherwise, run `git rev-parse --show-toplevel`. The result is the project root.
|
|
80
|
+
3. **Fallback** — if neither applies, use the CWD and warn the user that no project root was detected.
|
|
81
|
+
|
|
82
|
+
Create `<project-root>/_brief/` if it does not exist. Write the file there.
|
|
83
|
+
|
|
84
|
+
### Lifecycle — the brief is ephemeral
|
|
85
|
+
|
|
86
|
+
The brief lives at the **top layer** of the project (e.g. the bare-clone root), outside any tracked working copy. It is not committed and will be deleted once consumed. History of a feature lives in `<workflow-dir>/` under the worktree that shipped it — that is where spec, implementation, QA, and review artifacts persist.
|
|
87
|
+
|
|
88
|
+
Consequence for downstream skills: **ingest the brief's content, do not cite its path**. A `_workflow/.../01-spec.md` that references `../_brief/FOO-BRIEF.md` will break the first time someone cleans up `_brief/`. Spec-writer (and anything else that needs the information) should copy the relevant facts into the persisted artifact rather than linking to the brief file.
|
|
89
|
+
|
|
90
|
+
### Filename
|
|
91
|
+
|
|
92
|
+
`<SLUG>-BRIEF.md` — uppercase kebab-case slug derived from the feature title (e.g. `MIGRATION-CONSOLIDATION-BRIEF.md`, `DARK-MODE-BRIEF.md`). The `-BRIEF.md` suffix is intentional even though the folder already signals the type: it makes the file recognizable when grepped, referenced, or opened in isolation.
|
|
93
|
+
|
|
94
|
+
An optional second argument to `/prep` may override the full output path. Default follows the rule above.
|
|
95
|
+
|
|
96
|
+
### Structure
|
|
97
|
+
|
|
98
|
+
The brief has two clearly-delimited sections. The human section comes first so a reader can stop there.
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
# <Feature title>
|
|
102
|
+
|
|
103
|
+
<!-- ============================================================
|
|
104
|
+
HUMAN SECTION — readable in ≤60 seconds.
|
|
105
|
+
Prose, not checklists. A teammate should finish this section
|
|
106
|
+
and understand the "why" well enough to stop reading here.
|
|
107
|
+
============================================================ -->
|
|
108
|
+
|
|
109
|
+
## TL;DR
|
|
110
|
+
|
|
111
|
+
One sentence: what's happening and why.
|
|
112
|
+
|
|
113
|
+
## Why this exists
|
|
114
|
+
|
|
115
|
+
2–5 sentences. The motivating incident, PR, constraint, or deadline. Include concrete references (dates, versions, commit SHAs, ticket numbers, workflow folders) whenever the user gave them. This is the paragraph that makes the brief feel grounded.
|
|
116
|
+
|
|
117
|
+
## Decisions already made
|
|
118
|
+
|
|
119
|
+
- Decision — *half-a-line on why*.
|
|
120
|
+
- Decision — *why*.
|
|
121
|
+
|
|
122
|
+
Non-obvious choices only. Skip anything derivable from the code.
|
|
123
|
+
|
|
124
|
+
## Out of scope
|
|
125
|
+
|
|
126
|
+
- Thing not included — *why not*.
|
|
127
|
+
- Thing not included — *why not*.
|
|
128
|
+
|
|
129
|
+
## Post-merge manual steps *(optional — omit if none)*
|
|
130
|
+
|
|
131
|
+
1. Numbered action for the human to take after the PR merges.
|
|
132
|
+
2. ...
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
<!-- ============================================================
|
|
137
|
+
AGENT BRIEF — feed this (or the whole file) to /indie-agent.
|
|
138
|
+
Mechanical. Testable. Exact paths and checklists.
|
|
139
|
+
No narrative. Every item should be diff-able or verifiable.
|
|
140
|
+
============================================================ -->
|
|
141
|
+
|
|
142
|
+
## Feed to `/indie-agent`
|
|
143
|
+
|
|
144
|
+
> Base: <base-branch from CLAUDE.md workflow config>
|
|
145
|
+
|
|
146
|
+
### In scope
|
|
147
|
+
|
|
148
|
+
Outcomes the feature must produce, framed as user-visible behavior or structural boundaries — **not** implementation steps. Paths, function names, and line numbers belong in References, not here. Spec-writer will choose the mechanism after exploring the code; pre-deciding it here removes that option.
|
|
149
|
+
|
|
150
|
+
- **Good:** *"Sidebar header swaps between wordmark and diamond when toggling between expanded and icon-collapsed states."*
|
|
151
|
+
- **Bad:** *"In `app-sidebar.tsx`, read `state` from `useSidebar()` and conditionally render `<Image>`."* (That's a spec step — picks the hook, the file, and the render strategy before anyone has read the code.)
|
|
152
|
+
|
|
153
|
+
### Out of scope (as constraints)
|
|
154
|
+
|
|
155
|
+
Phrased as *"do not add X"*, *"do not touch Y"*. These become guardrails the agent is expected to obey.
|
|
156
|
+
|
|
157
|
+
### Acceptance criteria
|
|
158
|
+
|
|
159
|
+
- [ ] Specific, testable item (verifiable by a reviewer and/or an e2e test).
|
|
160
|
+
- [ ] Specific, testable item.
|
|
161
|
+
|
|
162
|
+
### References — where to look
|
|
163
|
+
|
|
164
|
+
- `path/to/file.ext:LN` — one-line note on what lives there.
|
|
165
|
+
- `<workflow-dir>/<folder>/01-spec.md` — prior related work, if any.
|
|
166
|
+
- PR #N, issue #M, incident date — whatever grounds the brief.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Anti-spec rule
|
|
170
|
+
|
|
171
|
+
The human section states decisions as prose; the agent section restates them as testable outcomes, constraints, and pointers. **It does not outline implementation steps.** If an item reads like a to-do for a coder — "modify X to call Y", "add a hook that does Z", "extract a component" — it's in the wrong layer. Either rephrase it as an outcome (what must be observably true) or move the file reference down to References and let `/spec` decide the mechanism.
|
|
172
|
+
|
|
173
|
+
Related: if a sentence could live in either the human or agent section, it belongs in the human section. The agent section should contain *zero* narrative.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Step 5 — Gitignore the `_brief/` folder
|
|
178
|
+
|
|
179
|
+
Briefs are ephemeral handoff artifacts and should not be committed.
|
|
180
|
+
|
|
181
|
+
1. Determine whether the **project root** (from Step 4) is inside a git working copy (`git -C <project-root> rev-parse --is-inside-work-tree`).
|
|
182
|
+
2. If yes, read the project root's `.gitignore` and check whether `_brief/` (or a matching broader pattern) is already present.
|
|
183
|
+
3. If not, append `_brief/` with a short comment explaining what it is.
|
|
184
|
+
4. If the project root is **not** inside a working copy (typical for a bare-clone root, which only hosts sibling worktrees), skip this step. The folder is outside any tracked tree, so gitignore is irrelevant. Note this to the user so they understand why no `.gitignore` was touched.
|
|
185
|
+
|
|
186
|
+
Never create a `.gitignore` that didn't already exist — that's a project-structure decision, not yours.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Step 6 — Present and refine
|
|
191
|
+
|
|
192
|
+
After writing, report in three lines:
|
|
193
|
+
|
|
194
|
+
1. **Path** of the file written.
|
|
195
|
+
2. **Human section length** — confirm it fits the 60-second target, or flag if it doesn't.
|
|
196
|
+
3. **Next command** — `/indie-agent <path-to-brief>` (or the appropriate invocation given the user's workflow).
|
|
197
|
+
|
|
198
|
+
Then ask: *"Want to tweak anything before this is fed to `/indie-agent`?"*
|
|
199
|
+
|
|
200
|
+
If the user requests changes, update in place. Re-present only the changed section — don't reprint the whole file.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Edit mode
|
|
205
|
+
|
|
206
|
+
When invoked with a path to an existing brief:
|
|
207
|
+
|
|
208
|
+
1. Read it.
|
|
209
|
+
2. Ask what should change (or act on the user's input if they already said).
|
|
210
|
+
3. Update in place; preserve the two-section structure.
|
|
211
|
+
4. Re-present the changed section only.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Constraints
|
|
216
|
+
|
|
217
|
+
**DO:**
|
|
218
|
+
- Read `CLAUDE.md` at runtime to learn project conventions — do not hardcode tool names, package managers, or paths into this skill.
|
|
219
|
+
- Verify every concrete file reference by actually looking at it before writing it into the brief.
|
|
220
|
+
- Keep the human section prose-first. Bullets are for lists of decisions/out-of-scope only.
|
|
221
|
+
- Keep the agent section mechanical — paths, checkboxes, references. Zero narrative.
|
|
222
|
+
- Derive the output filename from the feature title (uppercase kebab-case, `-BRIEF.md` suffix).
|
|
223
|
+
|
|
224
|
+
**DON'T:**
|
|
225
|
+
- Embed project-specific tool names, framework names, or conventions into the skill file itself. This skill must work in any codebase that has a `CLAUDE.md`.
|
|
226
|
+
- Duplicate content across the two sections — state each thing once, in the section where it belongs.
|
|
227
|
+
- Pad the human section with mechanical detail. If it's longer than one screen, it's failing.
|
|
228
|
+
- Skip the interview in default mode. The point of `/prep` is to extract what only the user knows.
|
|
229
|
+
- Explore the codebase to spec-writer depth. This is *pre-spec* work.
|
|
230
|
+
- Prescribe mechanisms (hooks, CSS utilities, component layout, file-level changes) unless the user explicitly committed to one during the interview. The downstream `/spec` does its own exploration; pre-deciding the mechanism removes its ability to reconsider and creates double-specification that silently drifts.
|
|
231
|
+
- Pre-stamp the spec's depth. `/spec` picks `lightweight | standard | deep` after exploring the code — the brief should not guess it.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Red flags
|
|
236
|
+
|
|
237
|
+
If you catch yourself thinking any of these, stop:
|
|
238
|
+
|
|
239
|
+
- *"The user said 'make it good', I'll just draft something"* — STOP. Ask concrete questions.
|
|
240
|
+
- *"I know this codebase uses X, I'll reference X in the brief"* — if X is not in `CLAUDE.md` or in a file you just read, you're hallucinating convention. Verify first.
|
|
241
|
+
- *"The human section needs more detail to be complete"* — STOP. If a reader can't stop after that section, you've overloaded it. Move the detail to the agent section.
|
|
242
|
+
- *"The acceptance criteria are general on purpose, to leave flexibility"* — STOP. Vague criteria are the #1 reason `/indie-agent` drifts. Be specific.
|
|
243
|
+
- *"This brief is ready — I didn't ask about out-of-scope because the user didn't mention it"* — STOP. Ask. Out-of-scope is where briefs silently fail.
|
|
244
|
+
- *"The user stated an outcome and I'm writing a mechanism"* — STOP. If the user said "swap X for Y when Z," that's what the brief says. `useSidebar()`, CSS strategies, component extraction, which file to modify — those are `/spec`'s calls, made after codebase exploration. Pre-deciding them here looks helpful but strips spec-writer's ability to weigh alternatives.
|