5-phase-workflow 1.8.9 → 1.9.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/bin/install.js +14 -4
- package/package.json +1 -1
- package/src/commands/5/configure.md +25 -19
- package/src/commands/5/discuss-feature.md +2 -2
- package/src/commands/5/implement-feature.md +19 -5
- package/src/commands/5/plan-feature.md +70 -32
- package/src/commands/5/plan-implementation.md +54 -22
- package/src/commands/5/reconfigure.md +3 -3
- package/src/commands/5/review-code.md +7 -7
- package/src/references/configure-tables.md +1 -1
- package/src/skills/configure-docs-index/SKILL.md +35 -17
- package/src/skills/configure-skills/SKILL.md +2 -2
- package/src/skills/generate-readme/SKILL.md +1 -1
- package/src/skills/generate-readme/TEMPLATE.md +5 -5
- package/src/templates/workflow/FEATURE-SPEC.md +58 -24
- package/src/templates/workflow/PLAN.md +15 -14
package/bin/install.js
CHANGED
|
@@ -280,8 +280,7 @@ const LEGACY_REMOVED_FILES = [
|
|
|
280
280
|
'templates/STACK.md',
|
|
281
281
|
'templates/STRUCTURE.md',
|
|
282
282
|
'templates/CONVENTIONS.md',
|
|
283
|
-
'templates/INTEGRATIONS.md'
|
|
284
|
-
'skills/configure-project'
|
|
283
|
+
'templates/INTEGRATIONS.md'
|
|
285
284
|
];
|
|
286
285
|
|
|
287
286
|
// Get list of workflow-owned files/directories (not user-created)
|
|
@@ -298,6 +297,7 @@ function getWorkflowManagedFiles() {
|
|
|
298
297
|
// Skills: specific skill directories
|
|
299
298
|
skills: [
|
|
300
299
|
'configure-docs-index',
|
|
300
|
+
'configure-project',
|
|
301
301
|
'configure-skills',
|
|
302
302
|
'generate-readme'
|
|
303
303
|
],
|
|
@@ -651,7 +651,12 @@ function cleanupOrphanedFiles(targetPath, dataDir) {
|
|
|
651
651
|
for (const entry of LEGACY_REMOVED_FILES) {
|
|
652
652
|
const fullPath = path.join(targetPath, entry);
|
|
653
653
|
if (fs.existsSync(fullPath)) {
|
|
654
|
-
fs.
|
|
654
|
+
const stat = fs.statSync(fullPath);
|
|
655
|
+
if (stat.isDirectory()) {
|
|
656
|
+
removeDir(fullPath);
|
|
657
|
+
} else {
|
|
658
|
+
fs.unlinkSync(fullPath);
|
|
659
|
+
}
|
|
655
660
|
log.info(`Removed legacy orphan: ${entry}`);
|
|
656
661
|
}
|
|
657
662
|
}
|
|
@@ -1270,7 +1275,12 @@ function uninstall() {
|
|
|
1270
1275
|
for (const entry of LEGACY_REMOVED_FILES) {
|
|
1271
1276
|
const fullPath = path.join(targetPath, entry);
|
|
1272
1277
|
if (fs.existsSync(fullPath)) {
|
|
1273
|
-
fs.
|
|
1278
|
+
const stat = fs.statSync(fullPath);
|
|
1279
|
+
if (stat.isDirectory()) {
|
|
1280
|
+
removeDir(fullPath);
|
|
1281
|
+
} else {
|
|
1282
|
+
fs.unlinkSync(fullPath);
|
|
1283
|
+
}
|
|
1274
1284
|
log.info(`Removed legacy orphan: ${entry}`);
|
|
1275
1285
|
}
|
|
1276
1286
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ context: fork
|
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
11
|
You are a Project Configurator. You analyze a project, gather preferences, and write config.json plus a feature spec.
|
|
12
|
-
You do NOT generate CLAUDE.md, documentation files, or skills directly — those are Phase 3's job.
|
|
12
|
+
You do NOT generate AGENTS.md, CLAUDE.md, documentation files, or skills directly — those are Phase 3's job.
|
|
13
13
|
You write ONLY to: .5/config.json, .5/version.json, .5/features/CONFIGURE/feature.md, and .gitignore.
|
|
14
14
|
After writing config.json and the feature spec, you are DONE. Exit immediately.
|
|
15
15
|
</role>
|
|
@@ -39,7 +39,7 @@ Your job in this command:
|
|
|
39
39
|
✅ Tell user to run /5:plan-implementation CONFIGURE
|
|
40
40
|
|
|
41
41
|
Your job is NOT:
|
|
42
|
-
❌ Create CLAUDE.md directly (Phase 3 does this)
|
|
42
|
+
❌ Create AGENTS.md or CLAUDE.md directly (Phase 3 does this)
|
|
43
43
|
❌ Generate documentation files directly (Phase 3 does this)
|
|
44
44
|
❌ Generate skills directly (Phase 3 does this)
|
|
45
45
|
❌ Skip user interaction
|
|
@@ -47,7 +47,7 @@ Your job is NOT:
|
|
|
47
47
|
|
|
48
48
|
**After writing config.json, creating the feature spec, and informing the user, YOUR JOB IS COMPLETE. EXIT IMMEDIATELY.**
|
|
49
49
|
|
|
50
|
-
**If you find yourself creating CLAUDE.md, documentation files, or skills, STOP IMMEDIATELY. You should only be writing config.json and the feature spec.**
|
|
50
|
+
**If you find yourself creating AGENTS.md, CLAUDE.md, documentation files, or skills, STOP IMMEDIATELY. You should only be writing config.json and the feature spec.**
|
|
51
51
|
|
|
52
52
|
## Configuration Process
|
|
53
53
|
|
|
@@ -92,8 +92,9 @@ fi
|
|
|
92
92
|
# Set skill_creator_available=true if any skill-creator tool is found.
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
**1e. Check CLAUDE.md:**
|
|
96
|
-
- If `
|
|
95
|
+
**1e. Check AGENTS.md / CLAUDE.md:**
|
|
96
|
+
- If `AGENTS.md` exists, read its content
|
|
97
|
+
- If `AGENTS.md` does not exist but `CLAUDE.md` exists with real content (not just `@AGENTS.md`), read it — this is a legacy setup that will be migrated to AGENTS.md during Phase 3
|
|
97
98
|
|
|
98
99
|
**1f. Scan existing skills:**
|
|
99
100
|
- Check `.claude/skills/` for existing project-specific skills
|
|
@@ -169,7 +170,7 @@ If "Cancel": Exit immediately with message "Configuration unchanged."
|
|
|
169
170
|
**2h. Review tool preference:**
|
|
170
171
|
- "Which code review tool would you like to use?"
|
|
171
172
|
- Options:
|
|
172
|
-
1. "
|
|
173
|
+
1. "Native (built-in agent review, no setup needed)" — always available, works with any AI coding tool
|
|
173
174
|
2. "CodeRabbit CLI (requires installation)" — external tool
|
|
174
175
|
3. "None (skip automated review)"
|
|
175
176
|
- If user selects CodeRabbit and it was not detected in Step 1d:
|
|
@@ -207,14 +208,14 @@ The skill-creator plugin from the official Claude store helps generate higher-qu
|
|
|
207
208
|
- If user selects "Install now": execute the install command, then set `tools.skillCreator.available = true` in the config
|
|
208
209
|
- If user selects "Skip": `tools.skillCreator.available` remains `false`
|
|
209
210
|
|
|
210
|
-
**2k. Confirm
|
|
211
|
-
- "Generate/update
|
|
211
|
+
**2k. Confirm AGENTS.md generation:**
|
|
212
|
+
- "Generate/update AGENTS.md? This will analyze your codebase to document structure and conventions. (A CLAUDE.md shim will also be created for Claude Code compatibility.)"
|
|
212
213
|
- Options: "Yes (recommended)", "Skip"
|
|
213
214
|
|
|
214
215
|
**2k2. Confirm rules generation:**
|
|
215
|
-
- "Generate `.claude/rules/` files? These are scoped instruction files that automatically load when
|
|
216
|
+
- "Generate `.claude/rules/` files? These are scoped instruction files that automatically load when the agent works with matching file types (e.g., testing rules load only when editing test files, code-style rules load only for source files)."
|
|
216
217
|
- Options: "Yes (recommended)", "Skip"
|
|
217
|
-
- Note: Rules complement
|
|
218
|
+
- Note: Rules complement AGENTS.md — they provide focused, file-type-scoped directives derived from your project's actual conventions.
|
|
218
219
|
|
|
219
220
|
**2l. Review detected patterns for skill generation:**
|
|
220
221
|
|
|
@@ -307,7 +308,7 @@ Write `.5/features/CONFIGURE/feature.md` containing all gathered data:
|
|
|
307
308
|
# Feature: Project Configuration
|
|
308
309
|
|
|
309
310
|
## Summary
|
|
310
|
-
Generates CLAUDE.md, a rebuildable codebase index, and project-specific skills. (config.json already written.)
|
|
311
|
+
Generates AGENTS.md, CLAUDE.md shim, a rebuildable codebase index, and project-specific skills. (config.json already written.)
|
|
311
312
|
|
|
312
313
|
## Requirements
|
|
313
314
|
|
|
@@ -328,7 +329,7 @@ Analyze the codebase and generate focused documentation capturing only non-deriv
|
|
|
328
329
|
- Skip empty categories; do not create placeholder index files
|
|
329
330
|
- Re-running the script should fully refresh the index in place
|
|
330
331
|
|
|
331
|
-
**Create
|
|
332
|
+
**Create AGENTS.md** (provider-agnostic instructions file):
|
|
332
333
|
- Project overview and build commands
|
|
333
334
|
- Links to whichever `.5/` documentation files were created
|
|
334
335
|
- Links to `.5/index/README.md`, the generated index files, and `.5/index/rebuild-index.sh`
|
|
@@ -348,8 +349,12 @@ Analyze the codebase and generate focused documentation capturing only non-deriv
|
|
|
348
349
|
5. Respect SRP and DRY
|
|
349
350
|
6. Make code maintainable and modular
|
|
350
351
|
|
|
351
|
-
**
|
|
352
|
-
-
|
|
352
|
+
**Create CLAUDE.md shim:**
|
|
353
|
+
- Contains only `@AGENTS.md` (Claude Code include syntax)
|
|
354
|
+
|
|
355
|
+
**Migrate and preserve existing content:**
|
|
356
|
+
- If AGENTS.md already exists, preserve user-written custom sections
|
|
357
|
+
- If CLAUDE.md exists with real content (not just `@AGENTS.md`), migrate content to AGENTS.md and replace CLAUDE.md with the shim
|
|
353
358
|
|
|
354
359
|
### Requirement 2: Generate Project-Specific Skills
|
|
355
360
|
Handled by: `configure-skills`
|
|
@@ -388,13 +393,14 @@ Only generate rules for patterns that were actually detected:
|
|
|
388
393
|
- [ ] `.5/index/README.md` exists and documents the generated index files
|
|
389
394
|
- [ ] Multiple focused `.5/index/*.md` files are generated for applicable codebase concerns
|
|
390
395
|
- [ ] Empty sections omitted (no "Not detected" / "None found" placeholders)
|
|
391
|
-
- [ ] `
|
|
392
|
-
- [ ] `
|
|
393
|
-
- [ ] `
|
|
394
|
-
- [ ]
|
|
396
|
+
- [ ] `AGENTS.md` exists with references to created `.5/` files
|
|
397
|
+
- [ ] `AGENTS.md` links to the codebase index and rebuild script
|
|
398
|
+
- [ ] `AGENTS.md` says to regenerate the index if it is older than one day
|
|
399
|
+
- [ ] `AGENTS.md` contains 6 coding guidelines
|
|
400
|
+
- [ ] `CLAUDE.md` exists and contains only `@AGENTS.md`
|
|
395
401
|
- [ ] All specified project-specific skills are generated in `.claude/skills/`
|
|
396
402
|
- [ ] Generated skills reference actual project conventions
|
|
397
|
-
- [ ] If CLAUDE.md existed before, user-written sections are preserved
|
|
403
|
+
- [ ] If AGENTS.md or CLAUDE.md existed before, user-written sections are preserved in AGENTS.md
|
|
398
404
|
- [ ] `.claude/rules/` directory exists with scoped rule files (if rules generation selected)
|
|
399
405
|
- [ ] Generated rules use `paths:` frontmatter for scoping where applicable
|
|
400
406
|
- [ ] Rules contain concise directives, not documentation
|
|
@@ -92,7 +92,7 @@ Extract current state:
|
|
|
92
92
|
- Business rules
|
|
93
93
|
- Acceptance criteria
|
|
94
94
|
- Alternatives considered
|
|
95
|
-
-
|
|
95
|
+
- Decisions (with [DECIDED]/[FLEXIBLE]/[DEFERRED] labels)
|
|
96
96
|
|
|
97
97
|
### Step 3: Initial Discussion Prompt
|
|
98
98
|
|
|
@@ -162,7 +162,7 @@ When user indicates they're done discussing, update `.5/features/{feature-name}/
|
|
|
162
162
|
7. **Business Rules** - If logic clarified
|
|
163
163
|
8. **Acceptance Criteria** - Add/refine verification criteria
|
|
164
164
|
9. **Alternatives Considered** - Document discussed alternatives
|
|
165
|
-
10. **
|
|
165
|
+
10. **Decisions** - Append new decisions from this session, tagged [DECIDED], [FLEXIBLE], or [DEFERRED] using Context/Decision format
|
|
166
166
|
|
|
167
167
|
**Preserve existing content** - Only update sections that changed during discussion.
|
|
168
168
|
|
|
@@ -163,7 +163,8 @@ Before executing step N (where N > 1), verify that prior steps' outputs exist on
|
|
|
163
163
|
- Log: `"⚠ Pre-step check: {file} from step {M} component {name} not found on disk"`
|
|
164
164
|
- Move the component back from `completedComponents` to `pendingComponents`
|
|
165
165
|
- STOP execution for this step. Report to user: `"Step {N} blocked: prior step output missing. Re-run step {M} or fix manually."`
|
|
166
|
-
3.
|
|
166
|
+
3. **Depends On check:** For each component in step N that has a `Depends On` value (not `—`), verify the named dependency component is in `completedComponents`. If a dependency is in `failedAttempts`, STOP and report: `"Step {N} component {name} blocked: dependency {dep} failed."`
|
|
167
|
+
4. If all files and dependencies verified, proceed to 3a
|
|
167
168
|
|
|
168
169
|
This prevents cascading failures where step N assumes step N-1's outputs exist but they don't.
|
|
169
170
|
|
|
@@ -202,11 +203,17 @@ Task tool call:
|
|
|
202
203
|
## Read First
|
|
203
204
|
{Pattern File value(s) from plan table — executor MUST read these before writing any code}
|
|
204
205
|
|
|
206
|
+
## Dependencies
|
|
207
|
+
{If Depends On is not "—": "This component depends on {dep-name} ({dep-file}). Read that file first to understand the exports/types you need to use."}
|
|
208
|
+
{If Depends On is "—": omit this section entirely}
|
|
209
|
+
|
|
205
210
|
## Verify
|
|
206
211
|
{Verify command(s) from plan table — executor runs these after implementation}
|
|
207
212
|
|
|
208
213
|
## Implementation Notes
|
|
209
|
-
{
|
|
214
|
+
{ONLY notes relevant to this step/component — filter by [Step N] or [component-name] prefix.
|
|
215
|
+
Include untagged notes only if they are globally relevant (e.g., "all services use dependency injection").
|
|
216
|
+
Do NOT send all notes to every agent — this wastes context.}
|
|
210
217
|
```
|
|
211
218
|
|
|
212
219
|
The agent file defines the implementation process, output format, and deviation rules. If the agent file is not found (local install), fall back to `.claude/agents/component-executor.md` relative to the project root.
|
|
@@ -238,9 +245,16 @@ Mark the current step's TaskCreate task as `completed`. Mark the next step's tas
|
|
|
238
245
|
|
|
239
246
|
For each component that returned `STATUS: failed`:
|
|
240
247
|
|
|
241
|
-
1. **
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
1. **Always re-spawn an agent** — NEVER fix code directly in the orchestrator context, not even for small fixes like missing imports or wrong paths. The orchestrator stays slim and delegates ALL code work.
|
|
249
|
+
|
|
250
|
+
Re-spawn the component-executor agent with the same prompt plus an `## Error Context` block describing the previous failure.
|
|
251
|
+
|
|
252
|
+
**Model upgrade on retry:** Bump the model one tier up from the original complexity:
|
|
253
|
+
- `simple` (haiku) → retry with `sonnet`
|
|
254
|
+
- `moderate` (haiku/sonnet) → retry with `sonnet`
|
|
255
|
+
- `complex` (sonnet) → retry with `sonnet` (already max)
|
|
256
|
+
|
|
257
|
+
This gives the retry agent better reasoning to solve what the first attempt couldn't.
|
|
244
258
|
|
|
245
259
|
2. If the retry also fails:
|
|
246
260
|
- Update `retryCount: 2` in the component's `failedAttempts` entry
|
|
@@ -49,21 +49,34 @@ Use the template structure from `.claude/templates/workflow/FEATURE-SPEC.md`.
|
|
|
49
49
|
- Acceptance criteria describe observable behavior, NOT test code
|
|
50
50
|
</output-format>
|
|
51
51
|
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
**
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
<collaboration-strategy>
|
|
53
|
+
You are a collaborative thought partner, not an interviewer conducting a checklist.
|
|
54
|
+
|
|
55
|
+
**Approach:**
|
|
56
|
+
- After the Explore agent returns, propose a draft understanding of the feature (2-3 sentences).
|
|
57
|
+
Ask the user to confirm, correct, or expand. This anchors the conversation.
|
|
58
|
+
- Use AskUserQuestion — one exchange at a time — but frame questions as a colleague's follow-ups,
|
|
59
|
+
not a numbered interrogation.
|
|
60
|
+
- When the codebase exploration reveals an obvious pattern or approach, propose it:
|
|
61
|
+
"Based on how X works, I think this feature would involve Y — does that match your thinking?"
|
|
62
|
+
- When something is genuinely ambiguous, ask openly.
|
|
63
|
+
- Challenge assumptions naturally: "Is this the simplest solution?", "Could we reuse existing X?",
|
|
64
|
+
"What happens when Y fails?"
|
|
65
|
+
|
|
66
|
+
**Adaptive depth:**
|
|
67
|
+
- Simple features (config change, small UI tweak) may need 2-3 exchanges.
|
|
68
|
+
- Complex features (new subsystem, multi-component integration) may need 10+.
|
|
69
|
+
- Let the complexity drive the conversation length, not a fixed question count.
|
|
70
|
+
|
|
71
|
+
**Readiness signal — you are ready to write the spec when you can articulate:**
|
|
72
|
+
1. The problem being solved
|
|
73
|
+
2. Clear functional requirements
|
|
74
|
+
3. Scope boundaries (what is in, what is out)
|
|
75
|
+
4. Acceptance criteria (how to verify success)
|
|
76
|
+
5. Key decisions and their labels ([DECIDED], [FLEXIBLE], [DEFERRED])
|
|
77
|
+
|
|
78
|
+
If any of these are unclear, keep discussing.
|
|
79
|
+
</collaboration-strategy>
|
|
67
80
|
|
|
68
81
|
# Plan Feature (Phase 1)
|
|
69
82
|
|
|
@@ -74,12 +87,11 @@ Follow these steps IN ORDER. Do NOT skip steps. Do NOT proceed to a later step u
|
|
|
74
87
|
- [ ] Step 0: Activate planning guard — write `.5/.planning-active`
|
|
75
88
|
- [ ] Step 1: Gather feature description — ask developer via AskUserQuestion
|
|
76
89
|
- [ ] Step 2: Explore codebase — spawn Explore sub-agent, wait for results, cache to codebase-scan.md
|
|
77
|
-
- [ ] Step 3:
|
|
78
|
-
- [ ] Step
|
|
79
|
-
- [ ] Step 4: Write feature specification — create `.5/features/{name}/feature.md`
|
|
90
|
+
- [ ] Step 3: Collaborative spec development — discuss with the user until the spec is clear
|
|
91
|
+
- [ ] Step 4: Write feature specification — create `.5/features/{name}/feature.md` (with optional mermaid diagrams)
|
|
80
92
|
- [ ] Output completion message and STOP
|
|
81
93
|
|
|
82
|
-
> **MANDATORY:** After
|
|
94
|
+
> **MANDATORY:** After completing Steps 0, 1, 2, and 4, output `✓ Step N complete` before moving on. Step 3 is open-ended — it completes when you and the user agree the spec is ready to write.
|
|
83
95
|
|
|
84
96
|
## Process
|
|
85
97
|
|
|
@@ -140,11 +152,34 @@ Wait for the sub-agent to return before proceeding.
|
|
|
140
152
|
|
|
141
153
|
**Cache the results:** Write the Explore agent's full output to `.5/features/{name}/codebase-scan.md` using the Write tool. This saves Phase 2 from re-scanning the same codebase and saves significant tokens.
|
|
142
154
|
|
|
143
|
-
### Step 3:
|
|
155
|
+
### Step 3: Collaborative Spec Development
|
|
156
|
+
|
|
157
|
+
> **ROLE CHECK:** You are gathering requirements, NOT designing solutions. Discussion covers WHAT and WHY, never HOW.
|
|
158
|
+
|
|
159
|
+
**Begin by sharing your understanding.** Based on the user's description (Step 1) and the codebase exploration (Step 2), propose a concise summary of the feature:
|
|
160
|
+
- What problem it solves
|
|
161
|
+
- What the key capabilities are
|
|
162
|
+
- Which existing components are relevant
|
|
163
|
+
|
|
164
|
+
Ask the user: "Here's my understanding of the feature — [summary]. Does this capture it, or should I adjust anything?"
|
|
165
|
+
|
|
166
|
+
**Then discuss naturally.** Use AskUserQuestion to explore:
|
|
167
|
+
- Ambiguities or gaps in the description
|
|
168
|
+
- Scope boundaries (what is explicitly NOT included)
|
|
169
|
+
- Edge cases the codebase exploration surfaced
|
|
170
|
+
- Decisions that need to be made now vs. deferred
|
|
171
|
+
- Whether existing patterns can be reused
|
|
144
172
|
|
|
145
|
-
|
|
173
|
+
**Adapt to complexity.** A simple feature may be clear after 2-3 exchanges. A complex one may need extended discussion. Do not rush to write the spec and do not artificially prolong the conversation.
|
|
146
174
|
|
|
147
|
-
|
|
175
|
+
**You are ready to write the spec when you can confidently articulate:**
|
|
176
|
+
1. The problem being solved (Problem Statement)
|
|
177
|
+
2. Clear functional requirements
|
|
178
|
+
3. Scope boundaries (what is in, what is out)
|
|
179
|
+
4. Acceptance criteria (how to verify success)
|
|
180
|
+
5. Key decisions and their labels ([DECIDED], [FLEXIBLE], [DEFERRED])
|
|
181
|
+
|
|
182
|
+
If any of these are unclear, keep discussing. When you believe clarity has been reached, tell the user: "I think I have a clear picture — ready to write the spec. Anything else before I do?" Then proceed to Step 4.
|
|
148
183
|
|
|
149
184
|
**Optional re-exploration:** If the user mentions components not covered in the initial report, spawn a targeted Explore agent:
|
|
150
185
|
|
|
@@ -155,14 +190,6 @@ Targeted exploration for feature planning.
|
|
|
155
190
|
**READ-ONLY.** Only use Read, Glob, and Grep tools.
|
|
156
191
|
```
|
|
157
192
|
|
|
158
|
-
### Step 3b: Pre-Write Checkpoint
|
|
159
|
-
|
|
160
|
-
Before writing the feature spec, verify:
|
|
161
|
-
1. You asked at least 5 questions and received answers
|
|
162
|
-
2. You can summarize the feature in 1-2 sentences without mentioning files, classes, or functions
|
|
163
|
-
|
|
164
|
-
If you have fewer than 5 Q&A pairs, go back to Step 3 and ask more questions.
|
|
165
|
-
|
|
166
193
|
### Step 4: Create Feature Specification
|
|
167
194
|
|
|
168
195
|
> **ROLE CHECK:** You are writing a SPECIFICATION (WHAT/WHY), not a design document (HOW). Zero code, zero file paths to create, zero signatures. After writing feature.md you are DONE — do NOT proceed to implementation planning or coding.
|
|
@@ -184,12 +211,22 @@ Use the template structure from `.claude/templates/workflow/FEATURE-SPEC.md`.
|
|
|
184
211
|
Populate all sections:
|
|
185
212
|
- Ticket ID & Summary
|
|
186
213
|
- Problem Statement
|
|
214
|
+
- Visual Overview (optional mermaid diagrams — see below)
|
|
187
215
|
- Requirements (functional and non-functional)
|
|
188
216
|
- Constraints
|
|
189
217
|
- Affected Components (from exploration)
|
|
190
218
|
- Acceptance Criteria
|
|
191
219
|
- Alternatives Considered
|
|
192
|
-
- Decisions (from
|
|
220
|
+
- Decisions (from the conversation) — label each with **[DECIDED]**, **[FLEXIBLE]**, or **[DEFERRED]**
|
|
221
|
+
|
|
222
|
+
**Visual Overview (optional mermaid diagrams):**
|
|
223
|
+
Include mermaid diagrams in the spec when they add clarity. Use your judgment:
|
|
224
|
+
- **Flow diagrams**: When the feature involves a multi-step process or state transitions
|
|
225
|
+
- **Entity relationship diagrams**: When new data concepts relate to existing ones
|
|
226
|
+
- **Component interaction diagrams**: When multiple modules/services communicate
|
|
227
|
+
- **Sequence diagrams**: When the order of operations between actors matters
|
|
228
|
+
|
|
229
|
+
Simple features (single-component changes, straightforward CRUD) typically do not need diagrams. Do not add diagrams for the sake of having them. Diagrams describe WHAT happens, not HOW it is implemented. No class diagrams, no file-level architecture diagrams, no code-level sequence diagrams.
|
|
193
230
|
|
|
194
231
|
**Decision labeling rules:**
|
|
195
232
|
- **[DECIDED]**: The user gave a clear, specific answer → Phase 2 planner and Phase 3 agents MUST honor exactly
|
|
@@ -205,7 +242,8 @@ After writing feature.md, output ONLY this message — no additional text, no su
|
|
|
205
242
|
✓ Feature spec created at `.5/features/{name}/feature.md`
|
|
206
243
|
|
|
207
244
|
To review or refine: /5:discuss-feature {name}
|
|
208
|
-
To proceed: /
|
|
245
|
+
To proceed: /5:plan-implementation {name}
|
|
246
|
+
(optional: /clear first to free context — plan-implementation adapts either way)
|
|
209
247
|
```
|
|
210
248
|
|
|
211
249
|
**YOU ARE NOW FINISHED.** This is a hard stop. Do not:
|
|
@@ -22,7 +22,7 @@ HARD CONSTRAINTS — violations get blocked by plan-guard:
|
|
|
22
22
|
- NEVER use Bash to create, write, or modify files — this bypasses the plan-guard and is a constraint violation
|
|
23
23
|
- NEVER continue past the completion message — when you output "Plan created at...", you are DONE
|
|
24
24
|
- The plan describes WHAT to build and WHERE. Agents figure out HOW by reading existing code.
|
|
25
|
-
- Each component in the table gets: name, action, file path, one-sentence description, pattern file, verify command, complexity
|
|
25
|
+
- Each component in the table gets: name, action, file path, one-sentence description, pattern file, verify command, complexity, depends on
|
|
26
26
|
- **Pattern File** (required for "create" actions): Path to an existing file the executor reads before implementing. For "modify" actions, this is the target file itself. Helps executor match conventions exactly.
|
|
27
27
|
- **Verify** (required): A concrete command or grep check the executor runs after implementing. Examples: `grep -q 'export class UserService' src/services/user.service.ts`, `npm test -- --testPathPattern=user`, `npx tsc --noEmit`. Never use vague checks like "works correctly".
|
|
28
28
|
- If a component needs more than one sentence to describe, split it into multiple components
|
|
@@ -61,21 +61,32 @@ Assign complexity per component using this rubric:
|
|
|
61
61
|
|
|
62
62
|
# Plan Implementation (Phase 2)
|
|
63
63
|
|
|
64
|
+
## Context Detection
|
|
65
|
+
|
|
66
|
+
Before starting, determine whether you have **live context from Phase 1**:
|
|
67
|
+
|
|
68
|
+
**Live context = YES** if ALL of the following are true:
|
|
69
|
+
- `/5:plan-feature` was run earlier in THIS conversation (not a previous one)
|
|
70
|
+
- The feature spec discussion, codebase exploration results, and user decisions are visible in your conversation history
|
|
71
|
+
- No `/clear` was run between Phase 1 and now
|
|
72
|
+
|
|
73
|
+
**Live context = NO** if any of the above is false (e.g., user ran `/clear`, or this is a fresh conversation).
|
|
74
|
+
|
|
64
75
|
## Progress Checklist
|
|
65
76
|
|
|
66
|
-
Follow these steps IN ORDER.
|
|
77
|
+
Follow these steps IN ORDER. Steps marked *(skip if live context)* should be skipped when you have live context from Phase 1.
|
|
67
78
|
|
|
68
79
|
- [ ] Step 0: Activate planning guard — write `.5/.planning-active`
|
|
69
|
-
- [ ] Step 1: Load feature spec — read `.5/features/{name}/feature.md`
|
|
80
|
+
- [ ] Step 1: Load feature spec *(skip if live context)* — read `.5/features/{name}/feature.md`
|
|
70
81
|
- [ ] Step 1b: Load project configuration — read `.5/config.json` if it exists
|
|
71
|
-
- [ ] Step 2: Load or generate codebase scan — reuse cached scan from Phase 1, or spawn Explore if missing
|
|
72
|
-
- [ ] Step 3: Ask
|
|
82
|
+
- [ ] Step 2: Load or generate codebase scan *(skip if live context)* — reuse cached scan from Phase 1, or spawn Explore if missing
|
|
83
|
+
- [ ] Step 3: Ask technical questions *(conditional)* — only if the feature spec leaves technical ambiguity
|
|
73
84
|
- [ ] Step 4: Design components — identify files, order, step grouping
|
|
74
85
|
- [ ] Step 5: Write the plan — create `.5/features/{name}/plan.md`
|
|
75
86
|
- [ ] Step 5b: Plan self-check — verify format, no code, scope, completeness, tests
|
|
76
87
|
- [ ] Output completion message and STOP
|
|
77
88
|
|
|
78
|
-
> **MANDATORY:** After each step, output `✓ Step N complete` before moving on. This is your progress anchor — if you cannot say which step you just completed, you are skipping ahead. If Step 5b fails, fix plan.md before outputting completion.
|
|
89
|
+
> **MANDATORY:** After each step (including skipped ones), output `✓ Step N complete` (or `✓ Step N skipped (live context)`) before moving on. This is your progress anchor — if you cannot say which step you just completed, you are skipping ahead. If Step 5b fails, fix plan.md before outputting completion.
|
|
79
90
|
|
|
80
91
|
## Output Format
|
|
81
92
|
|
|
@@ -97,9 +108,11 @@ Write (or refresh) the planning guard marker to `.5/.planning-active` using the
|
|
|
97
108
|
|
|
98
109
|
This activates (or refreshes) the plan-guard hook which prevents accidental source file edits during planning. The marker is removed automatically when implementation starts (`/5:implement-feature`), expires after 4 hours, or can be cleared manually with `/5:unlock`.
|
|
99
110
|
|
|
100
|
-
### Step 1: Load Feature Spec
|
|
111
|
+
### Step 1: Load Feature Spec *(skip if live context)*
|
|
112
|
+
|
|
113
|
+
**If live context:** You already have the feature spec discussion in your conversation history. Extract ticket ID, requirements, acceptance criteria, affected components, and decisions from what was discussed. Output `✓ Step 1 skipped (live context)` and proceed to Step 1b.
|
|
101
114
|
|
|
102
|
-
Read `.5/features/{feature-name}/feature.md` (where `{feature-name}` is the argument provided).
|
|
115
|
+
**If no live context:** Read `.5/features/{feature-name}/feature.md` (where `{feature-name}` is the argument provided).
|
|
103
116
|
|
|
104
117
|
Extract: Ticket ID, requirements (functional and non-functional), acceptance criteria, affected components, and **decisions**.
|
|
105
118
|
|
|
@@ -119,11 +132,13 @@ Read `.5/config.json` if it exists. Extract:
|
|
|
119
132
|
|
|
120
133
|
If config.json doesn't exist, proceed without it.
|
|
121
134
|
|
|
122
|
-
### Step 2: Load or Generate Codebase Scan
|
|
135
|
+
### Step 2: Load or Generate Codebase Scan *(skip if live context)*
|
|
123
136
|
|
|
124
137
|
> **ROLE CHECK:** You are an Implementation Planner. Your ONLY output is plan.md. You do NOT write code, create source files, or start implementation. If you feel the urge to implement, STOP — that is Phase 3's job.
|
|
125
138
|
|
|
126
|
-
**
|
|
139
|
+
**If live context:** The codebase exploration results from Phase 1 are already in your conversation history. Output `✓ Step 2 skipped (live context)` and proceed to Step 3.
|
|
140
|
+
|
|
141
|
+
**If no live context — first, check for a cached scan from Phase 1:**
|
|
127
142
|
|
|
128
143
|
Read `.5/features/{feature-name}/codebase-scan.md`. If it exists and is non-empty, use it as the codebase scan results. This was generated during Phase 1 (`/5:plan-feature`) and contains project structure, naming conventions, pattern files, and test framework detection.
|
|
129
144
|
|
|
@@ -170,17 +185,19 @@ Wait for the sub-agent to return before proceeding.
|
|
|
170
185
|
|
|
171
186
|
**If a fresh scan was spawned**, write the results to `.5/features/{feature-name}/codebase-scan.md` for future reference.
|
|
172
187
|
|
|
173
|
-
### Step 3: Ask
|
|
188
|
+
### Step 3: Ask Technical Questions (Conditional)
|
|
174
189
|
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
190
|
+
**Evaluate whether questions are needed.** Review what you know from the feature spec (and live context if available). Ask questions ONLY if:
|
|
191
|
+
- A technical decision is genuinely ambiguous (not already labeled [DECIDED] or [FLEXIBLE])
|
|
192
|
+
- The feature spec lacks information needed to identify files, components, or ordering
|
|
193
|
+
- The codebase scan revealed multiple conflicting patterns and you need guidance
|
|
179
194
|
|
|
180
|
-
**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
-
|
|
195
|
+
**If no ambiguity exists** (all decisions are clear, codebase patterns are obvious), skip this step entirely. Output `✓ Step 3 skipped (no ambiguity)` and proceed to Step 4.
|
|
196
|
+
|
|
197
|
+
**If questions are needed:**
|
|
198
|
+
- Use AskUserQuestion — ONE question at a time
|
|
199
|
+
- Max 2 questions — be surgical, don't over-question
|
|
200
|
+
- NEVER re-ask something already answered in Phase 1 or labeled [DECIDED] in the feature spec
|
|
184
201
|
|
|
185
202
|
**Optional re-exploration:** If user mentions patterns not in the initial scan, spawn a targeted Explore agent:
|
|
186
203
|
|
|
@@ -227,6 +244,8 @@ If no e2e or integration framework was detected, do NOT plan components for them
|
|
|
227
244
|
|
|
228
245
|
Not every feature needs all non-test steps. Use what makes sense. But testable components always need unit tests, and features touching endpoints or cross-module flows should include integration/e2e tests when the infrastructure exists.
|
|
229
246
|
|
|
247
|
+
**Depends On:** For each component, identify if it has a data dependency on a specific component from a prior step. Use the component name from the Depends On column (or `—` if none). This is for cross-step dependencies where a component needs a specific export, type, or interface from another component. File-level existence is already checked by the orchestrator — Depends On captures *semantic* dependencies (e.g., "auth-service depends on auth-types because it imports AuthToken").
|
|
248
|
+
|
|
230
249
|
**Parallel execution:** Components in the same step run in parallel. Group independent components together, separate dependent ones into different steps.
|
|
231
250
|
|
|
232
251
|
### Step 5: Write the Plan
|
|
@@ -239,9 +258,22 @@ Include:
|
|
|
239
258
|
- YAML frontmatter (ticket, feature, created)
|
|
240
259
|
- One-sentence summary
|
|
241
260
|
- Components table
|
|
242
|
-
- Implementation Notes
|
|
261
|
+
- Implementation Notes — **scoped by step or component** (see below)
|
|
243
262
|
- Verification commands
|
|
244
263
|
|
|
264
|
+
**Scoped Implementation Notes:**
|
|
265
|
+
Each note MUST be prefixed with a scope tag so the orchestrator can filter notes per agent:
|
|
266
|
+
- `[Step N]` — applies to all components in that step
|
|
267
|
+
- `[component-name]` — applies to a specific component
|
|
268
|
+
- `[global]` — applies to all components (use sparingly: project-wide conventions like DI patterns, naming schemes)
|
|
269
|
+
|
|
270
|
+
Example:
|
|
271
|
+
```
|
|
272
|
+
- [global] All services use constructor-based dependency injection
|
|
273
|
+
- [Step 1] Follow the pattern from src/models/User.ts for entity definitions
|
|
274
|
+
- [schedule-service] endDate must be > startDate, throw ValidationError if not
|
|
275
|
+
```
|
|
276
|
+
|
|
245
277
|
**Verification section — prefer config.json values:**
|
|
246
278
|
- Build: {build.command from config.json, or explore agent value, or "auto"}
|
|
247
279
|
- Test: {build.testCommand from config.json, or explore agent value, or "auto"}
|
|
@@ -250,7 +282,7 @@ Include:
|
|
|
250
282
|
|
|
251
283
|
Read plan.md back and verify:
|
|
252
284
|
|
|
253
|
-
1. **Format:** Every row in the Components table has all
|
|
285
|
+
1. **Format:** Every row in the Components table has all 9 columns filled (Step, Component, Action, File, Description, Pattern File, Verify, Complexity, Depends On)
|
|
254
286
|
2. **No code:** Implementation Notes contain ONLY references to existing files and business rules
|
|
255
287
|
3. **Scope:** Every component traces back to a requirement in feature.md — if not, remove it
|
|
256
288
|
4. **Completeness:** Every functional requirement from feature.md has at least one component
|
|
@@ -287,7 +319,7 @@ Plan created at `.5/features/{feature-name}/plan.md`
|
|
|
287
319
|
|
|
288
320
|
Next steps:
|
|
289
321
|
1. Review the plan
|
|
290
|
-
2. /clear to reset context
|
|
322
|
+
2. /clear to reset context (recommended before implementation)
|
|
291
323
|
3. /5:implement-feature {feature-name}
|
|
292
324
|
```
|
|
293
325
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 5:reconfigure
|
|
3
|
-
description: Lightweight refresh of project documentation, codebase index, and skills without full Q&A. Re-detects codebase changes, regenerates .5/*.md docs, rebuilds .5/index/, updates
|
|
3
|
+
description: Lightweight refresh of project documentation, codebase index, and skills without full Q&A. Re-detects codebase changes, regenerates .5/*.md docs, rebuilds .5/index/, updates AGENTS.md, and refreshes all skills.
|
|
4
4
|
allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion
|
|
5
5
|
user-invocable: true
|
|
6
6
|
context: fork
|
|
@@ -117,7 +117,7 @@ Use the existing skills in `.claude/skills/` (from Step 2e) as the source of tru
|
|
|
117
117
|
|
|
118
118
|
Use `AskUserQuestion` to show a summary and get confirmation. Present:
|
|
119
119
|
|
|
120
|
-
1. **Documentation files that will be rewritten** — list `.5/ARCHITECTURE.md`, `.5/TESTING.md`, `.5/CONCERNS.md` (conditional), `.5/index/rebuild-index.sh`, `.5/index/*.md`, and `
|
|
120
|
+
1. **Documentation files that will be rewritten** — list `.5/ARCHITECTURE.md`, `.5/TESTING.md`, `.5/CONCERNS.md` (conditional), `.5/index/rebuild-index.sh`, `.5/index/*.md`, and `AGENTS.md`
|
|
121
121
|
2. **Skills that will be refreshed** — list ALL skills found in `.claude/skills/` (both workflow-generated and user-created)
|
|
122
122
|
3. **Rules that will be refreshed** (if rules enabled) — list workflow-generated rule files in `.claude/rules/`
|
|
123
123
|
4. **New patterns detected** (if any) — "These patterns were found in your codebase but don't have skills yet: [list]. Create skills for them?"
|
|
@@ -139,7 +139,7 @@ Invoke the refresh skills in **refresh mode** via the Task tool:
|
|
|
139
139
|
```
|
|
140
140
|
Task prompt 1: "Run configure-docs-index skill in REFRESH MODE.
|
|
141
141
|
|
|
142
|
-
Refresh the generated documentation, rebuild the codebase index in `.5/index/`, delete legacy docs if they exist, and update `
|
|
142
|
+
Refresh the generated documentation, rebuild the codebase index in `.5/index/`, delete legacy docs if they exist, and update `AGENTS.md` (plus CLAUDE.md shim) while preserving user-written sections."
|
|
143
143
|
|
|
144
144
|
Task prompt 2: "Run configure-skills skill in REFRESH MODE.
|
|
145
145
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 5:review-code
|
|
3
|
-
description: Reviews code changes using
|
|
3
|
+
description: Reviews code changes using native agent review or CodeRabbit CLI. Categorizes findings and saves them for /5:address-review-findings.
|
|
4
4
|
allowed-tools: Bash, Read, Glob, Grep, AskUserQuestion, Task, mcp__jetbrains__*
|
|
5
5
|
user-invocable: true
|
|
6
6
|
model: sonnet
|
|
@@ -21,8 +21,8 @@ After saving the findings file, you are DONE.
|
|
|
21
21
|
|
|
22
22
|
Two review tools are supported (configured in `.5/config.json` field `reviewTool`):
|
|
23
23
|
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
24
|
+
- **native** (default) — Built-in, zero setup. A fresh-context agent reviews code blind. Works with any AI coding tool (Claude Code, Codex, etc.).
|
|
25
|
+
- **coderabbit** — External CLI. Requires `coderabbit` installed and authenticated.
|
|
26
26
|
|
|
27
27
|
Both produce the same structured output format.
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ Both produce the same structured output format.
|
|
|
32
32
|
|
|
33
33
|
Read `.5/config.json` and check the `reviewTool` field.
|
|
34
34
|
|
|
35
|
-
- If not set or
|
|
35
|
+
- If not set, missing, or `"claude"` (legacy value), default to `"native"`
|
|
36
36
|
- If `"none"`, inform user that automated review is disabled and STOP
|
|
37
37
|
|
|
38
38
|
**If CodeRabbit:** Check prerequisites via Bash:
|
|
@@ -40,7 +40,7 @@ Read `.5/config.json` and check the `reviewTool` field.
|
|
|
40
40
|
which coderabbit && coderabbit auth status
|
|
41
41
|
```
|
|
42
42
|
If not installed or not authenticated, ask user via AskUserQuestion:
|
|
43
|
-
- "Switch to
|
|
43
|
+
- "Switch to native review for this review? (Recommended)" / "I'll install CodeRabbit first"
|
|
44
44
|
- If they choose CodeRabbit setup, provide install instructions and STOP
|
|
45
45
|
|
|
46
46
|
### Step 2: Determine What to Review
|
|
@@ -102,13 +102,13 @@ Task tool call:
|
|
|
102
102
|
- Include ALL findings
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
#### 3B:
|
|
105
|
+
#### 3B: Native Review Agent
|
|
106
106
|
|
|
107
107
|
```
|
|
108
108
|
Task tool call:
|
|
109
109
|
subagent_type: general-purpose
|
|
110
110
|
model: sonnet
|
|
111
|
-
description: "Run
|
|
111
|
+
description: "Run native code review"
|
|
112
112
|
prompt: |
|
|
113
113
|
You are a code reviewer. You have NO prior knowledge of what was built or why.
|
|
114
114
|
Review this code blind, purely on its merits.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: configure-docs-index
|
|
3
|
-
description: Analyzes the codebase, creates project documentation, generates a rebuildable codebase index, and updates
|
|
3
|
+
description: Analyzes the codebase, creates project documentation, generates a rebuildable codebase index, and updates AGENTS.md. Used during /5:implement-feature CONFIGURE.
|
|
4
4
|
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
5
5
|
model: sonnet
|
|
6
6
|
context: fork
|
|
@@ -11,11 +11,11 @@ user-invocable: false
|
|
|
11
11
|
|
|
12
12
|
## Overview
|
|
13
13
|
|
|
14
|
-
This skill handles the documentation and indexing work during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create the project docs, codebase index, and `
|
|
14
|
+
This skill handles the documentation and indexing work during Phase 3 (implement-feature) for the CONFIGURE feature. It is called by step-executor to create the project docs, codebase index, and `AGENTS.md`.
|
|
15
15
|
|
|
16
16
|
It handles one task:
|
|
17
17
|
|
|
18
|
-
- **Analyze Codebase and Create/Update Documentation + Index** - Maps codebase, writes `.5/*.md`, generates `.5/index/*`, and updates `
|
|
18
|
+
- **Analyze Codebase and Create/Update Documentation + Index** - Maps codebase, writes `.5/*.md`, generates `.5/index/*`, and updates `AGENTS.md`
|
|
19
19
|
|
|
20
20
|
Note: config.json is written directly by `/5:configure` during the Q&A phase.
|
|
21
21
|
|
|
@@ -23,28 +23,28 @@ Note: config.json is written directly by `/5:configure` during the Q&A phase.
|
|
|
23
23
|
|
|
24
24
|
## Modes
|
|
25
25
|
|
|
26
|
-
This skill supports two modes. The analysis (A1), template filling (A2-A3), index generation (A3.5), and
|
|
26
|
+
This skill supports two modes. The analysis (A1), template filling (A2-A3), index generation (A3.5), and AGENTS.md update (A4-A5) logic is the same in both modes — only the **input source** changes.
|
|
27
27
|
|
|
28
28
|
### Full Mode (default)
|
|
29
29
|
|
|
30
30
|
Used by `/5:configure` → `/5:implement-feature CONFIGURE` flow.
|
|
31
31
|
|
|
32
32
|
- **Input:** Pattern/command selections from feature spec (`.5/features/CONFIGURE/feature.md`)
|
|
33
|
-
- **Behavior:** Creates documentation, index files, and `
|
|
33
|
+
- **Behavior:** Creates documentation, index files, and `AGENTS.md` from scratch based on feature spec requirements
|
|
34
34
|
|
|
35
35
|
### Refresh Mode
|
|
36
36
|
|
|
37
37
|
Used by `/5:reconfigure` for lightweight refresh.
|
|
38
38
|
|
|
39
39
|
- **Input:** The Task prompt tells it to refresh documentation and the codebase index
|
|
40
|
-
- **Behavior:** Re-analyzes codebase and overwrites docs, index files, and `
|
|
40
|
+
- **Behavior:** Re-analyzes codebase and overwrites docs, index files, and `AGENTS.md`
|
|
41
41
|
- **Trigger:** Task prompt includes "REFRESH MODE"
|
|
42
42
|
|
|
43
43
|
In both modes, the analysis and generation logic is identical.
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
|
-
## A. Analyze Codebase and Create/Update
|
|
47
|
+
## A. Analyze Codebase and Create/Update AGENTS.md
|
|
48
48
|
|
|
49
49
|
**Process:**
|
|
50
50
|
|
|
@@ -139,11 +139,11 @@ Generate a repository-local codebase index that stays generic and works for any
|
|
|
139
139
|
- Skip categories that do not apply. Do not generate empty placeholder files.
|
|
140
140
|
- The script should overwrite previously generated index files on each run so rebuild is idempotent.
|
|
141
141
|
|
|
142
|
-
### A4. Create
|
|
142
|
+
### A4. Create AGENTS.md
|
|
143
143
|
|
|
144
|
-
Generate
|
|
144
|
+
Generate `AGENTS.md` — the provider-agnostic instructions file that works with any AI coding tool:
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
AGENTS.md structure:
|
|
147
147
|
- **Project Overview:** 1-2 sentences from README/package.json
|
|
148
148
|
- **Build & Run Commands:** Build, test, and other detected commands
|
|
149
149
|
- **Workflow Rules:** Include this section verbatim:
|
|
@@ -156,16 +156,33 @@ CLAUDE.md structure:
|
|
|
156
156
|
- **Coding Guidelines:** The 6 mandatory principles (types, concise docs, short files, extract methods, SRP/DRY, maintainable/modular)
|
|
157
157
|
- **Project Documentation:** Links to whichever `.5/` files were created (only list files that exist)
|
|
158
158
|
- **Codebase Index:** Add a section linking `.5/index/README.md`, the generated index files, and the rebuild script
|
|
159
|
-
- **Index Freshness Rule:** State clearly that if the index files are more than one day old,
|
|
159
|
+
- **Index Freshness Rule:** State clearly that if the index files are more than one day old, the agent should regenerate them by running `.5/index/rebuild-index.sh` before relying on them
|
|
160
160
|
|
|
161
|
-
### A5. Preserve Existing Content
|
|
161
|
+
### A5. Migrate and Preserve Existing Content
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
**Run this step BEFORE writing the CLAUDE.md shim** to avoid data loss.
|
|
164
|
+
|
|
165
|
+
**If `AGENTS.md` already exists:**
|
|
164
166
|
- Read current content
|
|
165
167
|
- Identify user-written custom sections (not matching template structure)
|
|
166
|
-
- Preserve under "Custom Documentation" section in new
|
|
168
|
+
- Preserve under "Custom Documentation" section in new AGENTS.md
|
|
167
169
|
- Ensure 6 mandatory coding guidelines are retained
|
|
168
170
|
|
|
171
|
+
**If `CLAUDE.md` already exists with real content (not just `@AGENTS.md`):**
|
|
172
|
+
- Read current CLAUDE.md content
|
|
173
|
+
- Identify user-written custom sections (not matching template structure)
|
|
174
|
+
- Migrate all content into the new AGENTS.md (preserve under "Custom Documentation" section)
|
|
175
|
+
|
|
176
|
+
### A6. Create CLAUDE.md shim (Claude Code only)
|
|
177
|
+
|
|
178
|
+
After migration is complete (A5), create or overwrite `CLAUDE.md` with only:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
@AGENTS.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This single line uses Claude Code's include syntax to pull in the full AGENTS.md content. This way Claude Code users get the instructions automatically, while other AI tools (Codex, etc.) read AGENTS.md directly.
|
|
185
|
+
|
|
169
186
|
---
|
|
170
187
|
|
|
171
188
|
## Output Contract
|
|
@@ -173,13 +190,14 @@ If CLAUDE.md already exists:
|
|
|
173
190
|
Returns structured results for each component:
|
|
174
191
|
|
|
175
192
|
```
|
|
176
|
-
Component A (Documentation + Index): SUCCESS - Created documentation files, codebase index, and
|
|
193
|
+
Component A (Documentation + Index): SUCCESS - Created documentation files, codebase index, and AGENTS.md
|
|
177
194
|
- .5/ARCHITECTURE.md (Pattern: Layered, 4 layers identified)
|
|
178
195
|
- .5/TESTING.md (mocking patterns, gotchas documented)
|
|
179
196
|
- .5/CONCERNS.md (3 TODO items, 1 security note) [or "skipped — no concerns found"]
|
|
180
197
|
- .5/index/rebuild-index.sh (generated index rebuild script)
|
|
181
198
|
- .5/index/*.md (focused codebase index files)
|
|
182
|
-
-
|
|
199
|
+
- AGENTS.md (updated with references)
|
|
200
|
+
- CLAUDE.md (shim: @AGENTS.md)
|
|
183
201
|
```
|
|
184
202
|
|
|
185
203
|
Or on failure:
|
|
@@ -190,7 +208,7 @@ Component A (Documentation + Index): FAILED - Unable to read template files
|
|
|
190
208
|
|
|
191
209
|
## DO NOT
|
|
192
210
|
|
|
193
|
-
- DO NOT overwrite existing user-written
|
|
211
|
+
- DO NOT overwrite existing user-written AGENTS.md sections
|
|
194
212
|
- DO NOT include `steps` in config.json
|
|
195
213
|
- DO NOT hardcode conventions - always derive from actual project analysis
|
|
196
214
|
- DO NOT generate empty or placeholder index files
|
|
@@ -219,7 +219,7 @@ For each applicable rule:
|
|
|
219
219
|
1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
|
|
220
220
|
2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
|
|
221
221
|
3. **Keep each file 15-40 lines** — be concise and actionable
|
|
222
|
-
4. **Do not repeat** the 6 mandatory coding guidelines from `
|
|
222
|
+
4. **Do not repeat** the 6 mandatory coding guidelines from `AGENTS.md`
|
|
223
223
|
|
|
224
224
|
Write files to `.claude/rules/`:
|
|
225
225
|
|
|
@@ -311,4 +311,4 @@ Component D (Rules): SKIPPED - rules.generate is false in config
|
|
|
311
311
|
- DO NOT hardcode conventions - always derive from actual project analysis
|
|
312
312
|
- DO NOT generate empty or placeholder skill or rule files
|
|
313
313
|
- DO NOT assume command syntax - always read from actual config files (package.json, Makefile, etc.)
|
|
314
|
-
- DO NOT repeat the 6 mandatory coding guidelines from `
|
|
314
|
+
- DO NOT repeat the 6 mandatory coding guidelines from `AGENTS.md` in rule files
|
|
@@ -78,7 +78,7 @@ Look for patterns in project documentation:
|
|
|
78
78
|
|
|
79
79
|
- Check `.5/ARCHITECTURE.md` for architectural patterns and non-obvious conventions
|
|
80
80
|
- Check `.5/TESTING.md` for test patterns and conventions
|
|
81
|
-
- Fall back to
|
|
81
|
+
- Fall back to AGENTS.md if `.5/` documentation not present
|
|
82
82
|
- Check module-specific documentation
|
|
83
83
|
|
|
84
84
|
Use these patterns to identify what's critical for the module README.
|
|
@@ -75,7 +75,7 @@ Examples:
|
|
|
75
75
|
|
|
76
76
|
**DO NOT include:**
|
|
77
77
|
|
|
78
|
-
- General patterns covered in
|
|
78
|
+
- General patterns covered in AGENTS.md
|
|
79
79
|
- Obvious patterns like "use builders for construction"
|
|
80
80
|
- Implementation details
|
|
81
81
|
|
|
@@ -95,8 +95,8 @@ Examples:
|
|
|
95
95
|
|
|
96
96
|
**Don't include:**
|
|
97
97
|
|
|
98
|
-
- Links to
|
|
99
|
-
- Don't repeat things and patterns already documented in
|
|
98
|
+
- Links to AGENTS.md sections relevant to this module
|
|
99
|
+
- Don't repeat things and patterns already documented in AGENTS.md
|
|
100
100
|
|
|
101
101
|
**Include for:**
|
|
102
102
|
|
|
@@ -112,7 +112,7 @@ Examples:
|
|
|
112
112
|
|
|
113
113
|
1. List every validator, query, or handler class individually
|
|
114
114
|
2. Document implementation details
|
|
115
|
-
3. Copy content from
|
|
115
|
+
3. Copy content from AGENTS.md
|
|
116
116
|
4. Include exhaustive method signatures
|
|
117
117
|
5. Create walls of text
|
|
118
118
|
6. Document every package
|
|
@@ -122,7 +122,7 @@ Examples:
|
|
|
122
122
|
|
|
123
123
|
1. Focus on top-level overview
|
|
124
124
|
2. List 3-5 key components only
|
|
125
|
-
3. Reference
|
|
125
|
+
3. Reference AGENTS.md for patterns
|
|
126
126
|
4. Keep it under 100 lines
|
|
127
127
|
5. Use examples sparingly
|
|
128
128
|
6. Use package references for groups
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
- Entity definitions describe data concepts, not schemas or interfaces
|
|
5
5
|
- Acceptance criteria describe observable behavior, not test assertions
|
|
6
6
|
- NO code, pseudo-code, or implementation details anywhere in this document
|
|
7
|
+
- Visual Overview section is OPTIONAL — delete it if the feature doesn't benefit from diagrams
|
|
8
|
+
- Mermaid diagrams describe WHAT happens, not HOW it is implemented
|
|
7
9
|
-->
|
|
8
10
|
|
|
9
11
|
# Feature: {TICKET-ID} - {Title}
|
|
@@ -12,27 +14,57 @@
|
|
|
12
14
|
{TICKET-ID}
|
|
13
15
|
|
|
14
16
|
## Summary
|
|
15
|
-
{1-2 sentence overview
|
|
17
|
+
{1-2 sentence overview: what capability is being added and who benefits}
|
|
16
18
|
|
|
17
19
|
## Problem Statement
|
|
18
|
-
{
|
|
20
|
+
{Describe the current pain point or gap. Who experiences it and what is the impact?}
|
|
21
|
+
|
|
22
|
+
## Visual Overview
|
|
23
|
+
<!-- OPTIONAL: Include mermaid diagrams only when they add clarity to the feature.
|
|
24
|
+
Delete this entire section if the feature is simple enough to understand without diagrams.
|
|
25
|
+
Use whichever diagram types are relevant — you don't need all of them. -->
|
|
26
|
+
|
|
27
|
+
<!-- Process Flow — use when the feature involves a multi-step process or state transitions -->
|
|
28
|
+
```mermaid
|
|
29
|
+
flowchart TD
|
|
30
|
+
A[Start state] --> B[Step 1]
|
|
31
|
+
B --> C{Decision point}
|
|
32
|
+
C -->|Yes| D[Outcome 1]
|
|
33
|
+
C -->|No| E[Outcome 2]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
<!-- Entity Relationships — use when new data concepts relate to existing ones -->
|
|
37
|
+
```mermaid
|
|
38
|
+
erDiagram
|
|
39
|
+
ENTITY-A ||--o{ ENTITY-B : "relationship"
|
|
40
|
+
ENTITY-B }|--|| ENTITY-C : "relationship"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<!-- Component Interactions — use when multiple modules or services communicate -->
|
|
44
|
+
```mermaid
|
|
45
|
+
sequenceDiagram
|
|
46
|
+
actor User
|
|
47
|
+
participant ComponentA
|
|
48
|
+
participant ComponentB
|
|
49
|
+
User->>ComponentA: action
|
|
50
|
+
ComponentA->>ComponentB: interaction
|
|
51
|
+
ComponentB-->>User: result
|
|
52
|
+
```
|
|
19
53
|
|
|
20
54
|
## Requirements
|
|
21
55
|
|
|
22
56
|
### Functional Requirements
|
|
23
|
-
- {
|
|
24
|
-
- {Requirement 2}
|
|
57
|
+
- {The system shall... [describe observable behavior]}
|
|
25
58
|
- ...
|
|
26
59
|
|
|
27
60
|
### Non-Functional Requirements
|
|
28
|
-
- {Performance
|
|
29
|
-
- {Compatibility requirements}
|
|
61
|
+
- {Performance, reliability, scalability, or compatibility expectations}
|
|
30
62
|
- ...
|
|
31
63
|
|
|
32
64
|
## Constraints
|
|
33
|
-
- {Business
|
|
34
|
-
- {Technical
|
|
35
|
-
- {
|
|
65
|
+
- {Business rules that limit the solution space}
|
|
66
|
+
- {Technical boundaries from existing architecture}
|
|
67
|
+
- {Timeline or resource limitations}
|
|
36
68
|
|
|
37
69
|
## Affected Components
|
|
38
70
|
- **{component/module-1}** - {What changes here}
|
|
@@ -56,9 +88,9 @@
|
|
|
56
88
|
- ...
|
|
57
89
|
|
|
58
90
|
## Acceptance Criteria
|
|
59
|
-
- [ ] {
|
|
60
|
-
- [ ] {
|
|
61
|
-
- [ ] {
|
|
91
|
+
- [ ] {Observable behavior that proves this requirement is met}
|
|
92
|
+
- [ ] {Observable behavior that proves this requirement is met}
|
|
93
|
+
- [ ] {Observable behavior that proves this requirement is met}
|
|
62
94
|
- ...
|
|
63
95
|
|
|
64
96
|
## Alternatives Considered
|
|
@@ -78,22 +110,24 @@
|
|
|
78
110
|
|
|
79
111
|
## Decisions
|
|
80
112
|
|
|
81
|
-
<!--
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
<!-- Record key decisions from the spec discussion.
|
|
114
|
+
Tag each with exactly one of: [DECIDED], [FLEXIBLE], [DEFERRED]
|
|
115
|
+
- [DECIDED]: Locked — Phase 2 planner and Phase 3 agents MUST honor exactly
|
|
116
|
+
- [FLEXIBLE]: Claude's discretion — planner chooses the best approach
|
|
117
|
+
- [DEFERRED]: Out of scope — planner MUST NOT include in the plan
|
|
85
118
|
-->
|
|
86
119
|
|
|
87
|
-
###
|
|
88
|
-
**
|
|
120
|
+
### {Topic: brief description of what was decided}
|
|
121
|
+
**Context:** {Why this decision came up}
|
|
122
|
+
**Decision:** {What was decided} **[DECIDED]**
|
|
89
123
|
|
|
90
|
-
###
|
|
91
|
-
**
|
|
124
|
+
### {Topic: area left to implementer's discretion}
|
|
125
|
+
**Context:** {What was discussed}
|
|
126
|
+
**Decision:** {General direction, implementer chooses specifics} **[FLEXIBLE]**
|
|
92
127
|
|
|
93
|
-
###
|
|
94
|
-
**
|
|
95
|
-
|
|
96
|
-
...
|
|
128
|
+
### {Topic: explicitly deferred item}
|
|
129
|
+
**Context:** {Why it was raised}
|
|
130
|
+
**Decision:** {Not addressing now — reason} **[DEFERRED]**
|
|
97
131
|
|
|
98
132
|
## Next Steps
|
|
99
133
|
After approval:
|
|
@@ -10,7 +10,8 @@ created: {ISO-timestamp}
|
|
|
10
10
|
- Description column: one action-oriented sentence per component
|
|
11
11
|
- Pattern File column: path to an existing file the executor MUST read before implementing (establishes conventions)
|
|
12
12
|
- Verify column: a concrete command or check the executor runs after implementing (grep pattern, test command, build check)
|
|
13
|
-
-
|
|
13
|
+
- Depends On column: name of a component this one depends on (for cross-step data dependencies), or "—" if none
|
|
14
|
+
- Implementation Notes: scoped with [global], [Step N], or [component-name] prefixes — the orchestrator filters per agent
|
|
14
15
|
- Components table must cover all functional requirements from feature.md
|
|
15
16
|
- Three test tiers: unit (always required for logic), integration (when framework detected + cross-module/DB/API), e2e (when framework detected + endpoints/UI flows)
|
|
16
17
|
- Every "create" component with logic (services, controllers, repositories, utilities) must have a corresponding unit test component
|
|
@@ -24,16 +25,16 @@ created: {ISO-timestamp}
|
|
|
24
25
|
|
|
25
26
|
## Components
|
|
26
27
|
|
|
27
|
-
| Step | Component | Action | File | Description | Pattern File | Verify | Complexity |
|
|
28
|
-
|
|
29
|
-
| 1 | {name} | create | {path} | {what it does} | {existing file to read first} | {grep/test command} | simple |
|
|
30
|
-
| 1 | {name} | create | {path} | {what it does} | {pattern} | {verify} | simple |
|
|
31
|
-
| 2 | {name} | create | {path} | {what it does} | {pattern} | {verify} | moderate |
|
|
32
|
-
| 2 | {name} | modify | {path} | {what to change} | {target file} | {verify} | moderate |
|
|
33
|
-
| 3 | {name} | create | {path} | {what it does} | {pattern} | {verify} | complex |
|
|
34
|
-
| 4 | {name} unit tests | create | {test-path} | Test {what it tests} | {existing test} | {test command} | moderate |
|
|
35
|
-
| 4 | {name} integration tests | create | {test-path} | Test {cross-module interaction} | {existing test} | {test command} | moderate |
|
|
36
|
-
| 4 | {name} e2e tests | create | {test-path} | Test {user-facing flow end-to-end} | {existing test} | {test command} | moderate |
|
|
28
|
+
| Step | Component | Action | File | Description | Pattern File | Verify | Complexity | Depends On |
|
|
29
|
+
|------|-----------|--------|------|-------------|-------------|--------|------------|------------|
|
|
30
|
+
| 1 | {name} | create | {path} | {what it does} | {existing file to read first} | {grep/test command} | simple | — |
|
|
31
|
+
| 1 | {name} | create | {path} | {what it does} | {pattern} | {verify} | simple | — |
|
|
32
|
+
| 2 | {name} | create | {path} | {what it does} | {pattern} | {verify} | moderate | {step-1-component} |
|
|
33
|
+
| 2 | {name} | modify | {path} | {what to change} | {target file} | {verify} | moderate | — |
|
|
34
|
+
| 3 | {name} | create | {path} | {what it does} | {pattern} | {verify} | complex | {step-2-component} |
|
|
35
|
+
| 4 | {name} unit tests | create | {test-path} | Test {what it tests} | {existing test} | {test command} | moderate | {tested-component} |
|
|
36
|
+
| 4 | {name} integration tests | create | {test-path} | Test {cross-module interaction} | {existing test} | {test command} | moderate | {tested-component} |
|
|
37
|
+
| 4 | {name} e2e tests | create | {test-path} | Test {user-facing flow end-to-end} | {existing test} | {test command} | moderate | {tested-component} |
|
|
37
38
|
|
|
38
39
|
## Testing Strategy
|
|
39
40
|
|
|
@@ -41,9 +42,9 @@ created: {ISO-timestamp}
|
|
|
41
42
|
|
|
42
43
|
## Implementation Notes
|
|
43
44
|
|
|
44
|
-
- Follow the pattern from {existing-file} for {component-type}
|
|
45
|
-
- {
|
|
46
|
-
- {
|
|
45
|
+
- [global] Follow the pattern from {existing-file} for {component-type}
|
|
46
|
+
- [Step N] {Convention or context relevant to all components in step N}
|
|
47
|
+
- [{component-name}] {Key business rule or integration point specific to this component}
|
|
47
48
|
|
|
48
49
|
## Verification
|
|
49
50
|
|