@codeharbor/agent-playbook 0.1.0 → 0.1.2

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.
Files changed (114) hide show
  1. package/README.md +4 -2
  2. package/package.json +5 -2
  3. package/skills/api-designer/README.md +36 -0
  4. package/skills/api-designer/SKILL.md +232 -0
  5. package/skills/api-designer/references/graphql-patterns.md +12 -0
  6. package/skills/api-designer/references/rest-patterns.md +17 -0
  7. package/skills/api-designer/scripts/generate_api.py +87 -0
  8. package/skills/api-designer/scripts/validate_api.py +48 -0
  9. package/skills/api-documenter/README.md +41 -0
  10. package/skills/api-documenter/SKILL.md +209 -0
  11. package/skills/api-documenter/references/examples/README.md +3 -0
  12. package/skills/api-documenter/references/examples/openapi-example.yaml +10 -0
  13. package/skills/api-documenter/references/openapi-template.yaml +5 -0
  14. package/skills/api-documenter/scripts/generate_openapi.py +84 -0
  15. package/skills/api-documenter/scripts/validate_openapi.py +45 -0
  16. package/skills/architecting-solutions/README.md +22 -0
  17. package/skills/architecting-solutions/SKILL.md +459 -0
  18. package/skills/auto-trigger/README.md +23 -0
  19. package/skills/auto-trigger/SKILL.md +183 -0
  20. package/skills/code-reviewer/README.md +59 -0
  21. package/skills/code-reviewer/SKILL.md +220 -0
  22. package/skills/code-reviewer/references/checklist.md +80 -0
  23. package/skills/code-reviewer/references/patterns.md +226 -0
  24. package/skills/code-reviewer/references/security.md +88 -0
  25. package/skills/code-reviewer/scripts/review_checklist.py +191 -0
  26. package/skills/commit-helper/README.md +58 -0
  27. package/skills/commit-helper/SKILL.md +159 -0
  28. package/skills/commit-helper/references/conventional-commits.md +68 -0
  29. package/skills/commit-helper/references/examples.md +125 -0
  30. package/skills/commit-helper/references/scopes.md +49 -0
  31. package/skills/commit-helper/scripts/validate_commit.py +70 -0
  32. package/skills/create-pr/README.md +182 -0
  33. package/skills/create-pr/SKILL.md +340 -0
  34. package/skills/debugger/README.md +53 -0
  35. package/skills/debugger/SKILL.md +239 -0
  36. package/skills/debugger/references/checklist.md +7 -0
  37. package/skills/debugger/references/errors.md +6 -0
  38. package/skills/debugger/references/patterns.md +5 -0
  39. package/skills/debugger/scripts/debug_report.py +77 -0
  40. package/skills/deployment-engineer/README.md +40 -0
  41. package/skills/deployment-engineer/SKILL.md +242 -0
  42. package/skills/deployment-engineer/references/kubernetes.md +23 -0
  43. package/skills/deployment-engineer/references/monitoring.md +14 -0
  44. package/skills/deployment-engineer/references/pipelines.md +12 -0
  45. package/skills/deployment-engineer/scripts/generate_deploy.py +72 -0
  46. package/skills/deployment-engineer/scripts/validate_deploy.py +46 -0
  47. package/skills/documentation-engineer/README.md +41 -0
  48. package/skills/documentation-engineer/SKILL.md +164 -0
  49. package/skills/documentation-engineer/references/api-template.md +22 -0
  50. package/skills/documentation-engineer/references/readme-template.md +25 -0
  51. package/skills/documentation-engineer/references/style-guide.md +13 -0
  52. package/skills/documentation-engineer/scripts/generate_docs.py +68 -0
  53. package/skills/documentation-engineer/scripts/validate_docs.py +46 -0
  54. package/skills/figma-designer/README.md +222 -0
  55. package/skills/figma-designer/SKILL.md +407 -0
  56. package/skills/figma-designer/references/example-output.md +86 -0
  57. package/skills/performance-engineer/README.md +42 -0
  58. package/skills/performance-engineer/SKILL.md +236 -0
  59. package/skills/performance-engineer/references/checklist.md +6 -0
  60. package/skills/performance-engineer/references/monitoring.md +5 -0
  61. package/skills/performance-engineer/references/optimization.md +7 -0
  62. package/skills/performance-engineer/scripts/perf_report.py +64 -0
  63. package/skills/performance-engineer/scripts/profile.py +63 -0
  64. package/skills/planning-with-files/README.md +27 -0
  65. package/skills/planning-with-files/SKILL.md +103 -0
  66. package/skills/prd-implementation-precheck/README.md +97 -0
  67. package/skills/prd-implementation-precheck/SKILL.md +112 -0
  68. package/skills/prd-planner/README.md +102 -0
  69. package/skills/prd-planner/SKILL.md +449 -0
  70. package/skills/prd-planner/references/edge-case-analysis.md +111 -0
  71. package/skills/qa-expert/README.md +37 -0
  72. package/skills/qa-expert/SKILL.md +225 -0
  73. package/skills/qa-expert/references/gates.md +11 -0
  74. package/skills/qa-expert/references/metrics.md +6 -0
  75. package/skills/qa-expert/references/strategy.md +11 -0
  76. package/skills/qa-expert/scripts/coverage_analysis.py +61 -0
  77. package/skills/qa-expert/scripts/generate_test_plan.py +68 -0
  78. package/skills/refactoring-specialist/README.md +37 -0
  79. package/skills/refactoring-specialist/SKILL.md +283 -0
  80. package/skills/refactoring-specialist/references/checklist.md +6 -0
  81. package/skills/refactoring-specialist/references/smells.md +6 -0
  82. package/skills/refactoring-specialist/references/techniques.md +6 -0
  83. package/skills/security-auditor/README.md +48 -0
  84. package/skills/security-auditor/SKILL.md +256 -0
  85. package/skills/security-auditor/references/checklist.md +7 -0
  86. package/skills/security-auditor/references/owasp.md +12 -0
  87. package/skills/security-auditor/references/remediation.md +7 -0
  88. package/skills/security-auditor/scripts/find_secrets.py +58 -0
  89. package/skills/security-auditor/scripts/security_audit.py +64 -0
  90. package/skills/self-improving-agent/README.md +136 -0
  91. package/skills/self-improving-agent/SKILL.md +407 -0
  92. package/skills/self-improving-agent/hooks/post-bash.sh +10 -0
  93. package/skills/self-improving-agent/hooks/pre-tool.sh +10 -0
  94. package/skills/self-improving-agent/hooks/session-end.sh +4 -0
  95. package/skills/self-improving-agent/memory/semantic-patterns.json +288 -0
  96. package/skills/self-improving-agent/references/appendix.md +131 -0
  97. package/skills/self-improving-agent/templates/correction-template.md +11 -0
  98. package/skills/self-improving-agent/templates/pattern-template.md +15 -0
  99. package/skills/self-improving-agent/templates/validation-template.md +14 -0
  100. package/skills/session-logger/README.md +50 -0
  101. package/skills/session-logger/SKILL.md +156 -0
  102. package/skills/skill-router/README.md +155 -0
  103. package/skills/skill-router/SKILL.md +215 -0
  104. package/skills/test-automator/README.md +41 -0
  105. package/skills/test-automator/SKILL.md +202 -0
  106. package/skills/test-automator/references/best-practices.md +6 -0
  107. package/skills/test-automator/references/examples/README.md +3 -0
  108. package/skills/test-automator/references/examples/unit-test-example.md +8 -0
  109. package/skills/test-automator/references/mocking.md +5 -0
  110. package/skills/test-automator/scripts/coverage_report.py +59 -0
  111. package/skills/test-automator/scripts/generate_test.py +66 -0
  112. package/skills/workflow-orchestrator/README.md +20 -0
  113. package/skills/workflow-orchestrator/SKILL.md +342 -0
  114. package/src/cli.js +107 -20
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: prd-implementation-precheck
3
+ description: Implement PRDs/specs with a mandatory precheck review before coding. Use when a user asks to implement a PRD/feature spec/requirements doc or says "implement PRD/spec". Perform a preflight review, raise questions on scope/consistency/risks, then implement after confirmation.
4
+ ---
5
+
6
+ # PRD Implementation Precheck
7
+
8
+ ## Overview
9
+
10
+ Perform a short PRD precheck, present issues and questions, then implement only after the user confirms or adjusts the PRD.
11
+
12
+ ## Workflow
13
+
14
+ 1. Locate the PRD and any referenced files.
15
+ 2. Precheck the PRD and summarize intent in 1-2 sentences.
16
+ 3. List findings and questions (blockers first), then ask for confirmation to proceed.
17
+ 4. After confirmation, implement the PRD with minimal, consistent changes.
18
+ 5. Validate (tests or manual steps) or state what was not run.
19
+
20
+ ## Precheck Checklist
21
+
22
+ ### Basic Checks
23
+
24
+ - **Scope**: Identify over-broad changes; suggest a smaller, targeted approach.
25
+ - **Alignment**: Flag conflicts with existing patterns or architecture; propose alternatives.
26
+ - **Dependencies**: Note missing hooks/providers/data sources or unclear ownership.
27
+ - **Behavior**: Verify flows and edge cases are specified; ask for gaps.
28
+ - **Risks**: Call out performance, regressions, or migration risks.
29
+ - **Testing**: Check success criteria and test coverage; request specifics if vague.
30
+
31
+ ### Edge Case Coverage Checks
32
+
33
+ Verify the PRD addresses these edge cases (mark as ⚠️ if missing):
34
+
35
+ #### Data Boundaries
36
+ - [ ] **Null/Empty handling** - What happens with empty inputs or null values?
37
+ - [ ] **Boundary values** - Are min/max limits defined? What happens at boundaries?
38
+ - [ ] **Duplicate data** - How are duplicates detected and handled?
39
+ - [ ] **Data format** - Are input formats validated? What about special characters?
40
+
41
+ #### State Boundaries
42
+ - [ ] **State transitions** - Are all valid state transitions defined?
43
+ - [ ] **Invalid transitions** - What happens on illegal state changes?
44
+ - [ ] **Concurrent modifications** - How are simultaneous edits handled?
45
+ - [ ] **Rollback scenarios** - Can operations be undone? How?
46
+
47
+ #### Error Boundaries
48
+ - [ ] **Network failures** - What happens when API calls fail?
49
+ - [ ] **Timeout behavior** - Are timeouts defined? What's the retry strategy?
50
+ - [ ] **Partial failures** - If step 2 of 3 fails, what happens to step 1?
51
+ - [ ] **Error messages** - Are user-facing error messages defined?
52
+
53
+ #### UX Boundaries
54
+ - [ ] **Empty states** - What does the user see with no data?
55
+ - [ ] **Loading states** - How is loading indicated?
56
+ - [ ] **Success feedback** - How does the user know the action succeeded?
57
+ - [ ] **Permission denied** - What happens when user lacks permission?
58
+
59
+ ### Codebase Consistency Checks
60
+
61
+ Scan the codebase to verify PRD aligns with existing patterns:
62
+
63
+ ```bash
64
+ # Check if PRD's proposed patterns match existing code
65
+ grep -r "pattern_from_prd" src/ --include="*.ts"
66
+ ```
67
+
68
+ - [ ] **Delete strategy** - Does PRD match existing soft/hard delete pattern?
69
+ - [ ] **Error handling** - Does PRD use the same error display mechanism?
70
+ - [ ] **Component reuse** - Does PRD leverage existing components?
71
+ - [ ] **API patterns** - Does PRD follow existing API conventions?
72
+
73
+ ## Output Format
74
+
75
+ ### Precheck Report Template
76
+
77
+ ```markdown
78
+ ## PRD Precheck Report
79
+
80
+ ### Summary
81
+ {1-2 sentence summary of what the PRD aims to achieve}
82
+
83
+ ### ✅ Covered Edge Cases
84
+ - {List edge cases that are well-defined in the PRD}
85
+
86
+ ### ⚠️ Missing Edge Cases
87
+ | Edge Case | Category | Suggested Default | Needs Confirmation |
88
+ |-----------|----------|-------------------|-------------------|
89
+ | Empty list display | UX | Use existing EmptyState | No |
90
+ | Concurrent edit | State | Last write wins | **Yes** |
91
+
92
+ ### 🔴 Blockers
93
+ - {Critical issues that must be resolved before implementation}
94
+
95
+ ### 🟡 Warnings
96
+ - {Non-critical issues that should be addressed}
97
+
98
+ ### Questions for User
99
+ 1. {Specific question about missing edge case}
100
+ 2. {Specific question about ambiguous requirement}
101
+
102
+ ---
103
+
104
+ **Proceed as-is, or update the PRD?**
105
+ ```
106
+
107
+ ## Output Expectations
108
+
109
+ - Provide a concise precheck report with questions and risks.
110
+ - Ask explicitly: "Proceed as-is, or update the PRD?"
111
+ - If no blockers, state assumptions and continue only with user approval.
112
+
@@ -0,0 +1,102 @@
1
+ # PRD Planner
2
+
3
+ A PRD creation skill that uses persistent file-based planning to maintain coherent thinking and avoid context switching issues.
4
+
5
+ ## Overview
6
+
7
+ PRD Planner combines PRD methodology with file-based persistence (planning-with-files) to create a single, coherent workflow that doesn't lose context during PRD creation.
8
+
9
+ ## The Problem
10
+
11
+ Traditional PRD creation suffers from:
12
+ - **Context switching** - Requirements in memory, then forgotten
13
+ - **Lost thoughts** - Research findings not captured
14
+ - **"Left brain vs right brain"** - Different thinking modes conflict
15
+ - **Inconsistent output** - Each PRD looks different
16
+
17
+ ## The Solution
18
+
19
+ Use a 4-file pattern that persists all thinking. Pick a SCOPE (short, unique, kebab-case slug) and prefix all files:
20
+
21
+ ```text
22
+ docs/{scope}-prd-task-plan.md → Progress tracking
23
+ docs/{scope}-prd-notes.md → Research & requirements
24
+ docs/{scope}-prd.md → Final PRD output
25
+ docs/{scope}-tech.md → Technical design output
26
+ ```
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ # Create symbolic link to global skills directory
32
+ ln -s ~/Documents/code/GitHub/agent-playbook/skills/prd-planner/SKILL.md ~/.claude/skills/prd-planner.md
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ # Simply ask for a PRD
39
+ "Create a PRD for user authentication"
40
+
41
+ # The skill will:
42
+ # 1. Create 4 files in docs/
43
+ # 2. Gather requirements (saved to notes)
44
+ # 3. Research best practices (saved to notes)
45
+ # 4. Design architecture (saved to notes)
46
+ # 5. Synthesize into PRD (reads from notes)
47
+ # 6. Write technical design (reads from notes)
48
+ # 7. Validate with you
49
+ ```
50
+
51
+ ## Workflow
52
+
53
+ ```
54
+ ┌─────────────────────────────────────────────────────────────────┐
55
+ │ PRD Creation Workflow │
56
+ ├─────────────────────────────────────────────────────────────────┤
57
+ │ │
58
+ │ 1. Initialize → Create 4 files with template │
59
+ │ 2. Requirements → Gather to {scope}-prd-notes.md │
60
+ │ 3. Analysis → Research best practices, save to notes │
61
+ │ 4. Design → Propose architecture, save to notes │
62
+ │ 5. Synthesize → Read notes, write PRD, update plan │
63
+ │ 6. Tech → Write technical design from notes │
64
+ │ 7. Validate → Review with user, finalize │
65
+ │ │
66
+ └─────────────────────────────────────────────────────────────────┘
67
+ ```
68
+
69
+ ## File Structure
70
+
71
+ ```
72
+ docs/
73
+ ├── {scope}-prd-task-plan.md # Progress tracking with checkboxes
74
+ ├── {scope}-prd-notes.md # All research and requirements
75
+ ├── {scope}-prd.md # Final polished PRD
76
+ └── {scope}-tech.md # Technical design
77
+ ```
78
+
79
+ ## Key Principles
80
+
81
+ | Principle | Implementation |
82
+ |-----------|----------------|
83
+ | Filesystem as memory | Store in files, not context |
84
+ | Always read before deciding | Read {scope}-prd-notes.md before design decisions |
85
+ | Update plan after phases | Checkboxes and timestamps in {scope}-prd-task-plan.md |
86
+ | One coherent workflow | Single skill, no context switching |
87
+
88
+ ## Activation
89
+
90
+ This skill activates when user says:
91
+ - "Create a PRD..."
92
+ - "PRD for..."
93
+ - "产品需求文档"
94
+ - "Product requirements document"
95
+
96
+ **Different from:**
97
+ - `architecting-solutions` - For "design solution" or "architecture design"
98
+ - `planning-with-files` - For general task planning (not PRD-specific)
99
+
100
+ ## License
101
+
102
+ MIT
@@ -0,0 +1,449 @@
1
+ ---
2
+ name: prd-planner
3
+ description: Creates PRDs using persistent file-based planning. Use when user explicitly says "PRD", "product requirements document", or "产品需求文档". Combines PRD methodology with planning-with-files to avoid context switching.
4
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion, WebSearch
5
+ hooks:
6
+ after_complete:
7
+ - trigger: self-improving-agent
8
+ mode: background
9
+ reason: "Extract patterns and improve PRD quality"
10
+ - trigger: session-logger
11
+ mode: auto
12
+ reason: "Save session context"
13
+ ---
14
+
15
+ # PRD Planner
16
+
17
+ A PRD creation skill that uses persistent file-based planning to maintain coherent thinking and avoid "left-brain vs right-brain" context switching issues.
18
+
19
+ ## When This Skill Activates
20
+
21
+ This skill activates when you:
22
+ - Explicitly say "PRD", "prd", "create a PRD", or "产品需求文档"
23
+ - Say "product requirements document" or "产品需求"
24
+ - Mention "write a PRD for..."
25
+ - Say "PRD planning" or "PRD 设计"
26
+
27
+ **If user says "design solution" or "architecture design" without mentioning PRD, use `architecting-solutions` instead.**
28
+
29
+ ## The Core Philosophy
30
+
31
+ > "PRD creation should be traceable, coherent, and persistent - not scattered across context switches."
32
+
33
+ This skill combines:
34
+ - **PRD methodology** (from architecting-solutions)
35
+ - **File-based persistence** (from planning-with-files)
36
+
37
+ To create a single, coherent PRD creation workflow that doesn't lose context.
38
+
39
+ ## 4-File Pattern for PRD Creation
40
+
41
+ For every PRD project, create FOUR files:
42
+
43
+ Pick a SCOPE (short, unique, kebab-case slug) and use it as a prefix for all files.
44
+
45
+ ```text
46
+ docs/{scope}-prd-notes.md → Store research, requirements, findings, options
47
+ docs/{scope}-prd-task-plan.md → Track PRD creation phases and progress
48
+ docs/{scope}-prd.md → Product requirements (what & why)
49
+ docs/{scope}-tech.md → Technical design (how)
50
+ ```
51
+
52
+ ### File Purposes
53
+
54
+ | File | Purpose | Audience | Updated When |
55
+ |------|---------|----------|--------------|
56
+ | `{scope}-prd-notes.md` | Raw research, requirements, architecture options (A/B/C) | Self + reviewers | New information gathered |
57
+ | `{scope}-prd-task-plan.md` | Track progress, phases, checkboxes, timestamps | PM + dev lead | Each phase completion |
58
+ | `{scope}-prd.md` | Product requirements (what & why), user flows | PM + stakeholders + devs | After requirements are clear |
59
+ | `{scope}-tech.md` | Technical design (API, data flow, implementation) | Developers + architects | After architecture is decided |
60
+
61
+ ## Workflow
62
+
63
+ ```
64
+ ┌─────────────────────────────────────────────────────────────────┐
65
+ │ PRD Creation Workflow │
66
+ ├─────────────────────────────────────────────────────────────────┤
67
+ │ │
68
+ │ 1. Initialize → Create 4 files with template │
69
+ │ 2. Requirements → Gather to {scope}-prd-notes.md │
70
+ │ 2.5 Edge Cases → Scan codebase, infer patterns, ask smartly │
71
+ │ 3. Analysis → Research best practices, save to notes │
72
+ │ 4. Design → Propose architecture options (A/B/C), save to notes │
73
+ │ 5. PRD → Write product requirements to {scope}-prd.md │
74
+ │ 6. Tech → Write technical design to {scope}-tech.md │
75
+ │ 7. Validate → Review with user, finalize │
76
+ │ │
77
+ └─────────────────────────────────────────────────────────────────┘
78
+
79
+ All thinking persisted to files
80
+
81
+ No context switching
82
+ ```
83
+
84
+ ## Step 1: Initialize
85
+
86
+ Create the four files with templates:
87
+
88
+ ### {scope}-prd-task-plan.md
89
+
90
+ ```markdown
91
+ # PRD Task Plan: {Feature Name}
92
+
93
+ ## Goal
94
+ Create a PRD and technical design for {feature description}.
95
+
96
+ ## Owner
97
+ {User name/role}
98
+
99
+ ## Phases
100
+ - [x] Phase 1: Initialize files ✓
101
+ - [ ] Phase 2: Gather requirements (CURRENT)
102
+ - [ ] Phase 3: Research & analysis
103
+ - [ ] Phase 4: Design solution
104
+ - [ ] Phase 5: Write PRD
105
+ - [ ] Phase 6: Write technical design
106
+ - [ ] Phase 7: Validate & finalize
107
+
108
+ ## Status
109
+ **Currently in Phase 2** - Gathering requirements from user
110
+
111
+ ## Progress Log
112
+ - {timestamp} - Phase 1 complete: Files initialized
113
+ ```
114
+
115
+ ### {scope}-prd-notes.md
116
+
117
+ ```markdown
118
+ # PRD Notes: {Feature Name}
119
+
120
+ ## Raw Requirements
121
+ (Add user requirements as they emerge)
122
+
123
+ ## Constraints
124
+ (Add technical, business, time constraints)
125
+
126
+ ## Inferred Patterns (from codebase)
127
+
128
+ | Edge Case | Source | Pattern Applied |
129
+ |-----------|--------|-----------------|
130
+ | (Filled after Step 2.5 codebase scan) | | |
131
+
132
+ ## Edge Cases
133
+
134
+ ### Auto-handled (following codebase patterns)
135
+ - (Filled after Step 2.5 analysis)
136
+
137
+ ### Confirmed by User
138
+ - (Filled after user confirms edge case decisions)
139
+
140
+ ### Open Questions
141
+ - (Track questions to ask user)
142
+
143
+ ## Research Findings
144
+ (Add research on best practices, similar solutions)
145
+
146
+ ## Architecture Options
147
+
148
+ - Option A: {Description}
149
+ - Pros: {Advantages}
150
+ - Cons: {Disadvantages}
151
+
152
+ - Option B: {Description}
153
+ - Pros: {Advantages}
154
+ - Cons: {Disadvantages}
155
+
156
+ - Option C: {Description}
157
+ - Pros: {Advantages}
158
+ - Cons: {Disadvantages}
159
+
160
+ **Selected**: Option {X}
161
+ ```
162
+
163
+ ### {scope}-prd.md
164
+
165
+ ```markdown
166
+ # PRD: {Feature Name}
167
+
168
+ > Status: DRAFT
169
+ > Last updated: {timestamp}
170
+
171
+ ## Table of Contents
172
+ - [Problem Statement](#problem-statement)
173
+ - [Goals and Non-Goals](#goals-and-non-goals)
174
+ - [Success Criteria](#success-criteria)
175
+ - [Scope](#scope)
176
+ - [Requirements](#requirements)
177
+ - [User Flows](#user-flows)
178
+ - [Implementation Plan](#implementation-plan)
179
+
180
+ ---
181
+
182
+ ## Problem Statement
183
+ _To be filled after requirements gathering_
184
+
185
+ ## Goals and Non-Goals
186
+ ### Goals
187
+ - {Specific achievable outcomes}
188
+
189
+ ### Non-Goals
190
+ - {Explicit exclusions}
191
+
192
+ ## Success Criteria
193
+ _To be filled with measurable criteria_
194
+
195
+ ## Scope
196
+ ### In Scope
197
+ - {Specific items included}
198
+
199
+ ### Out of Scope
200
+ - {Specific items excluded}
201
+
202
+ ... (rest of PRD sections)
203
+ ```
204
+
205
+ ### {scope}-tech.md
206
+
207
+ ```markdown
208
+ # Technical Design: {Feature Name}
209
+
210
+ > Status: DRAFT
211
+ > Last updated: {timestamp}
212
+
213
+ ## Overview
214
+ {High-level technical approach}
215
+
216
+ ## Key Components
217
+ {List major components and their responsibilities}
218
+
219
+ ## API Design
220
+ {API signatures, request/response formats}
221
+
222
+ ## Data Flow
223
+ {How data flows through the system}
224
+
225
+ ## Implementation Details
226
+ {Specific implementation notes}
227
+
228
+ ## Migration Plan
229
+ {If applicable, how to migrate from existing system}
230
+ ```
231
+
232
+ ## Step 2: Gather Requirements
233
+
234
+ Ask clarifying questions and save responses to `{scope}-prd-notes.md`:
235
+
236
+ ### Core Questions to Ask
237
+
238
+ 1. **Problem**: What problem are we solving?
239
+ 2. **Users**: Who will use this?
240
+ 3. **Success**: How do we know it's successful?
241
+ 4. **Constraints**: Any technical/time/budget constraints?
242
+
243
+ Save each answer to `{scope}-prd-notes.md` under appropriate section.
244
+
245
+ **Always update `{scope}-prd-task-plan.md` after gathering info:**
246
+ ```markdown
247
+ - [x] Phase 2: Gather requirements ✓
248
+ - [ ] Phase 2.5: Edge case analysis (CURRENT)
249
+ - [ ] Phase 3: Research & analysis
250
+ ```
251
+
252
+ ## Step 2.5: Context-Aware Edge Case Analysis
253
+
254
+ Before asking users about edge cases, **scan the codebase first** to infer existing patterns. This reduces redundant questions and ensures consistency with the project.
255
+
256
+ > **Detailed reference**: See `references/edge-case-analysis.md` for full scanning commands and output formats.
257
+
258
+ ### Quick Process
259
+
260
+ 1. **Scan codebase** for existing patterns (delete strategy, error handling, empty states, pagination)
261
+ 2. **Identify requirement type** (CRUD, State Workflow, Async, Data Display, Form, File)
262
+ 3. **Generate smart assumptions** - patterns found in code don't need user confirmation
263
+ 4. **Ask only when needed** - no precedent, multiple patterns, or business decision required
264
+
265
+ ### When to Ask Users
266
+
267
+ | Condition | Action |
268
+ |-----------|--------|
269
+ | Pattern exists in codebase | Auto-apply, no question needed |
270
+ | No precedent found | Ask user with options |
271
+ | Multiple conflicting patterns | Ask user to choose |
272
+ | Business rule required | Ask user |
273
+
274
+ ### Output to Notes File
275
+
276
+ Update `{scope}-prd-notes.md` with:
277
+
278
+ ```markdown
279
+ ## Inferred Patterns (from codebase)
280
+ | Edge Case | Source | Pattern Applied |
281
+ |-----------|--------|-----------------|
282
+ | Delete | `src/models/User.ts:45` | Soft delete |
283
+
284
+ ## Edge Cases
285
+ ### Auto-handled (following codebase patterns)
286
+ - Empty list → Use existing EmptyState component
287
+
288
+ ### Confirmed by User
289
+ - Concurrent edit: Last write wins (confirmed {date})
290
+ ```
291
+
292
+ **Update task plan:**
293
+ ```markdown
294
+ - [x] Phase 2.5: Edge case analysis ✓
295
+ - [ ] Phase 3: Research & analysis (CURRENT)
296
+ ```
297
+
298
+ ## Step 3: Research & Analysis
299
+
300
+ Research best practices and save to `{scope}-prd-notes.md`:
301
+
302
+ ```bash
303
+ # Search for similar implementations
304
+ grep -r "keyword" packages/ --include="*.ts"
305
+
306
+ # Search web for best practices
307
+ web search "best practices for {feature}"
308
+ ```
309
+
310
+ Save findings to `{scope}-prd-notes.md` → Research Findings section.
311
+
312
+ ## Step 4: Design Solution
313
+
314
+ Propose architecture with trade-offs, save to `{scope}-prd-notes.md`:
315
+
316
+ ```markdown
317
+ ## Architecture Options
318
+
319
+ - Option A: {Description}
320
+ - Pros: {Advantages}
321
+ - Cons: {Disadvantages}
322
+
323
+ - Option B: {Description}
324
+ - Pros: {Advantages}
325
+ - Cons: {Disadvantages}
326
+
327
+ - Option C: {Description}
328
+ - Pros: {Advantages}
329
+ - Cons: {Disadvantages}
330
+
331
+ **Selected**: Option {X} - because {reason}
332
+ ```
333
+
334
+ ## Step 5: Write PRD
335
+
336
+ Read `{scope}-prd-notes.md` and synthesize into polished PRD:
337
+
338
+ ```markdown
339
+ 1. Read {scope}-prd-notes.md to understand:
340
+ - Requirements gathered
341
+ - Research findings
342
+ - Architecture decision (which option was selected)
343
+
344
+ 2. Write {scope}-prd.md with:
345
+ - Clear problem statement
346
+ - Goals and Non-Goals (explicit exclusions)
347
+ - Measurable success criteria (specific numbers/timings)
348
+ - Scope (In Scope / Out of Scope)
349
+ - Functional requirements
350
+ - Non-functional requirements
351
+ - User flows
352
+ - Implementation plan (high level)
353
+
354
+ 3. Reference tech doc: "See {scope}-tech.md for technical design"
355
+ ```
356
+
357
+ ## Step 6: Write Technical Design
358
+
359
+ ```markdown
360
+ 1. Read {scope}-prd-notes.md for selected architecture option
361
+
362
+ 2. Write {scope}-tech.md with:
363
+ - Overview (technical approach summary)
364
+ - Key Components (what pieces, responsibilities)
365
+ - API Design (signatures, contracts)
366
+ - Data Flow (how data moves through system)
367
+ - Implementation Details (specific notes)
368
+ - Migration Plan (if applicable)
369
+ ```
370
+
371
+ ## Step 7: Validate & Finalize
372
+
373
+ Review with user:
374
+ 1. Present PRD summary
375
+ 2. Ask for feedback
376
+ 3. Incorporate changes
377
+ 4. Mark Phase 7 complete
378
+
379
+ ## Important Rules
380
+
381
+ | Rule | Bad | Good |
382
+ |------|-----|------|
383
+ | Use Files | Keep in memory | Save to {scope}-prd-notes.md |
384
+ | Update Plan | Move on without update | Update task-plan.md with checkbox |
385
+ | Read Before Decide | Decide from memory | Read notes first |
386
+ | Separate Docs | Mix PRD + Tech | PRD for "what", Tech for "how" |
387
+ | Include Options | Jump to solution | Document 2-3 options with pros/cons |
388
+
389
+ ## Phase Transitions
390
+
391
+ Update `{scope}-prd-task-plan.md` after each phase with checkbox ✓ and timestamp.
392
+
393
+ ## Completing a PRD
394
+
395
+ Mark all phases complete, set status to "✅ COMPLETE", log final deliverables.
396
+
397
+ ## File Cleanup (Optional)
398
+
399
+ After PRD is complete:
400
+ - Keep `{scope}-prd-notes.md` for reference (shows decision process)
401
+ - Archive `{scope}-prd-task-plan.md` or delete
402
+ - Final outputs are `{scope}-prd.md` and `{scope}-tech.md`
403
+
404
+ ## Quick Start Template
405
+
406
+ ```markdown
407
+ # PRD Task Plan: {Feature}
408
+
409
+ ## Goal
410
+ Create PRD and technical design for {description}
411
+
412
+ ## Phases
413
+ - [ ] Initialize 4 files
414
+ - [ ] Gather requirements
415
+ - [ ] Research & analysis
416
+ - [ ] Design solution (A/B/C options)
417
+ - [ ] Write PRD
418
+ - [ ] Write technical design
419
+ - [ ] Validate & finalize
420
+
421
+ ## Status
422
+ Phase 1: Initializing files
423
+ ```
424
+
425
+ ## Why This Works
426
+
427
+ | Problem | Solution |
428
+ |---------|----------|
429
+ | Context switching | All thinking in files, read anytime |
430
+ | Lost requirements | Saved to {scope}-prd-notes.md immediately |
431
+ | Inconsistent PRDs | Same process, same structure |
432
+ | "Left brain vs right brain" | One coherent workflow |
433
+ | Re-explaining context | Files contain full context |
434
+ | Mixed concerns | PRD (product) separate from Tech (implementation) |
435
+ | Hidden decisions | Architecture options A/B/C documented |
436
+
437
+ ## References
438
+
439
+ - [planning-with-files](../planning-with-files/) - File-based planning methodology
440
+ - [architecting-solutions](../architecting-solutions/) - PRD creation best practices
441
+ - Edge case scanning: `references/edge-case-analysis.md`
442
+
443
+ ---
444
+
445
+ ## Auto-Trigger (Automation)
446
+
447
+ When this skill completes, automatically trigger:
448
+ 1. **self-improving-agent** (background) - Extract patterns
449
+ 2. **session-logger** (auto) - Save session context