specdacular 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,501 @@
1
+ <purpose>
2
+ Create executable task plans that an agent can implement without asking clarifying questions.
3
+
4
+ **Key principles:**
5
+ - Plans are prompts, not documents
6
+ - Each task references specific files with exact paths
7
+ - Include code patterns from codebase
8
+ - Verification is executable commands
9
+ - Tasks sized for ~15-60 min agent execution
10
+
11
+ **Output:** ROADMAP.md + plans/phase-XX/YY-PLAN.md files
12
+ </purpose>
13
+
14
+ <philosophy>
15
+
16
+ ## Plans Are Prompts
17
+
18
+ Each PLAN.md is literally what you'd send to an implementing agent. It must contain everything needed to implement without asking questions:
19
+ - What files to create/modify
20
+ - What patterns to follow (with code examples)
21
+ - How to verify success
22
+ - When the task is done
23
+
24
+ ## Specificity Over Abstraction
25
+
26
+ **Bad:** "Create a component for displaying items"
27
+ **Good:** "Create `src/components/ItemList/index.tsx` following pattern from `src/components/UserList/index.tsx`. Must export `ItemList` component that accepts `items: Item[]` prop..."
28
+
29
+ ## Dependency-Driven Phases
30
+
31
+ Phases follow natural code dependencies:
32
+ 1. **Types first** — Shared type definitions
33
+ 2. **Data layer** — Database schemas, API routes
34
+ 3. **Business logic** — Hooks, utilities, services
35
+ 4. **UI** — Components that consume the above
36
+
37
+ Each phase's output is input for the next.
38
+
39
+ ## Task Sizing
40
+
41
+ Each plan should contain 2-3 tasks. Each task should be:
42
+ - Completable in 15-60 minutes of agent execution
43
+ - Independently verifiable
44
+ - Focused on related files
45
+
46
+ Too big = agent loses context. Too small = overhead exceeds value.
47
+
48
+ ## Verification Is Executable
49
+
50
+ **Bad:** "Make sure it works"
51
+ **Good:** `npx tsc --noEmit && npm test -- --grep "ItemList"`
52
+
53
+ Every task has a verification step. If you can't verify it with a command, add a specific manual check.
54
+
55
+ </philosophy>
56
+
57
+ <process>
58
+
59
+ <step name="validate">
60
+ Validate feature exists and has required context.
61
+
62
+ ```bash
63
+ # Check feature exists
64
+ [ -d ".specd/features/$ARGUMENTS" ] || { echo "not found"; exit 1; }
65
+
66
+ # Check required files
67
+ [ -f ".specd/features/$ARGUMENTS/FEATURE.md" ] || { echo "missing FEATURE.md"; exit 1; }
68
+ [ -f ".specd/features/$ARGUMENTS/CONTEXT.md" ] || { echo "missing CONTEXT.md"; exit 1; }
69
+ [ -f ".specd/features/$ARGUMENTS/DECISIONS.md" ] || { echo "missing DECISIONS.md"; exit 1; }
70
+
71
+ # Check optional files
72
+ [ -f ".specd/features/$ARGUMENTS/RESEARCH.md" ] && echo "has_research"
73
+ ```
74
+
75
+ **If feature not found:**
76
+ ```
77
+ Feature '{name}' not found.
78
+
79
+ Run /specd:new-feature {name} to create it.
80
+ ```
81
+
82
+ **If missing required files:**
83
+ ```
84
+ Feature '{name}' is missing required context for planning:
85
+ - {missing file}
86
+
87
+ Run /specd:discuss-feature {name} to build more context.
88
+ ```
89
+
90
+ Continue to load_context.
91
+ </step>
92
+
93
+ <step name="load_context">
94
+ Load ALL context.
95
+
96
+ **Read feature context:**
97
+ - `FEATURE.md` — Technical requirements, files to create
98
+ - `CONTEXT.md` — Resolved gray areas, code patterns discussed
99
+ - `DECISIONS.md` — All active decisions
100
+ - `RESEARCH.md` — If exists, implementation patterns and pitfalls
101
+
102
+ **Read codebase context (if available):**
103
+ - `PATTERNS.md` — Code patterns to follow
104
+ - `STRUCTURE.md` — Where files go
105
+ - `MAP.md` — System overview, integration points
106
+
107
+ **Extract key information:**
108
+ - Files that must be created (from FEATURE.md)
109
+ - Integration points (from FEATURE.md)
110
+ - Patterns to follow (from CONTEXT.md, RESEARCH.md, codebase)
111
+ - Decisions that affect implementation
112
+ - Pitfalls to avoid (from RESEARCH.md)
113
+
114
+ Continue to assess_readiness.
115
+ </step>
116
+
117
+ <step name="assess_readiness">
118
+ Check if there's enough context to create good plans.
119
+
120
+ **Required for planning:**
121
+ - [ ] Clear list of files to create
122
+ - [ ] Integration points identified
123
+ - [ ] Key decisions made (at least technology choices)
124
+
125
+ **Warning signs (insufficient context):**
126
+ - FEATURE.md has placeholder text
127
+ - CONTEXT.md has many unresolved gray areas
128
+ - No decisions in DECISIONS.md
129
+ - Major technical questions unanswered
130
+
131
+ **If insufficient:**
132
+ ```
133
+ Feature '{name}' might benefit from more discussion before planning.
134
+
135
+ **Current state:**
136
+ - Files to create: {count or "unclear"}
137
+ - Integration points: {count or "unclear"}
138
+ - Decisions made: {count}
139
+ - Gray areas remaining: {count}
140
+
141
+ **Recommendation:**
142
+ /specd:discuss-feature {name} — Resolve remaining gray areas
143
+ /specd:research-feature {name} — Research implementation approach
144
+
145
+ Continue anyway? (Plans may need revision)
146
+ ```
147
+
148
+ Use AskUserQuestion:
149
+ - header: "Plan Readiness"
150
+ - question: "How would you like to proceed?"
151
+ - options:
152
+ - "Continue planning" — Create plans with current context
153
+ - "Discuss first" — Run discuss-feature
154
+ - "Research first" — Run research-feature
155
+
156
+ **If sufficient or user chooses to continue:**
157
+ Continue to derive_phases.
158
+ </step>
159
+
160
+ <step name="derive_phases">
161
+ Derive phases from dependency analysis.
162
+
163
+ **Analyze dependencies:**
164
+ 1. What types/interfaces are needed? (Phase: Types)
165
+ 2. What data layer changes are needed? (Phase: Data/API)
166
+ 3. What business logic is needed? (Phase: Logic/Hooks)
167
+ 4. What UI is needed? (Phase: Components)
168
+ 5. What integration/wiring is needed? (Phase: Integration)
169
+
170
+ **Standard phase pattern:**
171
+ ```
172
+ Phase 1: Foundation (types, schemas)
173
+ Phase 2: Data Layer (API routes, database)
174
+ Phase 3: Business Logic (hooks, services)
175
+ Phase 4: UI (components)
176
+ Phase 5: Integration (wiring, entry points)
177
+ ```
178
+
179
+ **Adjust based on feature:**
180
+ - Small feature: might be 2-3 phases
181
+ - Large feature: might be 5+ phases
182
+ - Some features skip phases (no UI, no API, etc.)
183
+
184
+ **For each phase, identify:**
185
+ - Goal: What this phase achieves
186
+ - Creates: New files
187
+ - Modifies: Existing files
188
+ - Depends on: Previous phases or external dependencies
189
+
190
+ **Present to user:**
191
+ ```
192
+ Based on the requirements, here's the proposed phase structure:
193
+
194
+ **Phase 1: {Name}** — {Goal}
195
+ Creates: {file list}
196
+ Depends on: None
197
+
198
+ **Phase 2: {Name}** — {Goal}
199
+ Creates: {file list}
200
+ Depends on: Phase 1
201
+
202
+ ...
203
+
204
+ Does this phasing make sense? Any adjustments?
205
+ ```
206
+
207
+ Continue to break_into_tasks.
208
+ </step>
209
+
210
+ <step name="break_into_tasks">
211
+ Break each phase into tasks.
212
+
213
+ **For each phase:**
214
+
215
+ 1. Group related files into tasks (2-3 tasks per phase)
216
+ 2. Order tasks by internal dependencies
217
+ 3. Define clear boundaries
218
+
219
+ **Task structure:**
220
+ - Files: Specific paths (1-3 files per task)
221
+ - Action: What to create/modify
222
+ - Pattern: Code pattern to follow (with example)
223
+ - Verify: Command to verify completion
224
+ - Done: Completion criteria checklist
225
+
226
+ **Example task breakdown:**
227
+
228
+ Phase 1: Types & Schema
229
+ - Task 1: Create type definitions
230
+ - Task 2: Create database schema
231
+
232
+ Phase 2: API Layer
233
+ - Task 1: Create API route handlers
234
+ - Task 2: Create API client functions
235
+
236
+ Phase 3: UI Components
237
+ - Task 1: Create core component
238
+ - Task 2: Create supporting components
239
+ - Task 3: Create styles/tests
240
+
241
+ Continue to write_plans.
242
+ </step>
243
+
244
+ <step name="write_plans">
245
+ Write PLAN.md files for each task.
246
+
247
+ **Create plans directory:**
248
+ ```bash
249
+ mkdir -p .specd/features/{feature-name}/plans/phase-01
250
+ mkdir -p .specd/features/{feature-name}/plans/phase-02
251
+ # ... for each phase
252
+ ```
253
+
254
+ **For each plan, use template at `~/.claude/specdacular/templates/features/PLAN.md`**
255
+
256
+ **Fill in plan content:**
257
+
258
+ **Frontmatter:**
259
+ ```yaml
260
+ ---
261
+ feature: {feature-name}
262
+ phase: {N}
263
+ plan: {NN}
264
+ depends_on: [list of previous plan IDs]
265
+ creates:
266
+ - {exact/path/to/file.ts}
267
+ modifies:
268
+ - {exact/path/to/existing.ts}
269
+ ---
270
+ ```
271
+
272
+ **Objective:**
273
+ One sentence: what this accomplishes and why.
274
+
275
+ **Context:**
276
+ ```markdown
277
+ **Reference these files:**
278
+ - `@.specd/codebase/PATTERNS.md` — Code patterns
279
+ - `@{path/to/pattern/file}` — Pattern to follow
280
+
281
+ **Relevant Decisions:**
282
+ - DEC-XXX: {Decision affecting this plan}
283
+
284
+ **From Research:** (if RESEARCH.md exists)
285
+ - {Key finding}
286
+ - {Pitfall to avoid}
287
+ ```
288
+
289
+ **Tasks:**
290
+ For each task:
291
+ ```markdown
292
+ ### Task N: {Title}
293
+
294
+ **Files:** `{path/to/file}`
295
+
296
+ **Action:**
297
+ {Clear description with enough detail to implement}
298
+
299
+ Follow pattern from `{path/to/example}`:
300
+ ```{language}
301
+ // Pattern to follow
302
+ {actual code from codebase}
303
+ ```
304
+
305
+ Create:
306
+ ```{language}
307
+ // What to create (scaffold or full example)
308
+ {code example}
309
+ ```
310
+
311
+ **Verify:**
312
+ ```bash
313
+ {verification command}
314
+ ```
315
+
316
+ **Done when:**
317
+ - [ ] {Specific criterion}
318
+ - [ ] {Specific criterion}
319
+ ```
320
+
321
+ **Verification section:**
322
+ ```markdown
323
+ ## Verification
324
+
325
+ After all tasks complete:
326
+
327
+ ```bash
328
+ # Type check
329
+ npx tsc --noEmit
330
+
331
+ # Run tests
332
+ npm test -- --grep "{pattern}"
333
+ ```
334
+
335
+ **Plan complete when:**
336
+ - [ ] All tasks done
337
+ - [ ] All verifications pass
338
+ ```
339
+
340
+ Continue to write_roadmap.
341
+ </step>
342
+
343
+ <step name="write_roadmap">
344
+ Write ROADMAP.md with phase overview.
345
+
346
+ **Use template at `~/.claude/specdacular/templates/features/ROADMAP.md`**
347
+
348
+ **Fill in:**
349
+
350
+ **Overview table:**
351
+ - Total phases
352
+ - Total plans
353
+ - Current phase: 1
354
+ - Status: Not Started
355
+
356
+ **Phase list:** Quick overview with one-liners
357
+
358
+ **Phase details:** For each phase:
359
+ - Goal
360
+ - Creates (file list)
361
+ - Modifies (file list)
362
+ - Plans (with summaries)
363
+ - Success criteria
364
+ - Dependencies
365
+
366
+ **Execution order:** Visual representation
367
+
368
+ **Key decisions affecting roadmap:**
369
+ Reference decisions from DECISIONS.md that affect phase ordering
370
+
371
+ Continue to update_state.
372
+ </step>
373
+
374
+ <step name="update_state">
375
+ Update STATE.md with planning status.
376
+
377
+ **Update STATE.md:**
378
+ - Stage: planning → execution (ready)
379
+ - Planning complete: yes
380
+ - Add planning session to history
381
+
382
+ **Update config.json:**
383
+ ```json
384
+ {
385
+ "stage": "execution",
386
+ "phases": {
387
+ "total": {N},
388
+ "completed": 0,
389
+ "current": 1
390
+ },
391
+ "plans": {
392
+ "total": {N},
393
+ "completed": 0
394
+ }
395
+ }
396
+ ```
397
+
398
+ Continue to commit.
399
+ </step>
400
+
401
+ <step name="commit">
402
+ Commit the plans.
403
+
404
+ ```bash
405
+ git add .specd/features/{feature-name}/ROADMAP.md .specd/features/{feature-name}/plans/ .specd/features/{feature-name}/STATE.md .specd/features/{feature-name}/config.json
406
+ git commit -m "docs({feature-name}): create implementation plans
407
+
408
+ Phases: {N}
409
+ Plans: {N}
410
+
411
+ Phase structure:
412
+ - Phase 1: {name}
413
+ - Phase 2: {name}
414
+ ..."
415
+ ```
416
+
417
+ Continue to completion.
418
+ </step>
419
+
420
+ <step name="completion">
421
+ Present what was created and how to execute.
422
+
423
+ ```
424
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
425
+ PLANS CREATED
426
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
427
+
428
+ **Feature:** {feature-name}
429
+
430
+ ## Structure
431
+
432
+ **Phases:** {N}
433
+ **Plans:** {N total}
434
+
435
+ ### Phase 1: {Name}
436
+ - `plans/phase-01/01-PLAN.md` — {Summary}
437
+ - `plans/phase-01/02-PLAN.md` — {Summary}
438
+
439
+ ### Phase 2: {Name}
440
+ - `plans/phase-02/01-PLAN.md` — {Summary}
441
+
442
+ ...
443
+
444
+ ## Files Created
445
+
446
+ - `.specd/features/{feature-name}/ROADMAP.md`
447
+ - `.specd/features/{feature-name}/plans/phase-01/01-PLAN.md`
448
+ - `.specd/features/{feature-name}/plans/phase-01/02-PLAN.md`
449
+ ...
450
+
451
+ ───────────────────────────────────────────────────────
452
+
453
+ ## How to Execute
454
+
455
+ Each plan is a self-contained prompt. To execute:
456
+
457
+ **Option 1: Sequential execution**
458
+ Read each plan and implement:
459
+ ```
460
+ cat .specd/features/{feature-name}/plans/phase-01/01-PLAN.md
461
+ ```
462
+ Then implement what it describes.
463
+
464
+ **Option 2: Agent execution**
465
+ Give a plan to an implementing agent:
466
+ "Implement the plan in `.specd/features/{feature-name}/plans/phase-01/01-PLAN.md`"
467
+
468
+ **Start with Phase 1, Plan 01.**
469
+
470
+ ───────────────────────────────────────────────────────
471
+
472
+ ## Verification
473
+
474
+ After each plan:
475
+ 1. Run the plan's verification commands
476
+ 2. Commit the changes
477
+ 3. Update STATE.md (or let agent do it)
478
+ 4. Move to next plan
479
+
480
+ After all plans in a phase:
481
+ 1. Run phase success criteria checks
482
+ 2. Mark phase complete in STATE.md
483
+ 3. Move to next phase
484
+ ```
485
+
486
+ End workflow.
487
+ </step>
488
+
489
+ </process>
490
+
491
+ <success_criteria>
492
+ - Feature validated with sufficient context
493
+ - All context loaded and analyzed
494
+ - Phases derived from dependency analysis
495
+ - Tasks are specific (exact files, patterns, verification)
496
+ - Each PLAN.md is a self-contained agent prompt
497
+ - ROADMAP.md provides clear execution path
498
+ - STATE.md updated to execution stage
499
+ - Committed to git
500
+ - User knows how to execute plans
501
+ </success_criteria>