@pageai/ralph-loop 1.0.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.
Files changed (120) hide show
  1. package/.agent/PROMPT.md +58 -0
  2. package/.agent/STEERING.md +3 -0
  3. package/.agent/logs/LOG.md +13 -0
  4. package/.agent/prd/.gitkeep +0 -0
  5. package/.agent/screenshots/.gitkeep +0 -0
  6. package/.agent/skills/component-refactoring/SKILL.md +247 -0
  7. package/.agent/skills/component-refactoring/references/complexity-patterns.md +485 -0
  8. package/.agent/skills/component-refactoring/references/component-splitting.md +419 -0
  9. package/.agent/skills/component-refactoring/references/hook-extraction.md +317 -0
  10. package/.agent/skills/e2e-tester/SKILL.md +595 -0
  11. package/.agent/skills/frontend-code-review/SKILL.md +73 -0
  12. package/.agent/skills/frontend-code-review/references/code-quality.md +28 -0
  13. package/.agent/skills/frontend-code-review/references/performance.md +36 -0
  14. package/.agent/skills/frontend-testing/SKILL.md +316 -0
  15. package/.agent/skills/frontend-testing/assets/component-test.template.tsx +293 -0
  16. package/.agent/skills/frontend-testing/assets/hook-test.template.ts +207 -0
  17. package/.agent/skills/frontend-testing/assets/utility-test.template.ts +154 -0
  18. package/.agent/skills/frontend-testing/references/async-testing.md +345 -0
  19. package/.agent/skills/frontend-testing/references/checklist.md +188 -0
  20. package/.agent/skills/frontend-testing/references/common-patterns.md +449 -0
  21. package/.agent/skills/frontend-testing/references/mocking.md +289 -0
  22. package/.agent/skills/frontend-testing/references/workflow.md +265 -0
  23. package/.agent/skills/prd-creator/JSON.md +613 -0
  24. package/.agent/skills/prd-creator/PRD.md +196 -0
  25. package/.agent/skills/prd-creator/SKILL.md +143 -0
  26. package/.agent/skills/skill-creator/SKILL.md +355 -0
  27. package/.agent/skills/skill-creator/references/output-patterns.md +86 -0
  28. package/.agent/skills/skill-creator/references/workflows.md +28 -0
  29. package/.agent/skills/skill-creator/scripts/init_skill.py +300 -0
  30. package/.agent/skills/skill-creator/scripts/package_skill.py +110 -0
  31. package/.agent/skills/vercel-react-best-practices/AGENTS.md +2249 -0
  32. package/.agent/skills/vercel-react-best-practices/SKILL.md +125 -0
  33. package/.agent/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  34. package/.agent/skills/vercel-react-best-practices/rules/advanced-use-latest.md +49 -0
  35. package/.agent/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  36. package/.agent/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  37. package/.agent/skills/vercel-react-best-practices/rules/async-dependencies.md +36 -0
  38. package/.agent/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  39. package/.agent/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  40. package/.agent/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  41. package/.agent/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  42. package/.agent/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  43. package/.agent/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  44. package/.agent/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  45. package/.agent/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  46. package/.agent/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  47. package/.agent/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +82 -0
  48. package/.agent/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  49. package/.agent/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  50. package/.agent/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  51. package/.agent/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  52. package/.agent/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  53. package/.agent/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  54. package/.agent/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  55. package/.agent/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  56. package/.agent/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  57. package/.agent/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  58. package/.agent/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  59. package/.agent/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  60. package/.agent/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  61. package/.agent/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  62. package/.agent/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  63. package/.agent/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  64. package/.agent/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  65. package/.agent/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  66. package/.agent/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  67. package/.agent/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  68. package/.agent/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  69. package/.agent/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  70. package/.agent/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  71. package/.agent/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  72. package/.agent/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  73. package/.agent/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  74. package/.agent/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  75. package/.agent/skills/vercel-react-best-practices/rules/server-cache-react.md +26 -0
  76. package/.agent/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +79 -0
  77. package/.agent/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  78. package/.agent/skills/vitest-best-practices/AGENTS.md +84 -0
  79. package/.agent/skills/vitest-best-practices/SKILL.md +130 -0
  80. package/.agent/skills/vitest-best-practices/references/aaa-pattern.md +260 -0
  81. package/.agent/skills/vitest-best-practices/references/assertions.md +393 -0
  82. package/.agent/skills/vitest-best-practices/references/async-testing.md +454 -0
  83. package/.agent/skills/vitest-best-practices/references/error-handling.md +382 -0
  84. package/.agent/skills/vitest-best-practices/references/organization.md +212 -0
  85. package/.agent/skills/vitest-best-practices/references/parameterized-tests.md +297 -0
  86. package/.agent/skills/vitest-best-practices/references/performance.md +528 -0
  87. package/.agent/skills/vitest-best-practices/references/snapshot-testing.md +483 -0
  88. package/.agent/skills/vitest-best-practices/references/test-doubles.md +499 -0
  89. package/.agent/skills/vitest-best-practices/references/vitest-features.md +529 -0
  90. package/.agent/skills/web-design-guidelines/SKILL.md +39 -0
  91. package/.agent/tasks/.gitkeep +0 -0
  92. package/.agent/tasks.json +1 -0
  93. package/.claude/agents/code-reviewer.md +172 -0
  94. package/.claude/commands/aw.md +50 -0
  95. package/.claude/hooks/play-sound.js +87 -0
  96. package/.claude/hooks/pre-tool-use.js +40 -0
  97. package/.claude/settings.json +54 -0
  98. package/.claude/settings.local.json +13 -0
  99. package/.mcp.json +31 -0
  100. package/AGENTS.md +44 -0
  101. package/CLAUDE.md +1 -0
  102. package/README.md +236 -0
  103. package/bin/cli.js +156 -0
  104. package/bin/lib/copy.js +149 -0
  105. package/bin/lib/display.js +137 -0
  106. package/package.json +65 -0
  107. package/ralph.sh +333 -0
  108. package/scripts/lib/args.sh +44 -0
  109. package/scripts/lib/cleanup.sh +53 -0
  110. package/scripts/lib/constants.sh +25 -0
  111. package/scripts/lib/display.sh +196 -0
  112. package/scripts/lib/logging.sh +30 -0
  113. package/scripts/lib/notify.sh +41 -0
  114. package/scripts/lib/output.sh +147 -0
  115. package/scripts/lib/preflight.sh +57 -0
  116. package/scripts/lib/preview.sh +77 -0
  117. package/scripts/lib/promise.sh +76 -0
  118. package/scripts/lib/spinner.sh +85 -0
  119. package/scripts/lib/terminal.sh +57 -0
  120. package/scripts/lib/timing.sh +223 -0
