@itz4blitz/agentful 0.1.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.
@@ -0,0 +1,610 @@
1
+ # Product Structure Examples
2
+
3
+ This file shows concrete examples of both flat and hierarchical product structures.
4
+
5
+ ## Example 1: Flat Structure (Simple Project)
6
+
7
+ ### File: PRODUCT.md
8
+
9
+ ```markdown
10
+ # TaskFlow - Task Management App
11
+
12
+ ## Overview
13
+
14
+ A simple task management application for individuals and small teams. Users can create projects, add tasks with deadlines, set priorities, and track progress.
15
+
16
+ ## Goals
17
+
18
+ - [ ] Enable users to create and manage tasks
19
+ - [ ] Provide project organization
20
+ - [ ] Support task prioritization and deadlines
21
+ - [ ] Real-time progress tracking
22
+
23
+ ## Tech Stack
24
+
25
+ ### Frontend
26
+ - **Framework**: Next.js 14
27
+ - **Language**: TypeScript
28
+ - **Styling**: Tailwind CSS
29
+ - **State Management**: Zustand
30
+
31
+ ### Backend
32
+ - **Runtime**: Node.js
33
+ - **Framework**: Next.js API Routes
34
+ - **Language**: TypeScript
35
+
36
+ ### Database
37
+ - **Database**: PostgreSQL
38
+ - **ORM**: Prisma
39
+
40
+ ### Authentication
41
+ - **Method**: JWT
42
+
43
+ ### Testing
44
+ - **Unit**: Vitest
45
+ - **E2E**: Playwright
46
+
47
+ ### Deployment
48
+ - **Hosting**: Vercel
49
+
50
+ ## Features (Priority Order)
51
+
52
+ ### 1. User Authentication - CRITICAL
53
+ **Description**: User registration, login, and authentication
54
+
55
+ **Acceptance Criteria**:
56
+ - [ ] User can register with email/password
57
+ - [ ] User can login with email/password
58
+ - [ ] JWT token generated on successful login
59
+ - [ ] Protected routes require valid token
60
+ - [ ] Password reset flow via email
61
+
62
+ **User Stories**:
63
+ - As a user, I want to create an account so that I can manage my tasks
64
+ - As a user, I want to login so that I can access my tasks securely
65
+ - As a user, I want to reset my password if I forget it
66
+
67
+ ---
68
+
69
+ ### 2. Task Management - CRITICAL
70
+ **Description**: Create, read, update, and delete tasks
71
+
72
+ **Acceptance Criteria**:
73
+ - [ ] User can create a new task
74
+ - [ ] Task has title, description, due date, priority
75
+ - [ ] User can edit existing task
76
+ - [ ] User can delete task
77
+ - [ ] Tasks are stored per user
78
+ - [ ] Task list paginated (20 per page)
79
+
80
+ **User Stories**:
81
+ - As a user, I want to create tasks so that I can track my work
82
+ - As a user, I want to edit tasks so that I can update details
83
+ - As a user, I want to delete tasks I no longer need
84
+
85
+ ---
86
+
87
+ ### 3. Project Organization - HIGH
88
+ **Description**: Group tasks into projects
89
+
90
+ **Acceptance Criteria**:
91
+ - [ ] User can create a project
92
+ - [ ] Project has name and description
93
+ - [ ] User can assign tasks to projects
94
+ - [ ] User can view all tasks in a project
95
+ - [ ] User can delete a project (moves tasks to inbox)
96
+
97
+ **User Stories**:
98
+ - As a user, I want to create projects so that I can organize my tasks
99
+ - As a user, I want to assign tasks to projects so that I can find them easily
100
+
101
+ ---
102
+
103
+ ### 4. Task Prioritization - MEDIUM
104
+ **Description**: Set and sort by priority levels
105
+
106
+ **Acceptance Criteria**:
107
+ - [ ] Task can have priority: low, medium, high, urgent
108
+ - [ ] Default priority is medium
109
+ - [ ] User can filter tasks by priority
110
+ - [ ] Task list sorted by priority by default
111
+
112
+ **User Stories**:
113
+ - As a user, I want to set task priority so that I know what's important
114
+ - As a user, I want to filter by priority so that I can focus on urgent tasks
115
+
116
+ ---
117
+
118
+ ### 5. Due Dates & Reminders - MEDIUM
119
+ **Description**: Set due dates and receive reminders
120
+
121
+ **Acceptance Criteria**:
122
+ - [ ] Task can have optional due date
123
+ - [ ] Tasks due today shown in "Today" view
124
+ - [ ] Overdue tasks highlighted in red
125
+ - [ ] User receives email notification 24h before due date
126
+
127
+ **User Stories**:
128
+ - As a user, I want to set due dates so that I know when to complete tasks
129
+ - As a user, I want to see overdue tasks so that I can catch up
130
+
131
+ ---
132
+
133
+ ### 6. Progress Dashboard - LOW
134
+ **Description**: Visual overview of task completion
135
+
136
+ **Acceptance Criteria**:
137
+ - [ ] Dashboard shows total tasks
138
+ - [ ] Dashboard shows completed vs pending tasks
139
+ - [ ] Dashboard shows tasks due this week
140
+ - [ ] Simple bar chart for completion rate
141
+
142
+ **User Stories**:
143
+ - As a user, I want to see my progress so that I stay motivated
144
+
145
+ ## Architecture Notes
146
+
147
+ ### Folder Structure
148
+
149
+ ```
150
+ src/
151
+ ├── app/ # Next.js app router
152
+ │ ├── (auth)/ # Auth routes
153
+ │ ├── dashboard/ # Dashboard pages
154
+ │ └── api/ # API routes
155
+ ├── components/ # React components
156
+ │ ├── auth/
157
+ │ ├── tasks/
158
+ │ └── projects/
159
+ ├── lib/ # Utilities
160
+ │ ├── auth.ts
161
+ │ ├── db.ts
162
+ │ └── utils.ts
163
+ └── styles/ # Global styles
164
+ ```
165
+
166
+ ### Design Patterns
167
+
168
+ - Use server components for data fetching
169
+ - Client components only for interactivity
170
+ - API routes handle business logic
171
+ - Prisma for type-safe database access
172
+
173
+ ## Out of Scope (for MVP)
174
+
175
+ - Team collaboration features
176
+ - File attachments on tasks
177
+ - Calendar view
178
+ - Mobile app
179
+ - Task templates
180
+ - Recurring tasks
181
+
182
+ ## Success Criteria
183
+
184
+ The product is complete when:
185
+
186
+ 1. All critical features implemented and tested
187
+ 2. All tests passing with 80%+ coverage
188
+ 3. No TypeScript errors
189
+ 4. No security vulnerabilities
190
+ 5. Deployed to production
191
+
192
+ ## Notes
193
+
194
+ - Start with authentication first
195
+ - Then build task CRUD
196
+ - Add projects if time permits
197
+ - Keep UI simple and clean
198
+ ```
199
+
200
+ ### Completion Tracking (.agentful/completion.json)
201
+
202
+ ```json
203
+ {
204
+ "features": {
205
+ "user-authentication": {
206
+ "status": "complete",
207
+ "score": 100,
208
+ "completed_at": "2026-01-18T01:00:00Z",
209
+ "notes": "JWT auth fully implemented with tests"
210
+ },
211
+ "task-management": {
212
+ "status": "in_progress",
213
+ "score": 70,
214
+ "notes": "CRUD operations working, pagination pending"
215
+ },
216
+ "project-organization": {
217
+ "status": "pending",
218
+ "score": 0
219
+ },
220
+ "task-prioritization": {
221
+ "status": "pending",
222
+ "score": 0
223
+ },
224
+ "due-dates": {
225
+ "status": "pending",
226
+ "score": 0
227
+ },
228
+ "dashboard": {
229
+ "status": "pending",
230
+ "score": 0
231
+ }
232
+ },
233
+ "gates": {
234
+ "tests_passing": true,
235
+ "no_type_errors": true,
236
+ "no_dead_code": false,
237
+ "coverage_80": false,
238
+ "security_clean": true
239
+ },
240
+ "overall": 28,
241
+ "last_updated": "2026-01-18T00:00:00Z"
242
+ }
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Example 2: Hierarchical Structure (Organized Project)
248
+
249
+ ### File Structure
250
+
251
+ ```
252
+ .claude/product/
253
+ ├── index.md # Product overview (see below)
254
+ └── domains/
255
+ ├── authentication/
256
+ │ ├── index.md # Domain overview
257
+ │ └── features/
258
+ │ ├── registration.md
259
+ │ ├── login.md
260
+ │ ├── password-reset.md
261
+ │ └── session-management.md
262
+ ├── task-management/
263
+ │ ├── index.md # Domain overview
264
+ │ └── features/
265
+ │ ├── task-crud.md
266
+ │ ├── task-list.md
267
+ │ ├── task-search.md
268
+ │ └── bulk-operations.md
269
+ ├── project-organization/
270
+ │ ├── index.md # Domain overview
271
+ │ └── features/
272
+ │ ├── project-crud.md
273
+ │ ├── task-assignment.md
274
+ │ └── project-views.md
275
+ └── dashboard/
276
+ ├── index.md # Domain overview
277
+ └── features/
278
+ ├── progress-tracking.md
279
+ ├── statistics.md
280
+ └── analytics.md
281
+ ```
282
+
283
+ ### File: .claude/product/index.md
284
+
285
+ ```markdown
286
+ # TaskFlow - Task Management App
287
+
288
+ ## Overview
289
+
290
+ A comprehensive task management application for individuals and teams. Provides hierarchical organization, advanced task management, and powerful analytics.
291
+
292
+ ## Goals
293
+
294
+ - [ ] Enable efficient task and project management
295
+ - [ ] Support individual and team workflows
296
+ - [ ] Provide actionable insights through analytics
297
+ - [ ] Scale to 10,000+ tasks per user
298
+
299
+ ## Tech Stack
300
+
301
+ ### Frontend
302
+ - **Framework**: Next.js 14
303
+ - **Language**: TypeScript
304
+ - **Styling**: Tailwind CSS
305
+ - **State Management**: Zustand + React Query
306
+
307
+ ### Backend
308
+ - **Runtime**: Node.js
309
+ - **Framework**: Next.js API Routes
310
+ - **Language**: TypeScript
311
+
312
+ ### Database
313
+ - **Database**: PostgreSQL
314
+ - **ORM**: Prisma
315
+ - **Caching**: Redis
316
+
317
+ ### Authentication
318
+ - **Method**: JWT + refresh tokens
319
+
320
+ ### Testing
321
+ - **Unit**: Vitest
322
+ - **E2E**: Playwright
323
+ - **Coverage**: 80%+ required
324
+
325
+ ### Deployment
326
+ - **Hosting**: Vercel
327
+ - **Database**: PlanetScale
328
+
329
+ ## Domains
330
+
331
+ | Domain | Priority | Description |
332
+ |--------|----------|-------------|
333
+ | Authentication | CRITICAL | User identity and access control |
334
+ | Task Management | CRITICAL | Core task CRUD and organization |
335
+ | Project Organization | HIGH | Grouping and categorization |
336
+ | Dashboard | MEDIUM | Analytics and insights |
337
+
338
+ ## Success Criteria
339
+
340
+ The product is complete when:
341
+
342
+ 1. All CRITICAL and HIGH domains complete
343
+ 2. All tests passing with 80%+ coverage
344
+ 3. No TypeScript errors
345
+ 4. Performance: < 100ms API response time
346
+ 5. Deployed to production with monitoring
347
+ ```
348
+
349
+ ### File: .claude/product/domains/authentication/index.md
350
+
351
+ ```markdown
352
+ # Authentication Domain
353
+
354
+ ## Overview
355
+
356
+ Handles user identity, authentication, and authorization. Ensures secure access to user data and maintains session integrity.
357
+
358
+ ## Goals
359
+
360
+ - [ ] Provide secure user registration and login
361
+ - [ ] Maintain secure sessions with JWT tokens
362
+ - [ ] Support password recovery flows
363
+ - [ ] Protect against common attacks (XSS, CSRF, injection)
364
+
365
+ ## Priority
366
+
367
+ CRITICAL - Must be completed before any user data can be stored
368
+
369
+ ## Features
370
+
371
+ 1. **User Registration** - New user signup with validation
372
+ 2. **User Login** - Email/password authentication with JWT
373
+ 3. **Password Reset** - Secure password recovery via email
374
+ 4. **Session Management** - Token refresh and logout
375
+
376
+ ## Dependencies
377
+
378
+ - Depends on: Nothing (foundational)
379
+ - Blocks by: Task Management, Project Organization
380
+ - Integration: Email service for password reset
381
+
382
+ ## Technical Notes
383
+
384
+ - Use bcrypt for password hashing
385
+ - JWT with 15min expiration + refresh tokens
386
+ - Rate limiting on auth endpoints
387
+ - Email verification optional for MVP
388
+
389
+ ## Completion Criteria
390
+
391
+ Domain complete when:
392
+ - All 4 features have status: "complete"
393
+ - All auth tests passing
394
+ - No security vulnerabilities
395
+ - Token refresh working correctly
396
+ ```
397
+
398
+ ### File: .claude/product/domains/authentication/features/login.md
399
+
400
+ ```markdown
401
+ # Feature: User Login
402
+
403
+ ## Description
404
+
405
+ Authenticate users with email/password and issue JWT tokens for session management.
406
+
407
+ ## Priority
408
+
409
+ CRITICAL
410
+
411
+ ## Acceptance Criteria
412
+
413
+ - [ ] POST /api/auth/login endpoint accepts email/password
414
+ - [ ] Validates email format and password length
415
+ - [ ] Returns 401 for invalid credentials
416
+ - [ ] Returns JWT access token (15min expiry) on success
417
+ - [ ] Returns HTTP-only refresh token cookie (7 days)
418
+ - [ ] Rate limit: 5 attempts per 15 minutes
419
+ - [ ] Logs login attempts for security audit
420
+
421
+ ## User Stories
422
+
423
+ - As a user, I want to login with my email so that I can access my account
424
+ - As a user, I want to stay logged in so that I don't have to re-authenticate constantly
425
+ - As a user, I want clear error messages if my login fails
426
+
427
+ ## Subtasks
428
+
429
+ ### 1. Create Login API Endpoint
430
+ - [ ] Create /api/auth/login route
431
+ - [ ] Implement request validation (zod)
432
+ - [ ] Query user by email from database
433
+ - [ ] Verify password with bcrypt
434
+ - [ ] Generate JWT access token
435
+ - [ ] Generate refresh token
436
+ - [ ] Set HTTP-only cookie
437
+ - [ ] Return tokens and user data
438
+
439
+ ### 2. Create Login UI Component
440
+ - [ ] Design login form with email/password fields
441
+ - [ ] Add client-side validation
442
+ - [ ] Handle loading states
443
+ - [ ] Display error messages
444
+ - [ ] Redirect on success
445
+ - [ ] Store tokens securely
446
+
447
+ ### 3. Implement Rate Limiting
448
+ - [ ] Configure rate limiter middleware
449
+ - [ ] Track attempts by IP/email
450
+ - [ ] Return 429 Too Many Requests when limit hit
451
+ - [ ] Add Retry-After header
452
+
453
+ ### 4. Add Login Logging
454
+ - [ ] Log successful logins with timestamp
455
+ - [ ] Log failed attempts with IP
456
+ - [ ] Store in auth_logs table
457
+ - [ ] Create admin view for security audit
458
+
459
+ ## Technical Notes
460
+
461
+ **API Request:**
462
+ ```json
463
+ POST /api/auth/login
464
+ {
465
+ "email": "user@example.com",
466
+ "password": "securepassword123"
467
+ }
468
+ ```
469
+
470
+ **Success Response (200):**
471
+ ```json
472
+ {
473
+ "access_token": "eyJ...",
474
+ "user": {
475
+ "id": "user_123",
476
+ "email": "user@example.com",
477
+ "name": "John Doe"
478
+ }
479
+ }
480
+ ```
481
+
482
+ **Error Response (401):**
483
+ ```json
484
+ {
485
+ "error": "Invalid credentials"
486
+ }
487
+ ```
488
+
489
+ ## Dependencies
490
+
491
+ - Requires: User Registration (users must exist to login)
492
+ - Blocks by: Session Management
493
+ - Integration: Rate limiter, logging service
494
+
495
+ ## Testing
496
+
497
+ - Unit tests for password verification
498
+ - Integration tests for login flow
499
+ - Rate limiting tests
500
+ - Error handling tests
501
+ - Security tests (SQL injection, XSS)
502
+
503
+ ## Definition of Done
504
+
505
+ - [ ] All subtasks complete
506
+ - [ ] API endpoint tested with Postman/Insomnia
507
+ - [ ] UI component working in browser
508
+ - [ ] All tests passing
509
+ - [ ] Code reviewed
510
+ - [ ] Documentation updated
511
+ ```
512
+
513
+ ### Completion Tracking (.agentful/completion.json)
514
+
515
+ ```json
516
+ {
517
+ "domains": {
518
+ "authentication": {
519
+ "name": "Authentication",
520
+ "priority": "CRITICAL",
521
+ "status": "in_progress",
522
+ "score": 50,
523
+ "started_at": "2026-01-18T00:00:00Z",
524
+ "features": {
525
+ "registration": {
526
+ "name": "User Registration",
527
+ "priority": "CRITICAL",
528
+ "status": "complete",
529
+ "score": 100,
530
+ "completed_at": "2026-01-18T01:00:00Z"
531
+ },
532
+ "login": {
533
+ "name": "User Login",
534
+ "priority": "CRITICAL",
535
+ "status": "in_progress",
536
+ "score": 50,
537
+ "subtasks": {
538
+ "login-api": {
539
+ "name": "Create Login API Endpoint",
540
+ "status": "complete",
541
+ "completed_at": "2026-01-18T02:00:00Z"
542
+ },
543
+ "login-ui": {
544
+ "name": "Create Login UI Component",
545
+ "status": "in_progress"
546
+ },
547
+ "rate-limiting": {
548
+ "name": "Implement Rate Limiting",
549
+ "status": "pending"
550
+ },
551
+ "login-logging": {
552
+ "name": "Add Login Logging",
553
+ "status": "pending"
554
+ }
555
+ }
556
+ },
557
+ "password-reset": {
558
+ "name": "Password Reset",
559
+ "priority": "HIGH",
560
+ "status": "pending",
561
+ "score": 0
562
+ },
563
+ "session-management": {
564
+ "name": "Session Management",
565
+ "priority": "HIGH",
566
+ "status": "pending",
567
+ "score": 0
568
+ }
569
+ },
570
+ "notes": "Registration complete, login in progress (API done, UI pending)"
571
+ },
572
+ "task-management": {
573
+ "name": "Task Management",
574
+ "priority": "CRITICAL",
575
+ "status": "pending",
576
+ "score": 0,
577
+ "features": {
578
+ "task-crud": {
579
+ "name": "Task CRUD",
580
+ "priority": "CRITICAL",
581
+ "status": "pending",
582
+ "score": 0
583
+ }
584
+ }
585
+ }
586
+ },
587
+ "gates": {
588
+ "tests_passing": true,
589
+ "no_type_errors": true,
590
+ "no_dead_code": true,
591
+ "coverage_80": false,
592
+ "security_clean": true
593
+ },
594
+ "overall": 25,
595
+ "last_updated": "2026-01-18T00:00:00Z"
596
+ }
597
+ ```
598
+
599
+ ## Key Differences
600
+
601
+ | Aspect | Flat Structure | Hierarchical Structure |
602
+ |--------|---------------|----------------------|
603
+ | **Files** | 1 file (PRODUCT.md) | 10+ files (domains/features) |
604
+ | **Organization** | Feature list | Domains → Features → Subtasks |
605
+ | **Tracking** | Feature-level (6 items) | Subtask-level (20+ items) |
606
+ | **Scalability** | Good for < 20 features | Good for 20+ features |
607
+ | **Team collaboration** | Harder (merge conflicts) | Easier (separate files) |
608
+ | **Progress visibility** | Basic (X/6 features) | Detailed (X/Y subtasks per feature) |
609
+
610
+ Choose the structure that fits your project size and team needs!