@itz4blitz/agentful 0.2.1 → 0.4.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.
@@ -1,584 +0,0 @@
1
- # Product Specification
2
-
3
- > **Note**: agentful supports **both** flat and hierarchical product structures.
4
- >
5
- > - **Flat Structure** (Recommended for beginners): Single file at project root (this file)
6
- > - **Hierarchical Structure** (For larger projects): `.claude/product/` with separate domain files
7
- >
8
- > This template shows the **flat structure** format. To convert to hierarchical structure, see [Migration Guide](#migration-to-hierarchical-structure) below.
9
-
10
- ## Overview
11
-
12
- [Describe what you're building in 2-3 sentences]
13
-
14
- Example:
15
- > A task management application that helps teams collaborate on projects. Users can create projects, add tasks with deadlines, assign team members, and track progress with real-time updates.
16
-
17
- ## Goals
18
-
19
- - [ ] [Primary goal 1]
20
- - [ ] [Primary goal 2]
21
- - [ ] [Primary goal 3]
22
-
23
- ## Tech Stack
24
-
25
- ### Frontend
26
- - **Framework**: [Next.js 14 / React + Vite / Vue + Nuxt / SvelteKit]
27
- - **Language**: [TypeScript / JavaScript]
28
- - **Styling**: [Tailwind CSS / CSS Modules / styled-components / shadcn/ui]
29
- - **State Management**: [Zustand / Context API / Redux / Jotai]
30
-
31
- ### Backend
32
- - **Runtime**: [Node.js / Bun / Deno]
33
- - **Framework**: [Next.js API Routes / Express / Fastify / NestJS / Hono]
34
- - **Language**: [TypeScript / JavaScript]
35
-
36
- ### Database
37
- - **Database**: [PostgreSQL / MySQL / SQLite / MongoDB / PlanetScale]
38
- - **ORM**: [Prisma / Drizzle / TypeORM / Mongoose]
39
-
40
- ### Authentication
41
- - **Method**: [JWT / NextAuth / Clerk / Auth0 / Lucia]
42
-
43
- ### Testing
44
- - **Unit**: [Vitest / Jest]
45
- - **E2E**: [Playwright / Cypress]
46
-
47
- ### Deployment
48
- - **Hosting**: [Vercel / Netlify / Railway / Fly.io]
49
-
50
- ## Product Structure
51
-
52
- This product is organized into **domains**, which contain **features**, which break down into **subtasks**.
53
-
54
- ### Hierarchical Structure
55
-
56
- ```
57
- Product
58
- └── Domain (e.g., authentication)
59
- └── Feature (e.g., login)
60
- └── Subtask (e.g., create login form)
61
- ```
62
-
63
- **Definitions**:
64
- - **Domain**: A major functional area (e.g., authentication, purchasing, user-management)
65
- - **Feature**: A specific capability within a domain (e.g., login, registration, password-reset)
66
- - **Subtask**: An implementable unit of work (e.g., create UI form, implement API endpoint)
67
-
68
- **Priority Levels**:
69
- - `CRITICAL` - Must have for MVP, blocks other features
70
- - `HIGH` - Important for MVP, should include
71
- - `MEDIUM` - Nice to have if time permits
72
- - `LOW` - Future enhancement, not for MVP
73
-
74
- **Status Tracking**:
75
- - `pending` - Not started
76
- - `in-progress` - Currently being worked on
77
- - `complete` - Done and tested
78
- - `blocked` - Waiting for decision or dependency
79
-
80
- ---
81
-
82
- ## Domain: Authentication
83
-
84
- ### Feature: User Registration - CRITICAL
85
- **Description**: Allow new users to create accounts
86
-
87
- **Subtasks**:
88
-
89
- #### 1. Create registration form UI - CRITICAL
90
- **Status**: pending
91
-
92
- **Acceptance Criteria**:
93
- - [ ] Form includes email, password, and confirm password fields
94
- - [ ] Email validation with regex pattern
95
- - [ ] Password minimum 8 characters with requirements shown
96
- - [ ] Password match validation
97
- - [ ] Submit button disabled until all valid
98
- - [ ] Loading state during submission
99
- - [ ] Error messages display inline
100
- - [ ] Responsive design (mobile and desktop)
101
-
102
- **User Stories**:
103
- - As a new user, I want to create an account with email and password so that I can access the application
104
-
105
- **Technical Notes**:
106
- - Use React Hook Form or similar
107
- - Zod validation schema
108
- - Tailwind CSS for styling
109
-
110
- ---
111
-
112
- #### 2. Implement registration API endpoint - CRITICAL
113
- **Status**: pending
114
-
115
- **Acceptance Criteria**:
116
- - [ ] POST /api/auth/register endpoint created
117
- - [ ] Validates email format and uniqueness
118
- - [ ] Hashes password using bcrypt (cost factor 10)
119
- - [ ] Creates user in database
120
- - [ ] Returns 201 on success with user object (excluding password)
121
- - [ ] Returns 400 for validation errors with specific messages
122
- - [ ] Returns 409 if email already exists
123
- - [ ] Rate limited to 5 requests per minute per IP
124
-
125
- **Technical Notes**:
126
- - Use Prisma/Drizzle for database operations
127
- - Implement rate limiting middleware
128
- - Log registration attempts for monitoring
129
-
130
- ---
131
-
132
- ### Feature: User Login - CRITICAL
133
- **Description**: Allow existing users to authenticate
134
-
135
- **Subtasks**:
136
-
137
- #### 1. Create login form UI - CRITICAL
138
- **Status**: pending
139
-
140
- **Acceptance Criteria**:
141
- - [ ] Form includes email and password fields
142
- - [ ] "Remember me" checkbox
143
- - [ ] "Forgot password" link
144
- - [ ] Link to registration page
145
- - [ ] Client-side validation before submission
146
- - [ ] Loading state during authentication
147
- - [ ] Clear error messages (invalid credentials, account locked, etc.)
148
-
149
- **User Stories**:
150
- - As a returning user, I want to log in with my credentials so that I can access my account
151
-
152
- ---
153
-
154
- #### 2. Implement login API endpoint - CRITICAL
155
- **Status**: pending
156
-
157
- **Acceptance Criteria**:
158
- - [ ] POST /api/auth/login endpoint created
159
- - [ ] Verifies email exists in database
160
- - [ ] Compares hashed password using bcrypt
161
- - [ ] Generates JWT token with 7-day expiration
162
- - [ ] Sets httpOnly cookie with token
163
- - [ ] Returns 200 with user object on success
164
- - [ ] Returns 401 for invalid credentials
165
- - [ ] Implements account lockout after 5 failed attempts
166
- - [ ] Rate limited to 10 requests per minute
167
-
168
- **Technical Notes**:
169
- - Use jose or jsonwebtoken for JWT
170
- - Store failed attempts in Redis or database
171
- - Set secure cookie flags: httpOnly, secure, sameSite
172
-
173
- ---
174
-
175
- ### Feature: Password Reset - HIGH
176
- **Description**: Allow users to reset forgotten passwords
177
-
178
- **Subtasks**:
179
-
180
- #### 1. Create forgot password form - HIGH
181
- **Status**: pending
182
-
183
- **Acceptance Criteria**:
184
- - [ ] Single email input field
185
- - [ ] Submit button to send reset link
186
- - [ ] Success message: "If email exists, reset link sent"
187
- - [ ] Rate limited to 3 requests per hour
188
-
189
- **User Stories**:
190
- - As a user, I want to request a password reset email so that I can regain access to my account
191
-
192
- ---
193
-
194
- #### 2. Implement password reset email flow - HIGH
195
- **Status**: pending
196
-
197
- **Acceptance Criteria**:
198
- - [ ] Generates secure reset token (UUID, expires in 1 hour)
199
- - [ ] Stores token in database with expiration
200
- - [ ] Sends email with reset link containing token
201
- - [ ] Validates token on reset attempt
202
- - [ ] Updates password after validation
203
- - [ ] Invalidates token after use
204
- - [ ] Uses transaction for database updates
205
-
206
- **Technical Notes**:
207
- - Use Resend, SendGrid, or AWS SES for emails
208
- - Store hashed token in database
209
- - Background job for email sending
210
-
211
- ---
212
-
213
- ## Domain: Purchasing
214
-
215
- ### Feature: Product Catalog - CRITICAL
216
- **Description**: Display and browse available products
217
-
218
- **Subtasks**:
219
-
220
- #### 1. Create product listing page - CRITICAL
221
- **Status**: pending
222
-
223
- **Acceptance Criteria**:
224
- - [ ] Grid layout showing product cards
225
- - [ ] Each card displays: image, name, price, short description
226
- - [ ] Pagination or infinite scroll (20 items per page)
227
- - [ ] Loading skeleton while fetching
228
- - [ ] Empty state message when no products
229
- - [ ] Clicking card navigates to product detail page
230
- - [ ] Mobile-responsive (1 column) and desktop (3-4 columns)
231
-
232
- **User Stories**:
233
- - As a customer, I want to browse products so that I can see what's available
234
-
235
- **Technical Notes**:
236
- - Use virtual scrolling for performance
237
- - Cache product list for 5 minutes
238
- - Lazy load images
239
-
240
- ---
241
-
242
- #### 2. Implement product API endpoints - CRITICAL
243
- **Status**: pending
244
-
245
- **Acceptance Criteria**:
246
- - [ ] GET /api/products endpoint with pagination (page, limit)
247
- - [ ] Supports filtering by category, price range
248
- - [ ] Supports sorting by name, price, date
249
- - [ ] Returns 200 with products array and metadata
250
- - [ ] Returns 400 for invalid query parameters
251
- - [ ] Response time < 200ms p95
252
-
253
- **Technical Notes**:
254
- - Use database indexes on category and price
255
- - Implement query validation schema
256
- - Cache popular queries
257
-
258
- ---
259
-
260
- ### Feature: Shopping Cart - HIGH
261
- **Description**: Allow users to manage cart items
262
-
263
- **Subtasks**:
264
-
265
- #### 1. Create cart UI components - HIGH
266
- **Status**: pending
267
-
268
- **Acceptance Criteria**:
269
- - [ ] Cart icon in header showing item count badge
270
- - [ ] Cart drawer/modal for quick access
271
- - [ ] Full cart page with item list
272
- - [ ] Each item shows: image, name, price, quantity controls
273
- - [ ] Remove item button with confirmation
274
- - [ ] Subtotal calculation
275
- - [ ] "Checkout" button
276
- - [ ] Empty cart state with call-to-action
277
-
278
- **User Stories**:
279
- - As a customer, I want to view and edit my cart so that I can review items before purchase
280
-
281
- ---
282
-
283
- #### 2. Implement cart state management - HIGH
284
- **Status**: pending
285
-
286
- **Acceptance Criteria**:
287
- - [ ] Cart persisted in localStorage
288
- - [ ] Sync cart state across tabs (storage event listener)
289
- - [ ] Add to cart action (with quantity)
290
- - [ ] Remove from cart action
291
- - [ ] Update quantity action
292
- - [ ] Clear cart action
293
- - [ ] Calculate totals (subtotal, tax, shipping)
294
- - [ ] Merge guest cart with user cart on login
295
-
296
- **Technical Notes**:
297
- - Use Zustand or Redux for state
298
- - Debounce localStorage writes
299
- - Validate cart integrity on load
300
-
301
- ---
302
-
303
- ## Domain: User Management
304
-
305
- ### Feature: User Profile - HIGH
306
- **Description**: Allow users to view and edit their profile
307
-
308
- **Subtasks**:
309
-
310
- #### 1. Create profile page UI - HIGH
311
- **Status**: pending
312
-
313
- **Acceptance Criteria**:
314
- - [ ] Display user information: name, email, avatar
315
- - [ ] Editable fields: name, bio, location
316
- - [ ] Avatar upload with preview
317
- - [ ] Save button with loading state
318
- - [ ] Success notification on save
319
- - [ ] "Change password" section
320
- - [ ] "Delete account" danger zone
321
-
322
- **User Stories**:
323
- - As a user, I want to edit my profile so that I can keep my information up to date
324
-
325
- **Technical Notes**:
326
- - Use file upload API for avatar (max 2MB, images only)
327
- - Client-side image optimization before upload
328
- - Confirmation modal for account deletion
329
-
330
- ---
331
-
332
- #### 2. Implement profile API endpoints - HIGH
333
- **Status**: pending
334
-
335
- **Acceptance Criteria**:
336
- - [ ] GET /api/user/profile - Returns current user profile
337
- - [ ] PATCH /api/user/profile - Updates profile fields
338
- - [ ] POST /api/user/avatar - Uploads avatar image
339
- - [ ] DELETE /api/user/account - Deletes account (requires confirmation)
340
- - [ ] All endpoints require authentication
341
- - [ ] Returns 401 if not authenticated
342
- - [ ] Validates file type and size for avatar
343
-
344
- **Technical Notes**:
345
- - Use S3 or Cloudflare R2 for image storage
346
- - Generate unique filename for avatars
347
- - Soft delete for user accounts
348
- - Log all profile changes
349
-
350
- ---
351
-
352
- ### Feature: User Roles - MEDIUM
353
- **Description**: Implement role-based access control
354
-
355
- **Subtasks**:
356
-
357
- #### 1. Define role system - MEDIUM
358
- **Status**: pending
359
-
360
- **Acceptance Criteria**:
361
- - [ ] Database schema for roles (user, admin, moderator)
362
- - [ ] User-role many-to-many relationship
363
- - [ ] Seed default roles in database
364
- - [ ] Utility function to check user role
365
- - [ ] Middleware to protect routes by role
366
- - [ ] Type definitions for role-based permissions
367
-
368
- **User Stories**:
369
- - As an admin, I want to have elevated permissions so that I can manage the application
370
- - As a developer, I want role-based access control so that I can secure sensitive features
371
-
372
- **Technical Notes**:
373
- - Use enum for role names
374
- - Cache user roles in JWT for fast access
375
- - Create RBAC policy definitions
376
-
377
- ---
378
-
379
- #### 2. Implement role-based UI - MEDIUM
380
- **Status**: pending
381
-
382
- **Acceptance Criteria**:
383
- - [ ] Admin dashboard visible only to admins
384
- - [ ] User management page for admins
385
- - [ ] Role assignment interface
386
- - [ ] Permission checks on client side (UI only)
387
- - [ ] Graceful fallback for unauthorized access
388
-
389
- **User Stories**:
390
- - As an admin, I want to manage user roles so that I can control access
391
-
392
- **Technical Notes**:
393
- - Server-side validation is the source of truth
394
- - Client-side checks only for UI/UX
395
- - Log all role changes
396
-
397
- ---
398
-
399
- ## Architecture Notes
400
-
401
- ### Folder Structure (Optional)
402
-
403
- If you have a preferred structure:
404
-
405
- ```
406
- src/
407
- ├── app/ # Next.js app router
408
- ├── components/ # React components
409
- │ ├── auth/ # Authentication components
410
- │ ├── product/ # Product components
411
- │ └── cart/ # Cart components
412
- ├── lib/ # Utilities
413
- ├── hooks/ # Custom hooks
414
- └── styles/ # Global styles
415
- ```
416
-
417
- ### Design Patterns
418
-
419
- - [Any specific patterns to use]
420
- - [Any patterns to avoid]
421
-
422
- ### Constraints
423
-
424
- - [Performance requirements]
425
- - [Accessibility requirements]
426
- - [Browser support requirements]
427
-
428
- ## Third-Party Integrations (Optional)
429
-
430
- - [API 1]: [Purpose]
431
- - [API 2]: [Purpose]
432
-
433
- ## Out of Scope (for MVP)
434
-
435
- List what you're explicitly NOT building:
436
-
437
- - [Feature X] - Will add in v2
438
- - [Feature Y] - Out of scope
439
- - [Feature Z] - Not needed
440
-
441
- ## Success Criteria
442
-
443
- The product is complete when:
444
-
445
- 1. [All CRITICAL features implemented and tested]
446
- 2. [All HIGH priority features implemented or documented]
447
- 3. [All tests passing with 80%+ coverage]
448
- 4. [No TypeScript errors]
449
- 5. [No security vulnerabilities]
450
- 6. [Deployed to production]
451
-
452
- ## Notes
453
-
454
- [Any additional context, links, or documentation]
455
-
456
- ---
457
-
458
- ## Template Guide
459
-
460
- ### How to Use This Template
461
-
462
- 1. **Keep the structure**: Maintain the domains → features → subtasks hierarchy
463
- 2. **Be specific**: Write detailed acceptance criteria for each subtask
464
- 3. **Think sequentially**: Order subtasks in implementation order
465
- 4. **Set priorities**: Use CRITICAL/HIGH/MEDIUM/LOW to guide development
466
- 5. **Track progress**: Update status as features are complete
467
-
468
- ### Example Domain Breakdown
469
-
470
- ```
471
- Authentication (Domain)
472
- ├── User Registration (Feature)
473
- │ ├── Create registration form UI (Subtask) - CRITICAL
474
- │ └── Implement registration API endpoint (Subtask) - CRITICAL
475
- ├── User Login (Feature)
476
- │ ├── Create login form UI (Subtask) - CRITICAL
477
- │ └── Implement login API endpoint (Subtask) - CRITICAL
478
- └── Password Reset (Feature)
479
- ├── Create forgot password form (Subtask) - HIGH
480
- └── Implement password reset email flow (Subtask) - HIGH
481
- ```
482
-
483
- ### Acceptance Criteria Format
484
-
485
- Each subtask should have:
486
- - **Status**: pending → in-progress → complete (or blocked)
487
- - **Checkbox list**: [ ] Specific, testable requirements
488
- - **User stories**: As a [role], I want [feature] so that [benefit]
489
- - **Technical notes**: Implementation details and constraints
490
-
491
- ### Why This Structure Works
492
-
493
- - **Domains** organize work by functional area
494
- - **Features** break domains into user-facing capabilities
495
- - **Subtasks** create implementable units that can be completed in one session
496
- - **Priorities** ensure MVP features are built first
497
- - **Status tracking** enables autonomous development loops
498
-
499
- **Tip**: The more detailed your PRODUCT.md, the better agentful can understand what to build. Include:
500
- - Clear acceptance criteria with checkboxes
501
- - User stories for context
502
- - Technical constraints and notes
503
- - Examples when helpful
504
-
505
- ---
506
-
507
- ## Migration to Hierarchical Structure
508
-
509
- When your project grows too large for a single file, you can migrate to the hierarchical structure:
510
-
511
- ### When to Migrate
512
-
513
- Consider migrating when:
514
- - Your PRODUCT.md exceeds 500 lines
515
- - You have 20+ features across multiple domains
516
- - Multiple team members need to edit product specs simultaneously
517
- - You want better organization for complex projects
518
-
519
- ### How to Migrate
520
-
521
- 1. **Create the hierarchical structure:**
522
- ```bash
523
- mkdir -p .claude/product/domains
524
- ```
525
-
526
- 2. **Split your PRODUCT.md into domain files:**
527
- - Move each domain section to `.claude/product/domains/{domain-name}/index.md`
528
- - Move each feature to `.claude/product/domains/{domain-name}/features/{feature-name}.md`
529
- - Create `.claude/product/index.md` with product overview only
530
-
531
- 3. **System auto-detects the change:**
532
- - agentful will automatically detect the hierarchical structure
533
- - No configuration changes needed
534
-
535
- 4. **Delete or archive the old PRODUCT.md:**
536
- - You can keep it as a backup
537
- - Or delete it once migration is complete
538
-
539
- ### Example Migration
540
-
541
- **Before (Flat - this file):**
542
- ```markdown
543
- # Product Spec
544
-
545
- ## Domain: Authentication
546
- ### Feature: Login
547
- [Details...]
548
-
549
- ## Domain: User Management
550
- ### Feature: Profile
551
- [Details...]
552
- ```
553
-
554
- **After (Hierarchical):**
555
- ```
556
- .claude/product/
557
- ├── index.md # Product overview only
558
- └── domains/
559
- ├── authentication/
560
- │ ├── index.md # Domain overview
561
- │ └── features/
562
- │ └── login.md # Feature details
563
- └── user-management/
564
- ├── index.md
565
- └── features/
566
- └── profile.md
567
- ```
568
-
569
- ### Detailed Migration Guide
570
-
571
- For step-by-step instructions, examples, and best practices, see:
572
- `.claude/product/README.md` in your project (after running `npx @itz4blitz/agentful init`)
573
-
574
- ### Key Differences
575
-
576
- | Aspect | Flat Structure | Hierarchical Structure |
577
- |--------|---------------|----------------------|
578
- | **File location** | `PRODUCT.md` at root | `.claude/product/` directory |
579
- | **Organization** | Single file with all features | Multiple files split by domain |
580
- | **Best for** | Small projects, MVPs, beginners | Large projects, teams, complex products |
581
- | **Tracking** | Feature-level completion | Subtask → Feature → Domain completion |
582
- | **Collaboration** | One editor at a time | Multiple editors can work on different domains |
583
-
584
- Both structures work identically - agentful auto-detects which format you're using!