forked from anombyte93/prd-taskmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSKILL.md.pre-codify
More file actions
1342 lines (994 loc) · 36.6 KB
/
Copy pathSKILL.md.pre-codify
File metadata and controls
1342 lines (994 loc) · 36.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
name: prd-taskmaster
description: >-
Smart PRD generator with TaskMaster integration. Detects existing PRDs and offers execute/update/replace options.
Generates comprehensive technical PRDs optimized for task breakdown, validates with 13 automated checks,
and optionally executes tasks autonomously with datetime tracking and rollback support. Use when user requests
"PRD", "product requirements", or mentions task-driven development. Defaults to PRD generation with
handoff to TaskMaster. Optionally supports autonomous execution with 4 modes.
allowed-tools:
- Read
- Write
- Edit
- Grep
- Glob
- Bash
- AskUserQuestion
---
# PRD Generator for TaskMaster v2.0
Smart PRD generation system that detects existing PRDs and offers flexible workflows. Primarily generates comprehensive, engineer-focused product requirements documents optimized for TaskMaster task breakdown. Optionally executes tasks autonomously with quality control, datetime tracking, and validation checkpoints.
## When to Use This Skill
Activate when user:
- Requests a PRD or product requirements document
- Says "I want a PRD", "create requirements", "write requirements"
- Mentions taskmaster or task-driven development
- Asks to document product/feature requirements for engineering
Do NOT activate for:
- Code documentation (API docs, technical reference)
- Test specifications or QA documentation
- Project management timelines without product context
- PDF document creation
## Core Principles
**Quality Over Speed**: Planning is 95% of the work. Take time to create comprehensive PRDs that enable successful implementation.
**Taskmaster Required**: This skill REQUIRES taskmaster (MCP or CLI). Will block and prompt for installation if not detected.
**Engineer-Focused**: Primary audience is engineering teams. Include technical depth, code examples, architecture considerations, and implementation details.
**Validation-Driven**: Automated checks ensure PRD quality before delivery. 13 validation checks run automatically.
**User Testing Checkpoints**: Every 5 tasks, insert user validation checkpoint to catch issues early.
**Complete Automation**: Provides 4 autonomous execution modes with git policies, progress logging, and datetime tracking.
## Workflow Overview (13 Steps)
1. **Enable Plan Mode & Check State** - Resume detection + interactive prompts
2. **Detect Existing PRD** - Smart detection with execute/update/replace options
3. **Detect Taskmaster** - MCP > CLI > Block if missing
4. **Discovery Questions** - 12+ detailed questions (if generating new PRD)
5. **Initialize Taskmaster** - Via MCP/CLI (if not already initialized)
6. **Generate PRD** - Load template and fill with discovery answers
7. **Validate Quality** - 13 automated checks
8. **Parse & Expand** - Combined operation with research
9. **Insert User Tests** - Checkpoint every 5 tasks
10. **Setup Tracking** - DateTime, rollback, accuracy scripts
10.5. **Generate CLAUDE.md** - TDD workflow guide from template
11. **Choose Next Action** - Handoff to TaskMaster OR autonomous execution
12. **Summary & Start** - Present overview and begin work
---
## Detailed Implementation
### Step 1: Enable Plan Mode & Check for Incomplete Work
**FIRST ACTION** when skill activates:
```
1. Check for incomplete work from previous session:
- Run: python3 .taskmaster/scripts/execution-state.py (if exists)
- If incomplete work found: Offer to resume
2. Enable plan mode (if not already enabled):
- This ensures AskUserQuestion tool works properly
- Inform user: "Enabling plan mode for interactive prompts..."
3. Proceed to Step 2
```
**Auto-Resume if Crash Detected:**
```
If execution-state.py reports incomplete work:
🔍 Detected incomplete work from previous session
📍 Last Activity:
- Mode: {mode}
- Task: {task_id}
- Subtask: {subtask_id}
- Last updated: {timestamp}
- Completed: Tasks {completed_list}
Resume from:
1. Last subtask (continue where crashed)
2. Restart current task
3. Last checkpoint
4. Start fresh
Type: 1, 2, 3, or 4
```
---
### Step 2: Detect Existing PRD (Smart Detection)
**SECOND ACTION**: Check if PRD already exists before generating new one.
**Detection Logic:**
```
1. Check if .taskmaster/ exists:
- Use Glob: .taskmaster/
- NO → New project, proceed to Step 3 (detect taskmaster)
- YES → Continue to check for PRD
2. Check for existing PRD:
- Use Glob: .taskmaster/docs/*.md or .taskmaster/docs/prd.*
- Read .taskmaster/tasks/tasks.json to get task count and status
- Found PRD → Show existing PRD options (below)
- No PRD → Proceed to Step 3 (detect taskmaster)
```
**If Existing PRD Found:**
```
🔍 Found existing PRD: {filename}
📄 PRD Details:
- Created: {date from file}
- Location: .taskmaster/docs/{filename}
- Tasks: {X total} ({Y completed}, {Z pending})
- Status: {% complete}
What would you like to do?
1. Execute tasks from existing PRD
→ Skip to Step 11 (choose execution mode)
→ Start working on pending tasks
2. Update/refine existing PRD
→ Edit current PRD with new requirements
→ Re-parse to update tasks
→ Merge with existing task list
3. Create new PRD (replace current)
→ Confirm: "This will replace existing PRD. Continue?"
→ Proceed to Step 3 (full PRD generation workflow)
4. Review existing PRD
→ Show summary of current PRD
→ Display task breakdown
→ Exit skill
Type: 1, 2, 3, or 4
```
**Option 1: Execute Existing Tasks**
```
User selects: 1
✅ Using existing PRD: {filename}
📋 Remaining tasks: {Z} pending tasks
📍 Next checkpoint: {next USER-TEST}
→ Skip to Step 11 (choose execution mode)
```
**Option 2: Update Existing PRD**
```
User selects: 2
📝 What changes would you like to make?
[User provides changes]
✅ Updating PRD...
→ Edit existing PRD file with changes
→ Re-run parse-prd with --append flag
→ Continue to Step 8 (insert user tests for new tasks only)
→ Proceed to Step 11
```
**Option 3: Replace PRD**
```
User selects: 3
⚠️ WARNING: This will replace your existing PRD and task list.
Current work:
- {Y} tasks completed
- {Z} tasks pending
- All completed work will be preserved in git history
- Task files will be regenerated
Type "yes" to confirm replacement, or "no" to cancel.
[If yes]
✅ Creating new PRD (old PRD backed up to .taskmaster/docs/prd-backup-{timestamp}.md)
→ Proceed to Step 3 (full workflow)
```
**Option 4: Review**
```
User selects: 4
📄 Current PRD Summary:
- Title: {title}
- Created: {date}
- Goals: {list top 3 goals}
- Requirements: {count functional requirements}
- Tasks: {X total} ({Y completed}, {Z pending})
[Display executive summary and key sections]
✅ Review complete. Skill exiting.
```
**If No PRD Found (but .taskmaster/ exists):**
```
🔍 Found .taskmaster/ directory (initialized)
📄 No PRD found
Creating PRD for TaskMaster...
→ Proceed to Step 3 (detect taskmaster, already initialized)
```
---
### Step 3: Detect Taskmaster (MANDATORY - Blocks if Missing)
**CRITICAL**: Must detect taskmaster BEFORE proceeding with PRD generation.
**Detection Priority:**
```
1. Check for MCP Task-Master-AI (PREFERRED):
- Attempt: mcp__task-master-ai__get_tasks with projectRoot
- If successful: TASKMASTER_METHOD="MCP" ✅
- Note: MCP provides superior integration (direct function calls)
2. Fallback to CLI:
- Run: which taskmaster
- Run: taskmaster --version
- If found: TASKMASTER_METHOD="CLI" ✅
3. Neither Available:
- TASKMASTER_METHOD="NONE" ❌
- BLOCK and display installation instructions
```
**If Taskmaster Not Found:**
```
⚠️ Taskmaster Required
This skill REQUIRES taskmaster (MCP or CLI) to function properly.
I didn't detect taskmaster in your environment.
Option 1 (RECOMMENDED): Install MCP Task-Master-AI
• Add to Claude Code MCP settings
• Provides seamless integration with direct function calls
• See: https://github.com/cyanheads/task-master-ai
• Installation: Add to your MCP config, restart Claude Code
Option 2: Install CLI
• Run: npm install -g task-master-ai
• Use command-line interface
• See: https://github.com/cyanheads/task-master-ai
Please install taskmaster and type 'done' when ready.
[WAIT for user to install and confirm]
[RE-DETECT after user confirms]
[PROCEED only if detection successful]
```
**NO PROCEEDING WITHOUT TASKMASTER DETECTED**
---
### Step 4: Discovery (Comprehensive Requirements Gathering)
Ask detailed questions to ensure comprehensive PRD:
**Essential Questions (5):**
1. What problem does this solve? (user pain point, business impact)
2. Who is the target user/audience?
3. What is the proposed solution or feature?
4. What are the key success metrics? (how we measure success)
5. What constraints exist? (technical, timeline, resources)
**Technical Context (4):**
6. Is this for an existing codebase or greenfield project?
7. What tech stack? (if known)
8. Any integration requirements? (third-party services, internal systems)
9. Performance/scale requirements? (users, data volume, latency)
**Taskmaster Specific (3):**
10. Have you used taskmaster before? (helps calibrate detail level)
11. What's the estimated complexity? (simple feature, typical project, complex system)
12. Timeline expectations? (helps with phasing and task breakdown)
**Open-Ended (1):**
13. Anything else I should know? (edge cases, constraints, context)
**Smart Defaults:**
- If user provides minimal answers, use best guesses and document assumptions
- Default to comprehensive detail
- Assume engineer audience unless specified otherwise
---
### Step 5: Initialize Taskmaster Project
**CRITICAL**: Initialize ONLY via taskmaster MCP/CLI. NEVER create .taskmaster/ manually.
#### If TASKMASTER_METHOD="MCP":
```
Use mcp__task-master-ai__initialize_project:
- projectRoot: ${PWD} (absolute path)
- yes: true (skip prompts)
- storeTasksInGit: true
- initGit: false (if git already exists)
- skipInstall: false
- rules: ["claude"]
Result: .taskmaster/ structure created by taskmaster
```
#### If TASKMASTER_METHOD="CLI":
```bash
taskmaster init --yes --store-tasks-in-git --rules=claude
```
**Output:**
```
✅ Taskmaster Initialized
Created: .taskmaster/docs/
Created: .taskmaster/tasks/
Created: .taskmaster/reports/
Created: .taskmaster/state/
Updated: .gitignore
```
---
### Step 6: Generate Comprehensive PRD
**IMPORTANT**: Use the PRD template from `templates/` directory as the base structure.
**Template Selection:**
```
1. Read PRD template based on project complexity:
- Complex/Standard projects: Use Read tool to load templates/taskmaster-prd-comprehensive.md
- Simple features: Use Read tool to load templates/taskmaster-prd-minimal.md
2. Template provides:
- Complete section structure with placeholders
- Examples for each section
- Taskmaster-specific hints and formatting
```
**Generation Process:**
```
1. Load template:
- Use Read tool: templates/taskmaster-prd-comprehensive.md (default)
- Or: templates/taskmaster-prd-minimal.md (if user requested minimal)
2. Fill template with user's answers from Step 4:
- Replace [placeholders] with actual content
- Expand examples with project-specific details
- Add technical depth based on discovery answers
3. Write completed PRD:
- Output to: .taskmaster/docs/prd.md
- Preserve template structure and formatting
```
**Template contains 12 sections:**
1. Executive Summary
2. Problem Statement
3. Goals & Success Metrics
4. User Stories
5. Functional Requirements
6. Non-Functional Requirements
7. Technical Considerations
8. Implementation Roadmap
9. Out of Scope
10. Open Questions & Risks
11. Validation Checkpoints
12. Appendix: Task Breakdown Hints
**Output:**
```
✅ PRD Generated from template
Template: taskmaster-prd-comprehensive.md
Output: .taskmaster/docs/prd.md
Sections: 12 (all populated)
```
---
### Step 7: Validate PRD Quality (13 Automated Checks)
**Required Elements (5 checks):**
1. ✅ Executive summary exists (2-3 sentences)
2. ✅ Problem statement includes user AND business impact
3. ✅ All goals have SMART metrics (Specific, Measurable, Achievable, Relevant, Time-bound)
4. ✅ User stories have acceptance criteria (minimum 3 per story)
5. ✅ Out of scope explicitly defined
**Functional Requirements (3 checks):**
6. ✅ All functional requirements are testable (not vague)
7. ✅ Each requirement has priority (Must/Should/Could)
8. ✅ Requirements are numbered (REQ-001, REQ-002, etc.)
**Technical Considerations (2 checks):**
9. ✅ Technical considerations address architecture
10. ✅ Non-functional requirements include specific targets (not "fast" but "< 200ms p95")
**Taskmaster-Specific (3 checks):**
11. ✅ Requirements have task breakdown hints
12. ✅ Dependencies identified for task sequencing
13. ✅ Acceptance criteria are concrete (can become task completion checks)
**Validation Output:**
```
✅ PRD Quality Validation: 13/13 PASSED
✅ All required elements present
✅ All functional requirements testable
✅ Taskmaster optimization complete
Quality Score: 60/60 (EXCELLENT)
Safe to proceed with task generation.
OR
⚠️ PRD Quality Validation: 11/13 (2 warnings)
✅ Required elements: 5/5
✅ Functional requirements: 3/3
✅ Technical considerations: 2/2
⚠️ Taskmaster optimization: 1/3
Warnings:
- REQ-007: "should be performant" is vague
Suggestion: Replace with "< 200ms response time for 95th percentile"
- User Story 2: Only 2 acceptance criteria (minimum 3 recommended)
Suggestion: Add edge case criterion
Quality Score: 55/60 (GOOD - minor improvements suggested)
```
---
### Step 8: Parse PRD & Expand Tasks (Single Combined Operation)
**IMPORTANT**: Combine parse-prd + expand-all with research into ONE operation.
**Auto-Calculate Task Count:**
```
numTasks = (count of functional requirements × 1.5) rounded
Minimum: 10 tasks
Maximum: 40 tasks
```
#### If TASKMASTER_METHOD="MCP":
```
1. Parse PRD with research:
Use mcp__task-master-ai__parse_prd:
- projectRoot: ${PWD}
- input: ".taskmaster/docs/prd.md"
- numTasks: Auto-calculated based on requirements count
- research: true (ALWAYS use research for better quality)
- append: false
2. Immediately expand ALL tasks with research:
Use mcp__task-master-ai__expand_all:
- projectRoot: ${PWD}
- research: true (ALWAYS use research)
- force: false
```
#### If TASKMASTER_METHOD="CLI":
```bash
# Combined operation:
taskmaster parse-prd --input .taskmaster/docs/prd.md --research --num-tasks auto && \
taskmaster expand-all --research
```
**Result:**
```
✅ Tasks Generated: 22 tasks from PRD
✅ Tasks Expanded: 94 subtasks created
- Phase 1: 5 tasks, 18 subtasks
- Phase 2: 6 tasks, 28 subtasks
- Phase 3: 5 tasks, 22 subtasks
- Phase 4: 4 tasks, 18 subtasks
- Phase 5: 2 tasks, 8 subtasks
```
---
### Step 9: Insert User Testing Tasks (Every 5 Tasks)
**CRITICAL NEW REQUIREMENT**: After tasks are expanded, insert user-facing testing tasks.
**Logic:**
```
For every 5 tasks:
- Insert a new task: "USER-TEST-{N}"
- Title: "User Validation Checkpoint {N}"
- Description: "Manually test functionality from Tasks {start} to {end}"
Example:
- TASK-001 to TASK-005 → Insert USER-TEST-1 after TASK-005
- TASK-006 to TASK-010 → Insert USER-TEST-2 after TASK-010
```
**User Testing Task Template:**
```markdown
# USER-TEST-{N}: User Validation Checkpoint {N}
## Purpose
Manual testing of functionality implemented in Tasks {start}-{end}
## Prerequisites
All subtasks in Tasks {start}-{end} must be completed and merged to main branch.
## Testing Checklist
### Functionality Tests
[For each requirement covered in these 5 tasks, add:]
- [ ] Test Requirement REQ-{X}: [Description]
- Expected: [What should happen]
- Actual: [User fills in]
### Integration Tests
- [ ] Test integration between components
- [ ] Verify no regressions in existing features
### Performance Tests
- [ ] Measure response time (should be < [target])
- [ ] Test under expected load
## Acceptance Criteria
- ✅ All functionality tests pass
- ✅ No critical bugs found
- ✅ Performance meets targets
## If Tests Fail
1. Document issue in .taskmaster/docs/progress.md
2. Type "issues" and describe what failed
3. I'll create fix tasks before proceeding
4. Do NOT continue to next tasks until fixed
## When Complete
Type "passed" to continue to next tasks.
```
**Implementation:**
#### If TASKMASTER_METHOD="MCP":
```
Use mcp__task-master-ai__add_task for each checkpoint:
- projectRoot: ${PWD}
- title: "User Validation Checkpoint {N}"
- description: "Manually test functionality from Tasks {start} to {end}"
- details: [Full testing checklist template above]
- dependencies: "{end}" (depends on last task in group)
- priority: "high"
```
#### If TASKMASTER_METHOD="CLI":
```bash
taskmaster add-task \
--title="User Validation Checkpoint {N}" \
--description="Manual testing checkpoint" \
--dependencies="{end}" \
--priority=high
```
**Result:**
```
✨ Inserted user validation checkpoints:
✅ USER-TEST-1 (after Task 5)
✅ USER-TEST-2 (after Task 10)
✅ USER-TEST-3 (after Task 15)
✅ USER-TEST-4 (after Task 20)
📊 Updated task count: 26 tasks (22 implementation + 4 user tests)
```
---
### Step 10: Setup Tracking Scripts
Create automation scripts in `.taskmaster/scripts/`:
**Scripts to Create:**
1. **track-time.py** - Real datetime tracking with UTC timestamps
2. **rollback.sh** - Git rollback to any task checkpoint
3. **learn-accuracy.py** - Estimation accuracy learning
4. **security-audit.py** - Auto-generate security checklist
5. **execution-state.py** - Crash recovery state management
**All scripts are included in this skill's implementation and will be auto-generated.**
See sections below for complete script implementations.
---
### Step 10.5: Generate CLAUDE.md (TDD Workflow Guide)
**IMPORTANT**: Generate a TDD workflow guide for the project using the template, but only if one doesn't already exist.
**Pre-Check (REQUIRED):**
```
1. Check if CLAUDE.md already exists:
- Use Glob tool: ./CLAUDE.md
- If EXISTS → Skip generation, show message:
"ℹ️ CLAUDE.md already exists. Skipping generation to preserve your configuration."
- If NOT EXISTS → Proceed with generation
2. Check if codex.md already exists (for later):
- Use Glob tool: ./codex.md
- Store result for Step 4 below
```
**Template Loading (only if CLAUDE.md doesn't exist):**
```
1. Read the CLAUDE.md template:
- Use Read tool: templates/CLAUDE.md.template
2. Template contains:
- TDD workflow instructions (RED → GREEN → REFACTOR)
- Taskmaster integration commands
- Agent usage guidelines
- Validation & quality gates
- Project-specific placeholders
```
**Placeholder Replacement:**
```
Replace these placeholders with project-specific values from Step 4 discovery:
{{PROJECT_NAME}} → User's project/feature name
{{TECH_STACK}} → Tech stack from discovery (e.g., "React, Node.js, PostgreSQL")
{{ARCHITECTURE_OVERVIEW}} → Brief architecture description
{{KEY_DEPENDENCIES}} → Main dependencies identified
{{TESTING_FRAMEWORK}} → Testing framework (e.g., "Jest", "Vitest", "pytest")
{{DEV_ENVIRONMENT}} → Development environment setup
{{TEST_COMMAND}} → Test command (e.g., "npm test", "pytest")
```
**Generation Process:**
```
1. Pre-check: Skip if CLAUDE.md exists (see Pre-Check above)
2. Load template:
- Use Read tool: templates/CLAUDE.md.template
3. Fill placeholders with discovery answers:
- If value unknown, use sensible default or "[To be configured]"
4. Write to project root:
- Output to: ./CLAUDE.md (project root)
5. Ask about Codex (only if codex.md doesn't exist):
- Use AskUserQuestion: "Are you using Codex in addition to Claude Code?"
- If yes AND codex.md doesn't exist: Also write to ./codex.md (identical content)
- If codex.md exists: Skip, show "ℹ️ codex.md already exists."
```
**Output:**
```
[If CLAUDE.md doesn't exist]
✅ CLAUDE.md Generated
Template: templates/CLAUDE.md.template
Output: ./CLAUDE.md
Contains: TDD workflow, taskmaster integration, quality gates
[If CLAUDE.md exists]
ℹ️ CLAUDE.md already exists - skipped generation
[If Codex selected AND codex.md doesn't exist]
✅ codex.md Generated (identical to CLAUDE.md)
Output: ./codex.md
[If codex.md exists]
ℹ️ codex.md already exists - skipped generation
```
---
---
### Step 11: Choose Next Action (Handoff vs Autonomous Execution)
**CRITICAL CHOICE**: After PRD and tasks are ready, ask user how they want to proceed.
**Use AskUserQuestion tool** to present two main options:
```
Use AskUserQuestion:
questions:
- question: "Your PRD and tasks are ready. How would you like to proceed?"
header: "Next Action"
multiSelect: false
options:
- label: "Show TaskMaster Commands"
description: "Hand off to TaskMaster. I'll show you the commands to run tasks manually. Full control."
- label: "Autonomous Execution"
description: "I'll execute tasks for you autonomously with 4 execution modes to choose from."
```
**Option A: Handoff to TaskMaster (DEFAULT)**
If user selects "Show TaskMaster Commands":
```
✅ PRD Complete: .taskmaster/docs/prd.md
📋 Tasks Ready: {X} tasks ({Y} subtasks)
📍 Next checkpoint: {next USER-TEST}
🚀 TaskMaster Commands (Use these to work on tasks):
Sequential Execution:
taskmaster next-task # Get next available task
taskmaster get-task {id} # Work on specific task
taskmaster set-task-status {id} --status=done
Parallel Execution (for independent tasks):
taskmaster get-tasks --status=pending --with-subtasks
# Work on multiple tasks simultaneously
Progress Tracking:
taskmaster get-tasks --with-subtasks # See all tasks
python3 .taskmaster/scripts/track-time.py start {task_id}
python3 .taskmaster/scripts/track-time.py complete {task_id}
Quality & Safety:
bash .taskmaster/scripts/rollback.sh {task_id} # Rollback to checkpoint
python3 .taskmaster/scripts/security-audit.py # Security check
📚 Documentation:
- PRD: .taskmaster/docs/prd.md
- Tasks: .taskmaster/tasks/
- Progress: .taskmaster/docs/progress.md
💡 Tip: Use TaskMaster MCP tools for the best experience!
Ready to start? Run: taskmaster next-task
```
Then EXIT the skill (skill complete).
---
**Option B: Autonomous Execution**
If user selects "Autonomous Execution":
Ask follow-up question with 4 execution modes:
```
Use AskUserQuestion:
questions:
- question: "Select autonomous execution mode:"
header: "Execution Mode"
multiSelect: false
options:
- label: "Sequential to Checkpoint"
description: "Work autonomously until next user test. Stops for validation. RECOMMENDED for quality control."
- label: "Parallel to Checkpoint"
description: "Run independent tasks in parallel until next user test. Faster execution."
- label: "Full Autonomous"
description: "Run ALL tasks in parallel without stopping. ⚠️ Skips user validation."
- label: "Manual Control"
description: "You decide which tasks to run. Full control over execution."
```
**Execution Mode Details:**
**Mode 1: Sequential to Checkpoint**
- Executes tasks one-by-one until next USER-TEST
- Stops for user validation
- Best for quality control
- RECOMMENDED for first-time features
**Mode 2: Parallel to Checkpoint**
- Executes independent tasks in parallel
- Stops at next USER-TEST
- Faster execution
- Good for experienced users
**Mode 3: Full Autonomous**
- Runs ALL tasks in parallel without stopping
- Auto-completes USER-TEST tasks
- Fastest execution
- WARNING: Skips manual validation
**Mode 4: Manual Control**
- User decides which tasks to run
- Full control over execution
- No autonomous execution
**All execution modes include:**
- Strict git branching policies (branch per task, sub-branch per subtask)
- Commit checkpoints after every task
- Progress logging to .taskmaster/docs/progress.md
- Datetime tracking with track-time.py
- Autonomous execution (no user input except at checkpoints)
**After mode selected:**
1. Store their selection
2. Output the corresponding full execution prompt
3. Recognize if user types "begin" or "start"
4. Begin autonomous execution
**Claude Recommendation:**
Based on context, recommend the best option:
- First-time feature OR critical system → Mode 1 (Sequential)
- Experienced user OR non-critical → Mode 2 (Parallel)
- Trusted implementation OR time-critical → Mode 3 (Full)
- Complex requirements OR learning → Mode 4 (Manual)
Display recommendation: "⭐ Claude Recommends: Mode {N}"
See full execution prompt templates in "EXECUTION PROMPT TEMPLATES" section below.
---
### Step 12: Present Final Summary
**Summary depends on the path taken:**
---
**If Handoff to TaskMaster (Step 11 Option A):**
```
✅ PRD COMPLETE
📄 PRD Created: .taskmaster/docs/prd.md
✅ Taskmaster Initialized: Using {MCP/CLI}
📋 Tasks Generated: {X} tasks ({Y} implementation + {Z} user tests)
🔄 Tasks Expanded: {N} subtasks
📊 Scripts Created: .taskmaster/scripts/ (5 automation scripts)
📊 Overview:
- Feature: {name}
- Complexity: {Simple/Medium/Complex}
- Estimated Effort: {X} tasks, ~{Y} hours
- Key Goal: {primary success metric}
🎯 Key Requirements:
1. {Top functional requirement}
2. {Second functional requirement}
3. {Third functional requirement}
⚠️ Quality Validation: {score}/60
✅ All 13 validation checks passed
📋 Task Breakdown:
- Phase 1: {X} tasks
- Phase 2: {X} tasks
- Phase 3: {X} tasks
- Phase 4: {X} tasks
👤 User Testing Checkpoints:
- USER-TEST-1: After Task {N}
- USER-TEST-2: After Task {N}
- USER-TEST-3: After Task {N}
🚀 Next Steps:
Run: taskmaster next-task
Or use TaskMaster MCP tools to manage tasks.
See commands above for full TaskMaster usage.
✨ PRD generation complete! Ready to build.
```
Then EXIT skill.
---
**If Autonomous Execution (Step 11 Option B):**
```
✅ PRD COMPLETE - STARTING AUTONOMOUS EXECUTION
📄 PRD: .taskmaster/docs/prd.md
✅ Taskmaster: Using {MCP/CLI}
📋 Tasks: {X} tasks ({Y} implementation + {Z} user tests)
🔄 Subtasks: {N} subtasks
📊 Scripts: Ready (.taskmaster/scripts/)
📊 Overview:
- Feature: {name}
- Complexity: {Simple/Medium/Complex}
- Mode: {Selected execution mode}
- Next Checkpoint: {next USER-TEST}
⚠️ Quality: {score}/60 ✅
🚀 Execution Starting!
Selected: {execution mode name}
[If Sequential/Parallel:]
Next: Tasks {start}-{end} → USER-TEST-{N}
Working autonomously until checkpoint...
[If Full Autonomous:]
All {X} tasks will execute in parallel
Working autonomously until complete...
[If Manual:]
Awaiting your commands...
Type "begin" or "start" to execute!
```
Then PROCEED to autonomous execution using the selected mode's prompt template (see EXECUTION PROMPT TEMPLATES section).
---
## TOP 5 ENHANCEMENTS
### Enhancement 1: Real DateTime Tracking (B2)
**Script: `.taskmaster/scripts/track-time.py`**
Created automatically during Step 8.
**Features:**
- UTC timestamp tracking (start/end)
- Precise duration calculation
- JSON state persistence
- CLI interface for easy use
**Usage in Execution:**
```bash
# Before task starts:
python3 .taskmaster/scripts/track-time.py start {task_id}
# Before subtask starts:
python3 .taskmaster/scripts/track-time.py start {task_id} {subtask_id}
# After subtask completes:
python3 .taskmaster/scripts/track-time.py complete {task_id} {subtask_id}
# After task completes:
python3 .taskmaster/scripts/track-time.py complete {task_id}
```
**Output:**
```
📅 Started: 2025-01-29 14:23:15 UTC
[... work happens ...]
✅ COMPLETED
📅 Ended: 2025-01-29 14:41:32 UTC
⏱️ Actual: 18 min (18.3 min)
📊 vs Estimate: 18 min - Within 2% ✅
```
See TOP_5_ADDITIONS.md for complete script code.
---
### Enhancement 2: Instant Rollback Command (A1)
**Script: `.taskmaster/scripts/rollback.sh`**