@cliangdev/flux-plugin 0.2.0 → 0.3.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/README.md +11 -7
- package/agents/coder.md +150 -25
- package/bin/install.cjs +171 -16
- package/commands/breakdown.md +47 -10
- package/commands/dashboard.md +29 -0
- package/commands/flux.md +92 -12
- package/commands/implement.md +166 -17
- package/commands/linear.md +6 -5
- package/commands/prd.md +996 -82
- package/manifest.json +2 -1
- package/package.json +9 -11
- package/skills/flux-orchestrator/SKILL.md +11 -3
- package/skills/prd-writer/SKILL.md +761 -0
- package/skills/ux-ui-design/SKILL.md +346 -0
- package/skills/ux-ui-design/references/design-tokens.md +359 -0
- package/src/__tests__/version.test.ts +37 -0
- package/src/adapters/local/.gitkeep +0 -0
- package/src/dashboard/__tests__/api.test.ts +211 -0
- package/src/dashboard/browser.ts +35 -0
- package/src/dashboard/public/app.js +869 -0
- package/src/dashboard/public/index.html +90 -0
- package/src/dashboard/public/styles.css +807 -0
- package/src/dashboard/public/vendor/highlight.css +10 -0
- package/src/dashboard/public/vendor/highlight.min.js +8422 -0
- package/src/dashboard/public/vendor/marked.min.js +2210 -0
- package/src/dashboard/server.ts +296 -0
- package/src/dashboard/watchers.ts +83 -0
- package/src/server/__tests__/config.test.ts +163 -0
- package/src/server/adapters/__tests__/a-client-linear.test.ts +197 -0
- package/src/server/adapters/__tests__/adapter-factory.test.ts +230 -0
- package/src/server/adapters/__tests__/dependency-ops.test.ts +429 -0
- package/src/server/adapters/__tests__/document-ops.test.ts +306 -0
- package/src/server/adapters/__tests__/linear-adapter.test.ts +91 -0
- package/src/server/adapters/__tests__/linear-config.test.ts +425 -0
- package/src/server/adapters/__tests__/linear-criteria-parser.test.ts +287 -0
- package/src/server/adapters/__tests__/linear-description-test.ts +238 -0
- package/src/server/adapters/__tests__/linear-epic-crud.test.ts +496 -0
- package/src/server/adapters/__tests__/linear-mappers-description.test.ts +276 -0
- package/src/server/adapters/__tests__/linear-mappers-epic.test.ts +294 -0
- package/src/server/adapters/__tests__/linear-mappers-prd.test.ts +300 -0
- package/src/server/adapters/__tests__/linear-mappers-task.test.ts +197 -0
- package/src/server/adapters/__tests__/linear-prd-crud.test.ts +620 -0
- package/src/server/adapters/__tests__/linear-stats.test.ts +450 -0
- package/src/server/adapters/__tests__/linear-task-crud.test.ts +534 -0
- package/src/server/adapters/__tests__/linear-types.test.ts +243 -0
- package/src/server/adapters/__tests__/status-ops.test.ts +441 -0
- package/src/server/adapters/factory.ts +90 -0
- package/src/server/adapters/index.ts +9 -0
- package/src/server/adapters/linear/adapter.ts +1141 -0
- package/src/server/adapters/linear/client.ts +169 -0
- package/src/server/adapters/linear/config.ts +152 -0
- package/src/server/adapters/linear/helpers/criteria-parser.ts +197 -0
- package/src/server/adapters/linear/helpers/index.ts +7 -0
- package/src/server/adapters/linear/index.ts +16 -0
- package/src/server/adapters/linear/mappers/description.ts +136 -0
- package/src/server/adapters/linear/mappers/epic.ts +81 -0
- package/src/server/adapters/linear/mappers/index.ts +27 -0
- package/src/server/adapters/linear/mappers/prd.ts +178 -0
- package/src/server/adapters/linear/mappers/task.ts +82 -0
- package/src/server/adapters/linear/types.ts +264 -0
- package/src/server/adapters/local-adapter.ts +1009 -0
- package/src/server/adapters/types.ts +293 -0
- package/src/server/config.ts +73 -0
- package/src/server/db/__tests__/queries.test.ts +473 -0
- package/src/server/db/ids.ts +17 -0
- package/src/server/db/index.ts +69 -0
- package/src/server/db/queries.ts +142 -0
- package/src/server/db/refs.ts +60 -0
- package/src/server/db/schema.ts +97 -0
- package/src/server/db/sqlite.ts +10 -0
- package/src/server/index.ts +81 -0
- package/src/server/tools/__tests__/crud.test.ts +411 -0
- package/src/server/tools/__tests__/get-version.test.ts +27 -0
- package/src/server/tools/__tests__/mcp-interface.test.ts +479 -0
- package/src/server/tools/__tests__/query.test.ts +405 -0
- package/src/server/tools/__tests__/z-configure-linear.test.ts +511 -0
- package/src/server/tools/__tests__/z-get-linear-url.test.ts +108 -0
- package/src/server/tools/configure-linear.ts +373 -0
- package/src/server/tools/create-epic.ts +44 -0
- package/src/server/tools/create-prd.ts +40 -0
- package/src/server/tools/create-task.ts +47 -0
- package/src/server/tools/criteria.ts +50 -0
- package/src/server/tools/delete-entity.ts +76 -0
- package/src/server/tools/dependencies.ts +55 -0
- package/src/server/tools/get-entity.ts +240 -0
- package/src/server/tools/get-linear-url.ts +28 -0
- package/src/server/tools/get-stats.ts +52 -0
- package/src/server/tools/get-version.ts +20 -0
- package/src/server/tools/index.ts +158 -0
- package/src/server/tools/init-project.ts +108 -0
- package/src/server/tools/query-entities.ts +167 -0
- package/src/server/tools/render-status.ts +219 -0
- package/src/server/tools/update-entity.ts +140 -0
- package/src/server/tools/update-status.ts +166 -0
- package/src/server/utils/__tests__/mcp-response.test.ts +331 -0
- package/src/server/utils/logger.ts +9 -0
- package/src/server/utils/mcp-response.ts +254 -0
- package/src/server/utils/status-transitions.ts +160 -0
- package/src/status-line/__tests__/status-line.test.ts +215 -0
- package/src/status-line/index.ts +147 -0
- package/src/utils/__tests__/chalk-import.test.ts +32 -0
- package/src/utils/__tests__/display.test.ts +97 -0
- package/src/utils/__tests__/status-renderer.test.ts +310 -0
- package/src/utils/display.ts +62 -0
- package/src/utils/status-renderer.ts +214 -0
- package/src/version.ts +5 -0
- package/dist/server/index.js +0 -87063
- package/skills/prd-template/SKILL.md +0 -242
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flux:prd-writer
|
|
3
|
+
description: Comprehensive guide for creating PRDs that are concise for humans and detailed enough for AI implementation. Use when creating, refining, or reviewing product requirement documents. This skill drives the entire PRD creation workflow.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PRD Writer Skill
|
|
8
|
+
|
|
9
|
+
This skill guides the creation of **Product Requirement Documents** that serve two audiences:
|
|
10
|
+
1. **Humans** - who need to understand and approve the vision
|
|
11
|
+
2. **AI Agents** - who need unambiguous specifications to implement
|
|
12
|
+
|
|
13
|
+
## Core Principle: Specification as Contract
|
|
14
|
+
|
|
15
|
+
A PRD is a contract between the product vision and the implementation. Every feature must have:
|
|
16
|
+
- **Clear scope** - What's in, what's out
|
|
17
|
+
- **Testable criteria** - How do we know it works?
|
|
18
|
+
- **Edge cases** - What could go wrong?
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## PRD Scoping: Right-Sizing Your PRDs
|
|
23
|
+
|
|
24
|
+
### The Golden Rule
|
|
25
|
+
|
|
26
|
+
**One PRD = One implementable unit that delivers standalone value.**
|
|
27
|
+
|
|
28
|
+
A well-scoped PRD should:
|
|
29
|
+
- Be completable in 1-3 weeks of focused work
|
|
30
|
+
- Result in 15-25 tasks when broken down
|
|
31
|
+
- Deliver something usable/testable on its own
|
|
32
|
+
- Have clear boundaries that don't leak into other features
|
|
33
|
+
|
|
34
|
+
### Scope Assessment Matrix
|
|
35
|
+
|
|
36
|
+
| Indicator | Right-Sized PRD | Too Large (Split It) |
|
|
37
|
+
|-----------|-----------------|----------------------|
|
|
38
|
+
| Major features | 3-5 related features | 6+ distinct features |
|
|
39
|
+
| User flows | 1-2 main journeys | 3+ separate journeys |
|
|
40
|
+
| Technical domains | Focused area | Frontend + Backend + Infra + DevOps |
|
|
41
|
+
| User personas | 1-2 related personas | Multiple distinct user types |
|
|
42
|
+
| Estimated tasks | 15-25 tasks | 30+ tasks |
|
|
43
|
+
| Dependencies | Few external deps | Multiple other systems |
|
|
44
|
+
|
|
45
|
+
### When to Split: Red Flags
|
|
46
|
+
|
|
47
|
+
🚩 **"Build a mobile app"** → Too vague. What features? For whom?
|
|
48
|
+
|
|
49
|
+
🚩 **"Full e-commerce platform"** → Contains auth, catalog, cart, checkout, payments, orders, admin...
|
|
50
|
+
|
|
51
|
+
🚩 **"Complete user management"** → Could mean signup, profiles, roles, permissions, teams, invites, admin...
|
|
52
|
+
|
|
53
|
+
🚩 **Multiple distinct user types** → Admin dashboard + Customer portal = 2 PRDs minimum
|
|
54
|
+
|
|
55
|
+
### Multi-PRD Project Structure
|
|
56
|
+
|
|
57
|
+
For large projects, organize PRDs into phases:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
61
|
+
│ PROJECT: Task Manager App │
|
|
62
|
+
├─────────────────────────────────────────────────────────────┤
|
|
63
|
+
│ │
|
|
64
|
+
│ FOUNDATION LAYER (implement first) │
|
|
65
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
66
|
+
│ │ Project Setup │───▶│ Authentication │ │
|
|
67
|
+
│ │ [foundation] │ │ [foundation] │ │
|
|
68
|
+
│ └─────────────────┘ └────────┬────────┘ │
|
|
69
|
+
│ │ │
|
|
70
|
+
│ MVP LAYER ▼ │
|
|
71
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
72
|
+
│ │ Task CRUD │ │ Task Lists │ │
|
|
73
|
+
│ │ [mvp] │◀───│ [mvp] │ │
|
|
74
|
+
│ └─────────────────┘ └─────────────────┘ │
|
|
75
|
+
│ │
|
|
76
|
+
│ POST-MVP LAYER │
|
|
77
|
+
│ ┌─────────────────┐ ┌─────────────────┐ │
|
|
78
|
+
│ │ Sharing & │ │ Notifications │ │
|
|
79
|
+
│ │ Collaboration │ │ [post-mvp] │ │
|
|
80
|
+
│ │ [post-mvp] │ └─────────────────┘ │
|
|
81
|
+
│ └─────────────────┘ │
|
|
82
|
+
│ │
|
|
83
|
+
└─────────────────────────────────────────────────────────────┘
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### PRD Tags
|
|
87
|
+
|
|
88
|
+
Use tags to organize related PRDs:
|
|
89
|
+
|
|
90
|
+
| Tag | Meaning | When to Use |
|
|
91
|
+
|-----|---------|-------------|
|
|
92
|
+
| `foundation` | Core infrastructure | Setup, auth, database schema, core APIs |
|
|
93
|
+
| `mvp` | Minimum viable product | Essential features for first release |
|
|
94
|
+
| `mvp-phase-2` | Second wave of MVP | Important but not launch-blocking |
|
|
95
|
+
| `post-mvp` | Future enhancements | Nice-to-have, can wait |
|
|
96
|
+
| `experimental` | Exploratory | R&D, prototypes, uncertain scope |
|
|
97
|
+
| `bugfix` | Defect correction | Addressing issues in existing features |
|
|
98
|
+
| `refactor` | Technical improvement | No new features, internal quality |
|
|
99
|
+
|
|
100
|
+
### PRD Dependencies
|
|
101
|
+
|
|
102
|
+
When PRDs depend on each other, document it clearly:
|
|
103
|
+
|
|
104
|
+
**In the Constraints section:**
|
|
105
|
+
```markdown
|
|
106
|
+
## Constraints
|
|
107
|
+
|
|
108
|
+
### PRD Dependencies
|
|
109
|
+
- **Requires**: [Authentication PRD](./auth/prd.md) (FLUX-P1) - Need user model and JWT middleware
|
|
110
|
+
- **Blocks**: [Notifications PRD](./notifications/prd.md) (FLUX-P4) - Will need task events
|
|
111
|
+
|
|
112
|
+
### Shared Components
|
|
113
|
+
- Uses User model from Authentication PRD
|
|
114
|
+
- Extends base API patterns from Project Setup PRD
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Example: Splitting a Large Scope
|
|
118
|
+
|
|
119
|
+
**User says**: "I want to build a fitness tracking app"
|
|
120
|
+
|
|
121
|
+
**❌ Bad (too large)**:
|
|
122
|
+
```
|
|
123
|
+
PRD: Fitness Tracking App
|
|
124
|
+
Features:
|
|
125
|
+
- User accounts
|
|
126
|
+
- Workout logging
|
|
127
|
+
- Exercise library
|
|
128
|
+
- Progress charts
|
|
129
|
+
- Social features
|
|
130
|
+
- Meal tracking
|
|
131
|
+
- Sleep tracking
|
|
132
|
+
- Wearable integration
|
|
133
|
+
- Premium subscriptions
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**✅ Good (split into focused PRDs)**:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
PRD 1: Project Foundation [foundation]
|
|
140
|
+
- Project setup, CI/CD, deployment
|
|
141
|
+
- Core data models
|
|
142
|
+
- API structure
|
|
143
|
+
Dependencies: None
|
|
144
|
+
|
|
145
|
+
PRD 2: User Authentication [foundation]
|
|
146
|
+
- Sign up, login, profile
|
|
147
|
+
- Password reset
|
|
148
|
+
Dependencies: PRD 1
|
|
149
|
+
|
|
150
|
+
PRD 3: Workout Logging [mvp]
|
|
151
|
+
- Log workouts manually
|
|
152
|
+
- View workout history
|
|
153
|
+
- Basic exercise library
|
|
154
|
+
Dependencies: PRD 2
|
|
155
|
+
|
|
156
|
+
PRD 4: Progress Tracking [mvp]
|
|
157
|
+
- Dashboard with charts
|
|
158
|
+
- Weekly/monthly summaries
|
|
159
|
+
Dependencies: PRD 3
|
|
160
|
+
|
|
161
|
+
PRD 5: Social Features [post-mvp]
|
|
162
|
+
- Follow friends
|
|
163
|
+
- Share workouts
|
|
164
|
+
- Leaderboards
|
|
165
|
+
Dependencies: PRD 2, PRD 3
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Scope Negotiation
|
|
169
|
+
|
|
170
|
+
When scope is too large, guide the user:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
This is a substantial project. Let me help you break it down:
|
|
174
|
+
|
|
175
|
+
**Option A: Start with foundation**
|
|
176
|
+
Begin with authentication and core infrastructure. Other features build on this.
|
|
177
|
+
|
|
178
|
+
**Option B: Pick one user journey**
|
|
179
|
+
What's the ONE thing users must be able to do? Let's nail that first.
|
|
180
|
+
|
|
181
|
+
**Option C: Define MVP strictly**
|
|
182
|
+
What could you launch with in 2 weeks that would be useful?
|
|
183
|
+
|
|
184
|
+
Which approach works for you?
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## PRD Structure (Required Sections)
|
|
190
|
+
|
|
191
|
+
### For Local Adapter (files in `.flux/prds/`)
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
# {Project Name}
|
|
195
|
+
|
|
196
|
+
> **Tag**: {foundation | mvp | mvp-phase-2 | post-mvp | experimental}
|
|
197
|
+
> **Depends on**: {None | List of PRD refs like FLUX-P1, FLUX-P2}
|
|
198
|
+
> **Blocks**: {None | List of PRD refs that depend on this}
|
|
199
|
+
|
|
200
|
+
## Table of Contents
|
|
201
|
+
- [Problem](#problem)
|
|
202
|
+
- [Users](#users)
|
|
203
|
+
- [Solution](#solution)
|
|
204
|
+
- [Features (MVP)](#features-mvp)
|
|
205
|
+
- [P0: Must Have](#p0-must-have)
|
|
206
|
+
- [P1: Should Have](#p1-should-have)
|
|
207
|
+
- [Out of Scope](#out-of-scope)
|
|
208
|
+
- [Technical Context](#technical-context)
|
|
209
|
+
- [Constraints](#constraints)
|
|
210
|
+
- [Open Questions](#open-questions)
|
|
211
|
+
|
|
212
|
+
## Problem
|
|
213
|
+
{2-3 sentences: What pain point are we solving? Why does it matter now?}
|
|
214
|
+
|
|
215
|
+
## Users
|
|
216
|
+
{Who experiences this problem? Be specific about user segments.}
|
|
217
|
+
|
|
218
|
+
## Solution
|
|
219
|
+
{1 paragraph: What are we building? How does it solve the problem?}
|
|
220
|
+
|
|
221
|
+
## Features
|
|
222
|
+
|
|
223
|
+
### P0: Must Have
|
|
224
|
+
|
|
225
|
+
For each feature, use the What/Not pattern:
|
|
226
|
+
|
|
227
|
+
- **{Feature Name}**: {One-line description}
|
|
228
|
+
- **What**: {Specific scope - what IS included}
|
|
229
|
+
- **Not**: {Explicit exclusions - prevents scope creep}
|
|
230
|
+
- **Acceptance Criteria**:
|
|
231
|
+
- [ ] {Input → expected output, testable by AI}
|
|
232
|
+
- [ ] {Another criterion with specific values}
|
|
233
|
+
- **Edge Cases**:
|
|
234
|
+
- {Scenario}: {Expected behavior}
|
|
235
|
+
|
|
236
|
+
### P1: Should Have
|
|
237
|
+
|
|
238
|
+
- **{Feature}**: {Description}
|
|
239
|
+
- {Brief acceptance criteria - less detail than P0}
|
|
240
|
+
|
|
241
|
+
### Out of Scope
|
|
242
|
+
- {What we're explicitly NOT building}
|
|
243
|
+
- {Future considerations deferred}
|
|
244
|
+
|
|
245
|
+
## Technical Context
|
|
246
|
+
|
|
247
|
+
### Existing Patterns
|
|
248
|
+
{Describe relevant existing code patterns the implementation should follow.}
|
|
249
|
+
{Reference key files/modules that will be extended or modified.}
|
|
250
|
+
|
|
251
|
+
### Tech Stack
|
|
252
|
+
- **{Layer}**: {Technology} - {Why this choice}
|
|
253
|
+
|
|
254
|
+
### API Design (if applicable)
|
|
255
|
+
| Method | Path | Description |
|
|
256
|
+
|--------|------|-------------|
|
|
257
|
+
| POST | /api/... | ... |
|
|
258
|
+
|
|
259
|
+
## Constraints
|
|
260
|
+
- **Timeline**: {Any deadlines}
|
|
261
|
+
- **PRD Dependencies**: {What must be completed before this PRD can start}
|
|
262
|
+
- **External Dependencies**: {APIs, services, third-party systems}
|
|
263
|
+
- **Performance**: {SLAs, limits}
|
|
264
|
+
|
|
265
|
+
## Open Questions
|
|
266
|
+
- [ ] {Unresolved decision needing stakeholder input}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**Note**: The metadata block at the top (Tag, Depends on, Blocks) is optional for standalone PRDs but required for multi-PRD projects.
|
|
270
|
+
|
|
271
|
+
### For External Adapters (Linear, Notion)
|
|
272
|
+
|
|
273
|
+
**Skip the Table of Contents** - external systems have their own navigation.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Writing for Two Audiences
|
|
278
|
+
|
|
279
|
+
A PRD must satisfy both humans and AI agents:
|
|
280
|
+
|
|
281
|
+
| Audience | Needs | What They Read |
|
|
282
|
+
|----------|-------|----------------|
|
|
283
|
+
| **Humans** | Quick understanding, approve/reject decisions | Problem, Solution, feature summaries |
|
|
284
|
+
| **AI Agents** | Unambiguous specs for autonomous implementation | Acceptance criteria, edge cases, code references |
|
|
285
|
+
|
|
286
|
+
### Size Guidelines
|
|
287
|
+
|
|
288
|
+
| Section | Target | Guidance |
|
|
289
|
+
|---------|--------|----------|
|
|
290
|
+
| Problem | 2-3 sentences | What pain? Why now? Who suffers? |
|
|
291
|
+
| Solution | 1 paragraph | What we're building, how it solves the problem |
|
|
292
|
+
| P0 Features | 3-5 features | The true MVP, nothing more |
|
|
293
|
+
| Each Feature | 5-10 criteria | Enough for AI to implement without guessing |
|
|
294
|
+
| Total PRD | 1-2 pages | Fits on one screen when scrolling |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Feature Writing: The What/Not Pattern
|
|
299
|
+
|
|
300
|
+
Every P0 feature must have explicit boundaries. Use the **What/Not** pattern to prevent scope creep and give AI clear implementation guidance.
|
|
301
|
+
|
|
302
|
+
### Feature Template
|
|
303
|
+
|
|
304
|
+
```markdown
|
|
305
|
+
- **{Feature Name}**: {One-line description}
|
|
306
|
+
- **What**: {Specific scope - what IS included}
|
|
307
|
+
- **Not**: {Explicit exclusions - what is NOT included}
|
|
308
|
+
- **Acceptance Criteria**:
|
|
309
|
+
- [ ] {Testable criterion with specific input → expected output}
|
|
310
|
+
- [ ] {Another criterion - AI can verify pass/fail}
|
|
311
|
+
- **Edge Cases**:
|
|
312
|
+
- {Scenario}: {Expected behavior}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Feature Quality Ladder
|
|
316
|
+
|
|
317
|
+
**Level 1: Vague** (human might understand, AI cannot implement)
|
|
318
|
+
```markdown
|
|
319
|
+
- User authentication
|
|
320
|
+
```
|
|
321
|
+
*Problem: What kind? Email? OAuth? What flows?*
|
|
322
|
+
|
|
323
|
+
**Level 2: Named** (clearer, still ambiguous)
|
|
324
|
+
```markdown
|
|
325
|
+
- **User Authentication**: Users can sign up and log in
|
|
326
|
+
```
|
|
327
|
+
*Problem: What about logout? Password reset? Validation rules?*
|
|
328
|
+
|
|
329
|
+
**Level 3: Scoped** (boundaries defined)
|
|
330
|
+
```markdown
|
|
331
|
+
- **User Authentication**: Email/password auth for user accounts
|
|
332
|
+
- **What**: Sign up, login, logout, password reset
|
|
333
|
+
- **Not**: OAuth, 2FA, social login, magic links
|
|
334
|
+
```
|
|
335
|
+
*Better: AI knows the boundaries. Still lacks implementation detail.*
|
|
336
|
+
|
|
337
|
+
**Level 4: Implementable** (AI can build autonomously)
|
|
338
|
+
```markdown
|
|
339
|
+
- **User Authentication**: Email/password auth for user accounts
|
|
340
|
+
- **What**: Sign up, login, logout, password reset via email
|
|
341
|
+
- **Not**: OAuth, 2FA, social login, magic links, session management (use JWT)
|
|
342
|
+
- **Acceptance Criteria**:
|
|
343
|
+
- [ ] POST /auth/signup with {email, password, name} → 201 + user object (no password)
|
|
344
|
+
- [ ] POST /auth/login with valid credentials → 200 + {token, user}
|
|
345
|
+
- [ ] POST /auth/login with wrong password → 401 + {error: "Invalid credentials"}
|
|
346
|
+
- [ ] POST /auth/logout with valid token → 200 (token invalidated)
|
|
347
|
+
- [ ] Password minimum 8 chars; shorter rejected with 400 + validation error
|
|
348
|
+
- [ ] Email must be valid format; malformed rejected with 400
|
|
349
|
+
- **Edge Cases**:
|
|
350
|
+
- Duplicate email on signup: 409 Conflict + {error: "Email already registered"}
|
|
351
|
+
- Login with non-existent email: 401 (same as wrong password, for security)
|
|
352
|
+
- Expired token on protected routes: 401 + {error: "Token expired"}
|
|
353
|
+
- Rate limiting: 429 after 5 failed login attempts per email in 1 minute
|
|
354
|
+
```
|
|
355
|
+
*This is AI-ready: specific endpoints, status codes, error messages, edge cases.*
|
|
356
|
+
|
|
357
|
+
### Acceptance Criteria Rules
|
|
358
|
+
|
|
359
|
+
1. **Use input → output format**: `POST /path with {data} → status + {response}`
|
|
360
|
+
2. **Include failure cases**: Don't just test happy paths
|
|
361
|
+
3. **Specify exact values**: "400" not "error", "8 chars" not "short password"
|
|
362
|
+
4. **Be deterministic**: AI should know exactly what to assert in tests
|
|
363
|
+
|
|
364
|
+
### Edge Cases Worth Documenting
|
|
365
|
+
|
|
366
|
+
Not every edge case matters. Focus on:
|
|
367
|
+
|
|
368
|
+
| Include | Skip |
|
|
369
|
+
|---------|------|
|
|
370
|
+
| Security boundaries (auth failures, rate limits) | Obvious validations (null checks) |
|
|
371
|
+
| Business rule exceptions | Framework-handled errors |
|
|
372
|
+
| Data conflicts (duplicates, race conditions) | Infrastructure issues (DB down) |
|
|
373
|
+
| User journey dead ends | Extremely rare scenarios |
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## Research Phase: What to Investigate
|
|
378
|
+
|
|
379
|
+
Before writing the PRD, research the following:
|
|
380
|
+
|
|
381
|
+
### 1. Codebase Context
|
|
382
|
+
- **Project structure**: What patterns are already established?
|
|
383
|
+
- **Existing modules**: What can be reused or extended?
|
|
384
|
+
- **Tech stack**: What frameworks/libraries are in use?
|
|
385
|
+
- **Testing patterns**: How are tests structured?
|
|
386
|
+
|
|
387
|
+
### 2. Similar Features
|
|
388
|
+
- Look for similar functionality in the codebase
|
|
389
|
+
- Note patterns, naming conventions, file organization
|
|
390
|
+
- Identify shared utilities or base classes
|
|
391
|
+
|
|
392
|
+
### 3. Technical Feasibility
|
|
393
|
+
- Are there any technical blockers?
|
|
394
|
+
- What dependencies are needed?
|
|
395
|
+
- Are there security considerations?
|
|
396
|
+
|
|
397
|
+
### 4. Prior Art (External)
|
|
398
|
+
- How do similar products solve this?
|
|
399
|
+
- Any best practices or anti-patterns to know?
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Project-Type Specific Guidance
|
|
404
|
+
|
|
405
|
+
### Web Application
|
|
406
|
+
**Key questions**:
|
|
407
|
+
- What's the authentication model?
|
|
408
|
+
- What data needs persistence?
|
|
409
|
+
- What are the main user flows?
|
|
410
|
+
|
|
411
|
+
**Common epics**:
|
|
412
|
+
- Project Setup & Configuration
|
|
413
|
+
- Database Schema & Models
|
|
414
|
+
- Authentication/Authorization
|
|
415
|
+
- Core Feature(s)
|
|
416
|
+
- UI/Frontend
|
|
417
|
+
|
|
418
|
+
### CLI Tool
|
|
419
|
+
**Key questions**:
|
|
420
|
+
- What commands are needed?
|
|
421
|
+
- What's the input/output format?
|
|
422
|
+
- How does configuration work?
|
|
423
|
+
|
|
424
|
+
**Common epics**:
|
|
425
|
+
- Command Parser & Help
|
|
426
|
+
- Core Command Implementation
|
|
427
|
+
- Configuration Management
|
|
428
|
+
- Output Formatting
|
|
429
|
+
|
|
430
|
+
### API/Backend Service
|
|
431
|
+
**Key questions**:
|
|
432
|
+
- What's the API contract?
|
|
433
|
+
- What are the data models?
|
|
434
|
+
- What external services integrate?
|
|
435
|
+
|
|
436
|
+
**Common epics**:
|
|
437
|
+
- API Design & Documentation
|
|
438
|
+
- Data Models & Storage
|
|
439
|
+
- Core Endpoints
|
|
440
|
+
- Authentication & Security
|
|
441
|
+
- Error Handling & Logging
|
|
442
|
+
|
|
443
|
+
### Library/Package
|
|
444
|
+
**Key questions**:
|
|
445
|
+
- What's the public API surface?
|
|
446
|
+
- What are the main use cases?
|
|
447
|
+
- How should errors be handled?
|
|
448
|
+
|
|
449
|
+
**Common epics**:
|
|
450
|
+
- API Design
|
|
451
|
+
- Core Implementation
|
|
452
|
+
- Error Handling
|
|
453
|
+
- Documentation & Examples
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Supporting Documents (Optional)
|
|
458
|
+
|
|
459
|
+
Generate based on project complexity and user needs.
|
|
460
|
+
|
|
461
|
+
| Document | When Useful | Content |
|
|
462
|
+
|----------|-------------|---------|
|
|
463
|
+
| `architecture.md` | Multi-component systems | System diagram, API endpoints, data flow |
|
|
464
|
+
| `data-model.md` | Custom data storage | ERD, table schemas, relationships |
|
|
465
|
+
| `wireframes.md` | UI-heavy features | ASCII wireframes, element descriptions |
|
|
466
|
+
| `user-flows.md` | Complex journeys | Step-by-step user paths |
|
|
467
|
+
|
|
468
|
+
### When to Offer Supporting Docs
|
|
469
|
+
|
|
470
|
+
After PRD approval, ask based on project type:
|
|
471
|
+
- **Web App**: Offer architecture, wireframes
|
|
472
|
+
- **API/Backend**: Offer architecture, data-model
|
|
473
|
+
- **CLI Tool**: Usually just PRD is sufficient
|
|
474
|
+
- **Mobile App**: Offer architecture, wireframes
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Workflow: Three-Phase PRD Creation
|
|
479
|
+
|
|
480
|
+
### Phase 1: Discovery (Gather Intent)
|
|
481
|
+
|
|
482
|
+
**Goal**: Understand what the user wants to build.
|
|
483
|
+
|
|
484
|
+
1. **Initial prompt**: "What are you trying to build?"
|
|
485
|
+
2. **Follow-up based on response**:
|
|
486
|
+
- If vague: "Can you describe the problem you're solving?"
|
|
487
|
+
- If clear: "Who is this for? Who experiences this problem?"
|
|
488
|
+
3. **Scope clarification**: "What's the minimum that would be useful?"
|
|
489
|
+
|
|
490
|
+
**Gather**:
|
|
491
|
+
- Problem statement
|
|
492
|
+
- Target users
|
|
493
|
+
- Core functionality (what, not how)
|
|
494
|
+
- Any known constraints
|
|
495
|
+
|
|
496
|
+
### Phase 2: Research (Understand Context)
|
|
497
|
+
|
|
498
|
+
**Goal**: Gather technical context to inform the PRD.
|
|
499
|
+
|
|
500
|
+
#### Step 2.0: Greenfield Detection & Setup
|
|
501
|
+
|
|
502
|
+
**Before exploring the codebase, check if this is a greenfield project.**
|
|
503
|
+
|
|
504
|
+
##### Detection
|
|
505
|
+
|
|
506
|
+
Check for project indicators:
|
|
507
|
+
```
|
|
508
|
+
- .git directory exists?
|
|
509
|
+
- package.json / go.mod / pyproject.toml / Cargo.toml / etc.?
|
|
510
|
+
- src/ or lib/ directories with code files?
|
|
511
|
+
- Any meaningful source files?
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**If ALL indicators are missing → Greenfield project → Trigger setup flow**
|
|
515
|
+
|
|
516
|
+
##### Essential Setup Flow
|
|
517
|
+
|
|
518
|
+
When greenfield is detected, present:
|
|
519
|
+
|
|
520
|
+
```
|
|
521
|
+
This looks like a new project without existing setup.
|
|
522
|
+
|
|
523
|
+
Before we create the PRD, let's establish the foundation:
|
|
524
|
+
|
|
525
|
+
**Git Setup**
|
|
526
|
+
- Initialize repository with .gitignore
|
|
527
|
+
- Create branching structure: main + develop (git flow ready)
|
|
528
|
+
- Initial commit with project structure
|
|
529
|
+
|
|
530
|
+
**Project Structure** (based on {detected project type from Phase 1})
|
|
531
|
+
{Show recommended minimal structure for the project type}
|
|
532
|
+
|
|
533
|
+
**Package Setup**
|
|
534
|
+
- Initialize {package.json / pyproject.toml / go.mod / etc.}
|
|
535
|
+
- Add essential dev dependencies
|
|
536
|
+
|
|
537
|
+
Proceed with this setup?
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Use AskUserQuestion:
|
|
541
|
+
- "Yes, set up essentials" (Recommended)
|
|
542
|
+
- "Customize setup first"
|
|
543
|
+
- "Skip - I'll set up manually"
|
|
544
|
+
|
|
545
|
+
##### Essential Setup by Project Type
|
|
546
|
+
|
|
547
|
+
| Project Type | Git | Structure | Package Init |
|
|
548
|
+
|--------------|-----|-----------|--------------|
|
|
549
|
+
| **Web App (Node)** | .gitignore (node) | `src/`, `tests/`, `public/` | package.json with scripts |
|
|
550
|
+
| **Web App (Python)** | .gitignore (python) | `src/`, `tests/` | pyproject.toml |
|
|
551
|
+
| **CLI Tool (Node)** | .gitignore (node) | `src/`, `bin/`, `tests/` | package.json with bin |
|
|
552
|
+
| **CLI Tool (Go)** | .gitignore (go) | `cmd/`, `internal/`, `pkg/` | go.mod |
|
|
553
|
+
| **API/Backend** | .gitignore (lang) | `src/`, `tests/`, `config/` | Language-specific |
|
|
554
|
+
| **Library** | .gitignore (lang) | `src/`, `tests/`, `examples/` | Language-specific |
|
|
555
|
+
|
|
556
|
+
##### Executing Essential Setup
|
|
557
|
+
|
|
558
|
+
When user confirms, execute these commands:
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
# Git initialization
|
|
562
|
+
git init
|
|
563
|
+
git checkout -b main
|
|
564
|
+
git checkout -b develop
|
|
565
|
+
|
|
566
|
+
# Create .gitignore (language-appropriate)
|
|
567
|
+
# Create initial directory structure
|
|
568
|
+
# Initialize package manager
|
|
569
|
+
|
|
570
|
+
# Initial commit
|
|
571
|
+
git add .
|
|
572
|
+
git commit -m "Initial project setup
|
|
573
|
+
|
|
574
|
+
- Initialize git with main/develop branches
|
|
575
|
+
- Add .gitignore for {language}
|
|
576
|
+
- Create project structure
|
|
577
|
+
- Initialize {package manager}
|
|
578
|
+
|
|
579
|
+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
|
580
|
+
|
|
581
|
+
# Return to develop for feature work
|
|
582
|
+
git checkout develop
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
##### Foundation PRD Offer
|
|
586
|
+
|
|
587
|
+
After essential setup completes (or if user skipped), offer comprehensive setup as a tracked PRD:
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
Foundation is ready. Would you like to track additional setup as a PRD?
|
|
591
|
+
|
|
592
|
+
A Foundation PRD would include:
|
|
593
|
+
- CI/CD pipeline (GitHub Actions / GitLab CI)
|
|
594
|
+
- Linting & formatting (ESLint+Prettier / Ruff / etc.)
|
|
595
|
+
- Testing framework setup
|
|
596
|
+
- Environment configuration (.env patterns)
|
|
597
|
+
- Pre-commit hooks
|
|
598
|
+
- Documentation structure
|
|
599
|
+
|
|
600
|
+
This gets tracked in Flux so you can implement it systematically.
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
Use AskUserQuestion:
|
|
604
|
+
- "Create Foundation PRD" - Creates PRD with [tag: foundation], then continues to feature PRD
|
|
605
|
+
- "Skip - continue to feature PRD" (Recommended for simple projects)
|
|
606
|
+
|
|
607
|
+
##### Foundation PRD Template
|
|
608
|
+
|
|
609
|
+
If user wants a Foundation PRD, create it with this structure:
|
|
610
|
+
|
|
611
|
+
```markdown
|
|
612
|
+
# Project Foundation
|
|
613
|
+
|
|
614
|
+
> **Tag**: foundation
|
|
615
|
+
> **Depends on**: None
|
|
616
|
+
> **Blocks**: All feature PRDs
|
|
617
|
+
|
|
618
|
+
## Problem
|
|
619
|
+
|
|
620
|
+
New projects without proper tooling lead to inconsistent code quality,
|
|
621
|
+
manual testing overhead, and deployment friction.
|
|
622
|
+
|
|
623
|
+
## Users
|
|
624
|
+
|
|
625
|
+
Developers working on this codebase.
|
|
626
|
+
|
|
627
|
+
## Solution
|
|
628
|
+
|
|
629
|
+
Establish development infrastructure: CI/CD, code quality tools, testing
|
|
630
|
+
framework, and environment management.
|
|
631
|
+
|
|
632
|
+
## Features
|
|
633
|
+
|
|
634
|
+
### P0: Must Have
|
|
635
|
+
|
|
636
|
+
- **CI Pipeline**: Automated testing on push/PR
|
|
637
|
+
- **What**: GitHub Actions (or GitLab CI) workflow for test/lint/build
|
|
638
|
+
- **Not**: Deployment pipelines (separate PRD), complex matrix builds
|
|
639
|
+
- **Acceptance Criteria**:
|
|
640
|
+
- [ ] Push to any branch triggers CI
|
|
641
|
+
- [ ] PR cannot merge if CI fails
|
|
642
|
+
- [ ] CI runs tests, linting, and type checking
|
|
643
|
+
|
|
644
|
+
- **Code Quality**: Linting and formatting
|
|
645
|
+
- **What**: {ESLint+Prettier / Biome / Ruff / etc.} with pre-commit hooks
|
|
646
|
+
- **Not**: Custom rules beyond standard configs
|
|
647
|
+
- **Acceptance Criteria**:
|
|
648
|
+
- [ ] `{lint command}` runs without errors on codebase
|
|
649
|
+
- [ ] Pre-commit hook prevents committing unlinted code
|
|
650
|
+
- [ ] Editor integration documented in README
|
|
651
|
+
|
|
652
|
+
- **Testing Framework**: Test infrastructure
|
|
653
|
+
- **What**: {Jest/Vitest / Pytest / Go test} configured with coverage
|
|
654
|
+
- **Not**: E2E tests, integration test infrastructure
|
|
655
|
+
- **Acceptance Criteria**:
|
|
656
|
+
- [ ] `{test command}` runs and reports coverage
|
|
657
|
+
- [ ] Example test file demonstrates testing patterns
|
|
658
|
+
- [ ] Coverage threshold configured (suggest 70%)
|
|
659
|
+
|
|
660
|
+
### P1: Should Have
|
|
661
|
+
|
|
662
|
+
- **Environment Config**: .env management
|
|
663
|
+
- .env.example with all required variables documented
|
|
664
|
+
- Validation on startup for required env vars
|
|
665
|
+
|
|
666
|
+
- **Documentation**: README and contributing guide
|
|
667
|
+
- Setup instructions
|
|
668
|
+
- Development workflow
|
|
669
|
+
- How to run tests
|
|
670
|
+
|
|
671
|
+
### Out of Scope
|
|
672
|
+
- Deployment pipelines (separate DevOps PRD)
|
|
673
|
+
- Production infrastructure
|
|
674
|
+
- Monitoring and observability
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
After creating Foundation PRD, continue to the user's feature PRD with proper dependency:
|
|
678
|
+
- Set feature PRD's `Depends on: {Foundation PRD ref}`
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
#### Step 2.1: Codebase Exploration
|
|
683
|
+
|
|
684
|
+
Spawn a research agent to:
|
|
685
|
+
1. **Explore the codebase** (if exists):
|
|
686
|
+
- Project structure and patterns
|
|
687
|
+
- Existing similar features
|
|
688
|
+
- Tech stack and testing approach
|
|
689
|
+
2. **Research externally** (if needed):
|
|
690
|
+
- Similar solutions in the ecosystem
|
|
691
|
+
- Best practices for this type of feature
|
|
692
|
+
- Potential libraries or tools
|
|
693
|
+
|
|
694
|
+
**Output**: Technical context section of the PRD.
|
|
695
|
+
|
|
696
|
+
### Phase 3: Generate (Create AI-Ready PRD)
|
|
697
|
+
|
|
698
|
+
**Goal**: Produce a PRD ready for breakdown and implementation.
|
|
699
|
+
|
|
700
|
+
1. **Draft PRD** using the template structure above
|
|
701
|
+
2. **Review with user**: Present outline, ask for feedback
|
|
702
|
+
3. **Refine**: Incorporate feedback
|
|
703
|
+
4. **Store**:
|
|
704
|
+
- Local adapter: Write to `.flux/prds/{slug}/prd.md`
|
|
705
|
+
- External adapter: Store in description field
|
|
706
|
+
5. **Offer supporting docs** based on project type
|
|
707
|
+
|
|
708
|
+
---
|
|
709
|
+
|
|
710
|
+
## Quality Checklist
|
|
711
|
+
|
|
712
|
+
Before finalizing a PRD, verify:
|
|
713
|
+
|
|
714
|
+
### Scope
|
|
715
|
+
- [ ] PRD is right-sized (15-25 tasks when broken down)
|
|
716
|
+
- [ ] Scope is achievable in 1-3 weeks
|
|
717
|
+
- [ ] Features are cohesive (belong together)
|
|
718
|
+
- [ ] If multi-PRD project, dependencies are documented
|
|
719
|
+
- [ ] Tag is assigned (foundation/mvp/post-mvp/etc.)
|
|
720
|
+
|
|
721
|
+
### Content
|
|
722
|
+
- [ ] Problem statement is specific (not generic)
|
|
723
|
+
- [ ] Solution clearly addresses the problem
|
|
724
|
+
- [ ] Each P0 feature has acceptance criteria
|
|
725
|
+
- [ ] Acceptance criteria are testable (pass/fail determinable)
|
|
726
|
+
- [ ] Edge cases are identified for complex features
|
|
727
|
+
- [ ] Technical context reflects actual codebase (if applicable)
|
|
728
|
+
- [ ] Out of Scope is explicit about what's NOT included
|
|
729
|
+
- [ ] Open Questions are actionable (can be resolved)
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
## Anti-Patterns to Avoid
|
|
734
|
+
|
|
735
|
+
### 1. Solution Masquerading as Problem
|
|
736
|
+
❌ "We need a React dashboard"
|
|
737
|
+
✅ "Users can't see their data at a glance"
|
|
738
|
+
|
|
739
|
+
### 2. Implementation Details in Features
|
|
740
|
+
❌ "Use Redux for state management"
|
|
741
|
+
✅ "App state persists across page refreshes"
|
|
742
|
+
|
|
743
|
+
### 3. Vague Acceptance Criteria
|
|
744
|
+
❌ "System should be fast"
|
|
745
|
+
✅ "API responses complete in < 200ms for 95th percentile"
|
|
746
|
+
|
|
747
|
+
### 4. Missing Scope Boundaries
|
|
748
|
+
❌ "User management" (how much?)
|
|
749
|
+
✅ "User management: CRUD for users. No roles, no permissions, no team features."
|
|
750
|
+
|
|
751
|
+
### 5. Ignoring Existing Patterns
|
|
752
|
+
❌ Proposing new patterns when established ones exist
|
|
753
|
+
✅ "Following existing auth middleware pattern in `src/middleware/auth.ts`"
|
|
754
|
+
|
|
755
|
+
### 6. Boiling the Ocean
|
|
756
|
+
❌ "Build a complete e-commerce platform with user accounts, product catalog, shopping cart, checkout, payments, order management, inventory, shipping integration, admin dashboard, analytics, and mobile apps"
|
|
757
|
+
✅ Split into 8-10 focused PRDs with clear dependencies
|
|
758
|
+
|
|
759
|
+
### 7. Orphan PRDs
|
|
760
|
+
❌ Creating a PRD that can't be implemented without undefined prerequisites
|
|
761
|
+
✅ Explicitly list dependencies; create foundation PRDs first
|