@@ -0,0 +1,613 @@
1
+ # Implementation Task Generation
2
+
3
+ Transform the completed PRD into simple, concise, actionable and verifiable implementation tasks in JSON format. This creates a comprehensive task list for developers (human or AI) to build and verify the product.
4
+
5
+ ## When to Use
6
+
7
+ After completing PRD creation, ask the user:
8
+ "Your PRD is complete. Would you like me to generate implementation tasks? I'll create a comprehensive JSON task list that breaks down all features into verifiable development work."
9
+
10
+ Only proceed after user confirmation.
11
+
12
+ ## Task Generation Workflow
13
+
14
+ You should read the PRD markdown file located in `PROJECT_ROOT/.agent/prd/PRD.md`.
15
+ Each task in the PRD will have a unique ID, formatted as `TASK-${ID}`.
16
+ You should use this ID to generate the task list.
17
+
18
+ Copy and track progress:
19
+
20
+ ```
21
+ Task Generation Progress:
22
+ - [ ] Analyze the complete PRD
23
+ - [ ] Generate task index in `PROJECT_ROOT/.agent/tasks.json`
24
+ - [ ] Generate detailed spec for each task in `PROJECT_ROOT/.agent/tasks/TASK-${ID}.json`
25
+ - [ ] Present complete task list to user for review
26
+ ```
27
+
28
+ ## Root task list format
29
+
30
+ Each task must follow this exact structure:
31
+
32
+ ```json:PROJECT_ROOT/.agent/tasks.json
33
+ {
34
+ "id": "TASK-${ID}",
35
+ "title": "Clear, concise title of the task",
36
+ "category": "category-name",
37
+ "specFilePath": ".agent/tasks/TASK-${ID}.json",
38
+ "passes": false
39
+ }
40
+ ```
41
+
42
+ **Field Requirements:**
43
+
44
+ - `id`: Unique identifier for the task, formatted as `TASK-${ID}`
45
+ - `title`: A title that gives a high level overview of the task
46
+ - `category`: Classification of task type (see categories below)
47
+ - `title`: A title that gives a high level overview of the task.
48
+ - `specFilePath`: Path to the individual task specification file, formatted as `PROJECT_ROOT/.agent/tasks/TASK-${ID}.json`
49
+ - `passes`: Always initialize to `false` - only developers update this after completion
50
+
51
+ ## Individual JSON Task Format
52
+
53
+ Each task specification file provides comprehensive details for implementation. This is where the real detail lives - the root `tasks.json` is just an index.
54
+
55
+ ```json:PROJECT_ROOT/.agent/tasks/TASK-${ID}.json
56
+ {
57
+ "id": "TASK-${ID}",
58
+ "title": "Clear, concise title of the task",
59
+ "category": "category-name",
60
+ "description": "In-depth specification including expected behavior, user flow, and output",
61
+ "acceptanceCriteria": [
62
+ "List of specific, verifiable conditions that must be true when task is complete",
63
+ ],
64
+ "steps": [
65
+ // List of complete steps to complete the task
66
+ {
67
+ "step": 1,
68
+ "description": "Short description of what to do",
69
+ "details": "Detailed explanation of HOW to do it, including specific code, commands, or techniques",
70
+ "pass": false
71
+ },
72
+ // ... continue until you cover all steps in the task
73
+ ],
74
+ "dependencies": ["TASK-${ID1}", "TASK-${ID2}", ...], // List of task IDs that must be completed before this task
75
+ "estimatedComplexity": "medium", // One of: "low", "medium", "high", "very high"
76
+ "technicalNotes": [
77
+ "List of technical notes, implementation hints, or technical constraints developers should know",
78
+ ]
79
+ }
80
+ ```
81
+
82
+ ### Required Fields
83
+
84
+ | Field | Type | Description |
85
+ | -------------------- | --------------------- | ------------------------------------------------------------------------------- |
86
+ | `id` | string | Unique identifier, formatted as `TASK-${ID}` |
87
+ | `title` | string | High-level overview of the task (same as in tasks.json) |
88
+ | `category` | string | Classification of task type (see categories below) |
89
+ | `description` | string | In-depth specification including expected behavior, user flow, and output |
90
+ | `acceptanceCriteria` | array of strings | List of specific, verifiable conditions that must be true when task is complete |
91
+ | `steps` | array of step objects | Sequential implementation steps (see step format below) |
92
+
93
+ ### Optional Fields
94
+
95
+ | Field | Type | Description |
96
+ | --------------------- | ---------------- | -------------------------------------------------------------------------------- |
97
+ | `dependencies` | array of strings | Task IDs that must be completed before this task (e.g., `["TASK-5", "TASK-12"]`) |
98
+ | `estimatedComplexity` | string | One of: `"low"`, `"medium"`, `"high"`, `"very high"` - helps with planning |
99
+ | `technicalNotes` | array of strings | Implementation hints, gotchas, or technical constraints developers should know |
100
+
101
+ ### Step Object Format
102
+
103
+ Each step in the `steps` array must be an object with these fields:
104
+
105
+ ```json
106
+ {
107
+ "step": 1,
108
+ "description": "Short description of what to do",
109
+ "details": "Detailed explanation of HOW to do it, including specific code, commands, or techniques",
110
+ "pass": false
111
+ }
112
+ ```
113
+
114
+ | Field | Type | Description |
115
+ | ------------- | ------- | ------------------------------------------------------------------------------------ |
116
+ | `step` | number | Sequential step number (1, 2, 3...) |
117
+ | `description` | string | Brief summary of the step (what to do) |
118
+ | `details` | string | Comprehensive implementation guidance (how to do it) |
119
+ | `pass` | boolean | Always initialize to `false` - only update to `true` after step is verified complete |
120
+
121
+ ### Writing Good Acceptance Criteria
122
+
123
+ Acceptance criteria define WHAT must be true when the task is done. They should be:
124
+
125
+ - **Specific**: "Button shows loading spinner while API call is in progress"
126
+ - **Verifiable**: Can be checked with a clear yes/no answer
127
+ - **Independent**: Each criterion stands alone
128
+ - **Complete**: Together they fully define "done"
129
+
130
+ **Good acceptance criteria:**
131
+ ```json
132
+ "acceptanceCriteria": [
133
+ "Login form validates email format before submission",
134
+ "Invalid email shows error message 'Please enter a valid email'",
135
+ "Submit button is disabled while form is invalid",
136
+ "Successful login redirects to /dashboard",
137
+ "Failed login shows error message from API response"
138
+ ]
139
+ ```
140
+
141
+ **Bad acceptance criteria:**
142
+ ```json
143
+ "acceptanceCriteria": [
144
+ "Login works correctly",
145
+ "Form validation is good",
146
+ "Handles errors properly"
147
+ ]
148
+ ```
149
+
150
+ ### Writing Good Steps
151
+
152
+ Steps define HOW to implement the task. They should be:
153
+
154
+ - **Sequential**: Each step builds on the previous
155
+ - **Detailed**: Include specific code patterns, function names, file paths
156
+ - **Atomic**: Each step is a single, focused piece of work
157
+ - **Trackable**: The `pass` field lets developers mark progress
158
+
159
+ **Good steps:**
160
+ ```json
161
+ "steps": [
162
+ {
163
+ "step": 1,
164
+ "description": "Create the LoginForm component file",
165
+ "details": "Create src/components/LoginForm.tsx with a functional component that accepts onSubmit and onError props. Use React Hook Form for form state management.",
166
+ "pass": false
167
+ },
168
+ {
169
+ "step": 2,
170
+ "description": "Add email validation",
171
+ "details": "Use zod schema to validate email format. Schema should check for: non-empty, valid email regex, max 255 characters. Display validation error below input field.",
172
+ "pass": false
173
+ }
174
+ ]
175
+ ```
176
+
177
+ **Bad steps:**
178
+ ```json
179
+ "steps": [
180
+ {
181
+ "step": 1,
182
+ "description": "Build the form",
183
+ "details": "Create the login form",
184
+ "pass": false
185
+ }
186
+ ]
187
+ ```
188
+
189
+ ### Using Dependencies
190
+
191
+ The `dependencies` field helps establish task order and prevents starting work before prerequisites are complete.
192
+
193
+ ```json
194
+ "dependencies": ["TASK-5", "TASK-12"]
195
+ ```
196
+
197
+ Use dependencies when:
198
+ - A task requires functionality from another task
199
+ - A task builds on data structures defined elsewhere
200
+ - A task needs UI components created in another task
201
+
202
+ ### Using Technical Notes
203
+
204
+ Technical notes capture implementation knowledge that isn't obvious from the description or steps.
205
+
206
+ ```json
207
+ "technicalNotes": [
208
+ "Bash associative arrays require declare -A and Bash 4.0+",
209
+ "Use $(date +%s) for timestamp tracking",
210
+ "This function is called from a subshell, so it cannot modify parent variables directly"
211
+ ]
212
+ ```
213
+
214
+ Include notes about:
215
+ - Language/framework version requirements
216
+ - Non-obvious gotchas or edge cases
217
+ - Performance considerations
218
+ - Security implications
219
+ - Links to relevant documentation
220
+
221
+ ## Task Categories
222
+
223
+ Organize tasks into these categories. All examples use the full task spec format with step objects.
224
+
225
+ > **IMPORTANT**: Examples below show 2 steps for brevity. Real tasks should include ALL steps needed to complete the task - typically 3-10 steps depending on complexity. Never truncate steps to fit a pattern.
226
+
227
+ **1. functional** - Core feature implementation and behavior
228
+
229
+ ```json
230
+ {
231
+ "id": "TASK-1",
232
+ "title": "User can create an account with email and password",
233
+ "category": "functional",
234
+ "description": "Implement user registration flow allowing new users to create accounts using email and password credentials.",
235
+ "acceptanceCriteria": [
236
+ "Registration form accepts email and password",
237
+ "Email validation prevents invalid formats",
238
+ "Password must be at least 8 characters",
239
+ "Success message displayed after registration",
240
+ "User can log in with new credentials immediately"
241
+ ],
242
+ "steps": [
243
+ {
244
+ "step": 1,
245
+ "description": "Create registration API endpoint",
246
+ "details": "Create POST /api/auth/register endpoint that accepts email and password in request body. Validate inputs, hash password with bcrypt, store in users table, return success response.",
247
+ "pass": false
248
+ },
249
+ {
250
+ "step": 2,
251
+ "description": "Build registration form component",
252
+ "details": "Create RegistrationForm component with email and password fields. Use React Hook Form for validation. Show inline errors for invalid inputs.",
253
+ "pass": false
254
+ }
255
+ ],
256
+ "dependencies": [],
257
+ "estimatedComplexity": "medium"
258
+ }
259
+ ```
260
+
261
+ **2. ui-ux** - User interface and experience requirements
262
+
263
+ ```json
264
+ {
265
+ "id": "TASK-2",
266
+ "title": "Dashboard displays user's recent activity in a card layout",
267
+ "category": "ui-ux",
268
+ "description": "Show user's recent activity on the dashboard using a responsive card layout that works on desktop and mobile.",
269
+ "acceptanceCriteria": [
270
+ "Activity cards display on dashboard after login",
271
+ "Cards show activity type, timestamp, and status",
272
+ "Layout is responsive - stacks on mobile, grid on desktop",
273
+ "Empty state shown when no activity exists"
274
+ ],
275
+ "steps": [
276
+ {
277
+ "step": 1,
278
+ "description": "Create ActivityCard component",
279
+ "details": "Create src/components/ActivityCard.tsx that accepts activity object as prop. Display type icon, formatted timestamp (use date-fns), and status badge with appropriate color.",
280
+ "pass": false
281
+ },
282
+ {
283
+ "step": 2,
284
+ "description": "Implement responsive grid layout",
285
+ "details": "Use CSS Grid with grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) for responsive behavior. Add gap of 1rem between cards.",
286
+ "pass": false
287
+ }
288
+ ],
289
+ "estimatedComplexity": "low"
290
+ }
291
+ ```
292
+
293
+ **3. data-model** - Database schema, data structures, and relationships
294
+
295
+ ```json
296
+ {
297
+ "id": "TASK-3",
298
+ "title": "User profile table with required fields and relationships",
299
+ "category": "data-model",
300
+ "description": "Create users table with proper schema, constraints, and relationships to support authentication and profile features.",
301
+ "acceptanceCriteria": [
302
+ "Users table exists with: id, email, name, avatar_url, created_at",
303
+ "Email field has unique constraint",
304
+ "Foreign key relationship to auth table exists",
305
+ "Indexes exist on email and created_at fields"
306
+ ],
307
+ "steps": [
308
+ {
309
+ "step": 1,
310
+ "description": "Create users table migration",
311
+ "details": "Create migration file with CREATE TABLE users statement. Include columns: id (UUID primary key), email (VARCHAR 255 UNIQUE NOT NULL), name (VARCHAR 255), avatar_url (TEXT), created_at (TIMESTAMP DEFAULT NOW()).",
312
+ "pass": false
313
+ },
314
+ {
315
+ "step": 2,
316
+ "description": "Add indexes for query performance",
317
+ "details": "Add CREATE INDEX statements for email (for login lookups) and created_at (for sorting). Use btree index type.",
318
+ "pass": false
319
+ }
320
+ ],
321
+ "technicalNotes": [
322
+ "Use UUID v4 for primary keys to avoid sequential ID enumeration"
323
+ ],
324
+ "estimatedComplexity": "low"
325
+ }
326
+ ```
327
+
328
+ **4. api-endpoint** - Backend API endpoints and responses
329
+
330
+ ```json
331
+ {
332
+ "id": "TASK-4",
333
+ "title": "POST /api/auth/login endpoint authenticates users",
334
+ "category": "api-endpoint",
335
+ "description": "Implement login endpoint that validates credentials and returns JWT token for authenticated sessions.",
336
+ "acceptanceCriteria": [
337
+ "Endpoint accepts POST with email and password",
338
+ "Valid credentials return 200 with JWT token",
339
+ "Token contains user ID and email claims",
340
+ "Invalid credentials return 401 with error message"
341
+ ],
342
+ "steps": [
343
+ {
344
+ "step": 1,
345
+ "description": "Create login route handler",
346
+ "details": "Create POST /api/auth/login handler. Extract email and password from request body. Query users table for matching email. Compare password hash using bcrypt.compare().",
347
+ "pass": false
348
+ },
349
+ {
350
+ "step": 2,
351
+ "description": "Implement JWT token generation",
352
+ "details": "Use jsonwebtoken library to sign token with user ID and email as payload. Set expiration to 24h. Use RS256 algorithm with private key from environment variable.",
353
+ "pass": false
354
+ }
355
+ ],
356
+ "dependencies": ["TASK-3"],
357
+ "technicalNotes": [
358
+ "Never log passwords, even in error cases",
359
+ "Use constant-time comparison for password to prevent timing attacks"
360
+ ],
361
+ "estimatedComplexity": "medium"
362
+ }
363
+ ```
364
+
365
+ **5. integration** - Third-party service integrations and external dependencies
366
+
367
+ ```json
368
+ {
369
+ "id": "TASK-5",
370
+ "title": "Stripe payment processing integration works end-to-end",
371
+ "category": "integration",
372
+ "description": "Integrate Stripe for payment processing including checkout flow, webhook handling, and order status updates.",
373
+ "acceptanceCriteria": [
374
+ "Checkout creates Stripe PaymentIntent",
375
+ "User can complete payment with test card",
376
+ "Webhook receives payment.succeeded event",
377
+ "Order status updates to 'paid' on success"
378
+ ],
379
+ "steps": [
380
+ {
381
+ "step": 1,
382
+ "description": "Set up Stripe SDK and API keys",
383
+ "details": "Install @stripe/stripe-js and stripe packages. Add STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY to environment. Create stripe client instance in lib/stripe.ts.",
384
+ "pass": false
385
+ },
386
+ {
387
+ "step": 2,
388
+ "description": "Implement webhook handler",
389
+ "details": "Create POST /api/webhooks/stripe endpoint. Verify webhook signature using stripe.webhooks.constructEvent(). Handle payment_intent.succeeded event to update order status.",
390
+ "pass": false
391
+ }
392
+ ],
393
+ "dependencies": ["TASK-3", "TASK-4"],
394
+ "technicalNotes": [
395
+ "Always verify webhook signatures to prevent spoofed events",
396
+ "Test with Stripe CLI: stripe listen --forward-to localhost:3000/api/webhooks/stripe"
397
+ ],
398
+ "estimatedComplexity": "high"
399
+ }
400
+ ```
401
+
402
+ **6. security** - Security features, authentication, authorization
403
+
404
+ ```json
405
+ {
406
+ "id": "TASK-6",
407
+ "title": "API endpoints enforce role-based access control",
408
+ "category": "security",
409
+ "description": "Implement middleware that enforces role-based access control on protected API endpoints.",
410
+ "acceptanceCriteria": [
411
+ "Admin endpoints return 403 for regular users",
412
+ "Endpoints without auth token return 401",
413
+ "JWT signature is validated on every request",
414
+ "Expired tokens are rejected with 401"
415
+ ],
416
+ "steps": [
417
+ {
418
+ "step": 1,
419
+ "description": "Create auth middleware",
420
+ "details": "Create middleware/auth.ts that extracts Bearer token from Authorization header, verifies JWT signature, attaches decoded user to request object. Return 401 if token missing or invalid.",
421
+ "pass": false
422
+ },
423
+ {
424
+ "step": 2,
425
+ "description": "Create role-checking middleware",
426
+ "details": "Create middleware/requireRole.ts that accepts required role as parameter. Check req.user.role against required role, return 403 if insufficient permissions.",
427
+ "pass": false
428
+ }
429
+ ],
430
+ "dependencies": ["TASK-4"],
431
+ "technicalNotes": [
432
+ "Log failed auth attempts for security monitoring",
433
+ "Consider rate limiting on auth endpoints to prevent brute force"
434
+ ],
435
+ "estimatedComplexity": "medium"
436
+ }
437
+ ```
438
+
439
+ **7. documentation** - Technical documentation, API docs, user guides
440
+
441
+ ```json
442
+ {
443
+ "id": "TASK-7",
444
+ "title": "API documentation covers all endpoints with examples",
445
+ "category": "documentation",
446
+ "description": "Create comprehensive API documentation using OpenAPI/Swagger that covers all endpoints with request/response examples.",
447
+ "acceptanceCriteria": [
448
+ "All endpoints documented in OpenAPI spec",
449
+ "Each endpoint has description, parameters, and responses",
450
+ "Interactive docs accessible at /api/docs",
451
+ "Authentication flow clearly documented"
452
+ ],
453
+ "steps": [
454
+ {
455
+ "step": 1,
456
+ "description": "Set up OpenAPI documentation",
457
+ "details": "Install swagger-jsdoc and swagger-ui-express. Create openapi.config.ts with API info, servers, and security schemes. Add JSDoc comments to route handlers.",
458
+ "pass": false
459
+ },
460
+ {
461
+ "step": 2,
462
+ "description": "Document authentication endpoints",
463
+ "details": "Add OpenAPI annotations to /api/auth/register and /api/auth/login. Include request body schemas, response schemas for success and error cases, and example values.",
464
+ "pass": false
465
+ }
466
+ ],
467
+ "estimatedComplexity": "low"
468
+ }
469
+ ```
470
+
471
+ ## Task Generation Guidelines
472
+
473
+ ### Be Comprehensive
474
+
475
+ Generate tasks that cover the entire PRD. Break down every feature into small, manageable tasks.
476
+ Keep the main task list JSON concise and go into detail in the individual task files.
477
+
478
+ **Example**: For "User Authentication" feature, generate tasks for:
479
+ - User table schema
480
+ - Registration endpoint
481
+ - Login endpoint
482
+ - Password reset endpoint
483
+ - JWT token generation
484
+ - Session management
485
+ - Registration UI
486
+ - Login UI
487
+ - Password reset UI
488
+ - Security testing (password hashing, rate limiting)
489
+ - Unit tests for all auth functions
490
+ - End to end tests for auth flow
491
+
492
+ ### Make Steps Verifiable
493
+
494
+ Each step must be:
495
+ - **Specific**: "Verify email field has unique constraint" not "Check database"
496
+ - **Actionable**: Can be executed by a developer
497
+ - **Measurable**: Has clear pass/fail criteria
498
+ - **Sequential**: Steps build on each other
499
+
500
+ **Good steps:**
501
+ ```json
502
+ "steps": [
503
+ {
504
+ "step": 1,
505
+ "description": "Create user via API",
506
+ "details": "Send POST request to /api/users with valid data: { email: 'test@example.com', password: 'secure123', name: 'Test User' }",
507
+ "pass": false
508
+ },
509
+ {
510
+ "step": 2,
511
+ "description": "Verify API response",
512
+ "details": "Check response status is 201 and body contains user object with id, email, name (password should NOT be in response)",
513
+ "pass": false
514
+ },
515
+ {
516
+ "step": 3,
517
+ "description": "Confirm database record",
518
+ "details": "Query users table and verify record exists with matching email. Confirm password field contains bcrypt hash (starts with $2b$), not plaintext.",
519
+ "pass": false
520
+ }
521
+ ]
522
+ ```
523
+
524
+ **Bad steps:**
525
+ ```json
526
+ "steps": [
527
+ {
528
+ "step": 1,
529
+ "description": "Test the endpoint",
530
+ "details": "Test it",
531
+ "pass": false
532
+ },
533
+ {
534
+ "step": 2,
535
+ "description": "Make sure it works",
536
+ "details": "Check everything is correct",
537
+ "pass": false
538
+ }
539
+ ]
540
+ ```
541
+
542
+ **Important:**
543
+
544
+ Acceptance criteria must be verifiable, not vague. "Works correctly" is bad. "Button shows confirmation dialog before deleting" is good.
545
+
546
+ For any story with UI changes: Always include "Verify in browser using playwright" as acceptance criteria. This ensures visual verification of frontend work.
547
+
548
+ **Important:**
549
+ Tasks cannot be end to end tests or unit tests. These should be individual steps (verification criteria) in a task, if needed.
550
+
551
+ ### Initialize All Tasks to `"passes": false`
552
+
553
+ **CRITICAL**: Never mark tasks as complete during generation. The `passes` field should ALWAYS be `false` initially.
554
+
555
+ > It is unacceptable to remove or edit items in the task list because this could lead to missing or buggy functionality
556
+
557
+ Only developers should update `passes: true` after verifying all steps are complete.
558
+
559
+ ## Output Format
560
+
561
+ Save the complete task list as `PROJECT_ROOT/.agent/tasks.json`:
562
+
563
+ ```json
564
+ [
565
+ {
566
+ "id": "TASK-${ID}",
567
+ "title": "User table with authentication fields",
568
+ "category": "data-model",
569
+ "specFilePath": ".agent/tasks/TASK-${ID}.json",
570
+ "passes": false
571
+ },
572
+ {
573
+ "id": "TASK-${ID}",
574
+ "title": "POST /api/auth/register creates new user account",
575
+ "category": "api-endpoint",
576
+ "specFilePath": ".agent/tasks/TASK-${ID}.json",
577
+ "passes": false
578
+ }
579
+ // ... continue until you cover all features in the PRD
580
+ ]
581
+ ```
582
+
583
+ ## After Generation
584
+
585
+ Present the tasks to the user:
586
+
587
+ "I've generated [NUMBER] implementation tasks based on your PRD, organized into [NUMBER] categories. These tasks provide a complete checklist for building and verifying every feature.
588
+
589
+ The tasks are saved in `PROJECT_ROOT/.agent/tasks.json`. Developers should:
590
+ 1. Work through tasks in order (data-model → api-endpoint → ui-ux, etc.)
591
+ 2. Complete all verification steps for each task
592
+ 3. Only mark `passes: true` after all steps verified
593
+ 4. Never remove or skip tasks
594
+
595
+ Would you like me to adjust the task breakdown or add more detail? Otherwise, I can save the tasks and move on to writing the overall description of the project and finalizing the process."
596
+
597
+ ## Example: Complete Task Generation
598
+
599
+ For a simple "Todo List App" PRD with features: user auth, create/read/update/delete todos, mark complete, the task list should include approximately 40-60 tasks covering:
600
+
601
+ - User table schema (1 task)
602
+ - Todo table schema (1 task)
603
+ - Auth endpoints: register, login, logout (3 tasks)
604
+ - Todo CRUD endpoints (4 tasks)
605
+ - Auth UI: registration, login pages (2 tasks)
606
+ - Todo UI: list view, create form, edit form (3 tasks)
607
+ - User can only access their own todos (1 security task)
608
+ - OAuth integration with Google (2 integration tasks)
609
+ - API documentation (1 documentation task)
610
+
611
+ Note: Unit tests and E2E tests are verification steps within feature tasks, not separate tasks.
612
+
613
+ Generate similar comprehensive breakdowns for any PRD.