@itz4blitz/agentful 0.3.0 → 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.
@@ -130,7 +130,7 @@ if task_successful:
130
130
  ### Read These Files First
131
131
 
132
132
  ```bash
133
- 1. PRODUCT.md OR .claude/product/index.md # Product overview
133
+ 1. .claude/product/index.md # Product overview
134
134
  2. .claude/product/domains/*/index.md # Domains (if hierarchical)
135
135
  3. .claude/product/domains/*/features/*.md # Features (if hierarchical)
136
136
  4. .agentful/state.json # Current work state
@@ -146,7 +146,7 @@ if task_successful:
146
146
  if exists(".claude/product/domains/*/index.md"):
147
147
  structure = "hierarchical" # Organized: domains → features
148
148
  use_completion.domains
149
- else if exists("PRODUCT.md") OR exists(".claude/product/index.md"):
149
+ else if exists(".claude/product/index.md"):
150
150
  structure = "flat" # Simple: flat feature list
151
151
  use_completion.features
152
152
  else:
@@ -36,7 +36,6 @@ First, detect which product structure format is being used:
36
36
  domains_found = Glob(".claude/product/domains/*/index.md")
37
37
 
38
38
  # Step 2: Check for flat structure
39
- product_md_exists = exists("PRODUCT.md")
40
39
  product_index_exists = exists(".claude/product/index.md")
41
40
 
42
41
  if domains_found:
@@ -50,11 +49,6 @@ if domains_found:
50
49
  for feature_file in Glob(".claude/product/domains/{domain}/features/*.md"):
51
50
  Read(feature_file)
52
51
 
53
- elif product_md_exists:
54
- format = "flat"
55
- product_root = "."
56
- Read("PRODUCT.md")
57
-
58
52
  elif product_index_exists:
59
53
  format = "flat"
60
54
  product_root = ".claude/product"
@@ -325,7 +319,7 @@ if structure == "hierarchical":
325
319
  domain.features.append(feature)
326
320
  domains.append(domain)
327
321
  else:
328
- product_spec = Read("PRODUCT.md" OR ".claude/product/index.md")
322
+ product_spec = Read(".claude/product/index.md")
329
323
  ```
330
324
 
331
325
  ### Step 2: Analyze Each Dimension
@@ -735,9 +729,8 @@ Analysis saved to: .claude/product/product-analysis.json
735
729
  "recommendation": {
736
730
  "action": "Create product specification",
737
731
  "options": [
738
- "Use PRODUCT.md for simple projects",
739
- "Use .claude/product/index.md for organized flat structure",
740
- "Use .claude/product/domains/* for complex projects"
732
+ "Use .claude/product/index.md for simple flat structure",
733
+ "Use .claude/product/domains/* for complex projects with hierarchical organization"
741
734
  ]
742
735
  }
743
736
  }
@@ -28,7 +28,7 @@ if user_text:
28
28
  goto DISCUSSION_MODE
29
29
 
30
30
  # Step 2: Check if product spec exists
31
- product_spec_exists = exists(".claude/product/index.md") OR exists("PRODUCT.md")
31
+ product_spec_exists = exists(".claude/product/index.md")
32
32
 
33
33
  if !product_spec_exists:
34
34
  has_substantial_codebase = check_codebase_exists()
@@ -169,7 +169,7 @@ Task("product-analyzer", "Analyze .claude/product/index.md and generate product-
169
169
 
170
170
  The product analyzer should:
171
171
 
172
- 1. **Read product specification**: `.claude/product/index.md` or `PRODUCT.md`
172
+ 1. **Read product specification**: `.claude/product/index.md`
173
173
 
174
174
  2. **Analyze for completeness and clarity**:
175
175
  - Tech stack: All stack choices specified (not placeholders)
@@ -425,7 +425,7 @@ Task("product-analyzer", "Analyze .claude/product/index.md and generate product-
425
425
 
426
426
  ## File Locations
427
427
 
428
- - **Product spec**: `.claude/product/index.md` (or `PRODUCT.md` for legacy)
428
+ - **Product spec**: `.claude/product/index.md`
429
429
  - **Analysis results**: `.claude/product/product-analysis.json`
430
430
  - **Domain structure**: `.claude/product/domains/*/index.md` (optional hierarchical)
431
431
 
@@ -268,18 +268,7 @@ This is optional but recommended for complex projects. Run `/agentful-product` t
268
268
 
269
269
  Create a product specification (choose one):
270
270
 
271
- **Flat structure** (simple projects):
272
- ```markdown
273
- # PRODUCT.md
274
-
275
- ## Features
276
-
277
- - [CRITICAL] User authentication (login, register, password reset)
278
- - [HIGH] User profiles (edit, avatar, preferences)
279
- - [MEDIUM] Dashboard (analytics, activity feed)
280
- ```
281
-
282
- **Hierarchical structure** (complex projects):
271
+ **Hierarchical structure** (recommended):
283
272
  ```
284
273
  .claude/product/
285
274
  ├── index.md # Product overview
@@ -4,7 +4,7 @@ This file shows concrete examples of both flat and hierarchical product structur
4
4
 
5
5
  ## Example 1: Flat Structure (Simple Project)
6
6
 
7
- ### File: PRODUCT.md
7
+ ### File: .claude/product/index.md
8
8
 
9
9
  ```markdown
10
10
  # TaskFlow - Task Management App
@@ -600,7 +600,7 @@ POST /api/auth/login
600
600
 
601
601
  | Aspect | Flat Structure | Hierarchical Structure |
602
602
  |--------|---------------|----------------------|
603
- | **Files** | 1 file (PRODUCT.md) | 10+ files (domains/features) |
603
+ | **Files** | 1 file (.claude/product/index.md) | 10+ files (domains/features) |
604
604
  | **Organization** | Feature list | Domains → Features → Subtasks |
605
605
  | **Tracking** | Feature-level (6 items) | Subtask-level (20+ items) |
606
606
  | **Scalability** | Good for < 20 features | Good for 20+ features |
@@ -6,16 +6,7 @@ agentful supports **both** flat and hierarchical product structures with automat
6
6
 
7
7
  ### Simple Projects (Flat Structure)
8
8
 
9
- Just create a single `PRODUCT.md` file at your project root:
10
-
11
- ```bash
12
- your-project/
13
- ├── PRODUCT.md # All features in one file
14
- ├── src/
15
- └── package.json
16
- ```
17
-
18
- Or use `.claude/product/index.md`:
9
+ Create `.claude/product/index.md` with all your features:
19
10
 
20
11
  ```bash
21
12
  your-project/
@@ -54,8 +45,7 @@ your-project/
54
45
  The system automatically detects which format you're using:
55
46
 
56
47
  1. **Hierarchical**: If `.claude/product/domains/*/index.md` exists
57
- 2. **Flat (legacy)**: If `PRODUCT.md` exists at root
58
- 3. **Flat (new)**: If `.claude/product/index.md` exists (without domains)
48
+ 2. **Flat**: If `.claude/product/index.md` exists (without domains)
59
49
 
60
50
  ### Detection Algorithm
61
51
 
@@ -63,11 +53,8 @@ The system automatically detects which format you're using:
63
53
  if exists(".claude/product/domains/*/index.md"):
64
54
  → Use hierarchical structure
65
55
  → Track at subtask → feature → domain levels
66
- else if exists("PRODUCT.md"):
67
- → Use flat structure (legacy)
68
- → Track at feature level
69
56
  else if exists(".claude/product/index.md"):
70
- → Use flat structure (new)
57
+ → Use flat structure
71
58
  → Track at feature level
72
59
  else:
73
60
  → Error: No product specification found
@@ -83,7 +70,7 @@ else:
83
70
  - Single developer or small team
84
71
  - Simple feature list without dependencies
85
72
 
86
- **Example `PRODUCT.md`:**
73
+ **Example `.claude/product/index.md`:**
87
74
 
88
75
  ```markdown
89
76
  # My App
@@ -209,16 +196,13 @@ Priority: CRITICAL
209
196
 
210
197
  ## Migration Path
211
198
 
212
- You can start flat and migrate to hierarchical as your project grows:
199
+ You can start flat and expand to hierarchical as your project grows:
213
200
 
214
201
  ```
215
202
  Phase 1: Quick Start
216
- └── PRODUCT.md (all features in one file)
217
-
218
- Phase 2: Organize (optional)
219
- └── .claude/product/index.md (move to .claude directory)
203
+ └── .claude/product/index.md (all features in one file)
220
204
 
221
- Phase 3: Scale Up (when needed)
205
+ Phase 2: Scale Up (when needed)
222
206
  └── .claude/product/domains/ (split by domain)
223
207
  ├── authentication/
224
208
  ├── user-management/
@@ -285,7 +269,6 @@ For hierarchical structure examples, check:
285
269
  ### "No product specification found"
286
270
 
287
271
  **Solution**: Create one of:
288
- - `PRODUCT.md` at root
289
272
  - `.claude/product/index.md`
290
273
  - `.claude/product/domains/*/index.md`
291
274
 
@@ -294,7 +277,7 @@ For hierarchical structure examples, check:
294
277
  **Cause**: completion.json structure doesn't match product files
295
278
 
296
279
  **Solution**: Don't mix formats. Choose one:
297
- - All flat: `PRODUCT.md` + `completion.json` with `features` object
280
+ - All flat: `.claude/product/index.md` + `completion.json` with `features` object
298
281
  - All hierarchical: `.claude/product/domains/` + `completion.json` with `domains` object
299
282
 
300
283
  ### Can I use both formats?
@@ -337,8 +320,7 @@ After running `/agentful-product`, a `product-analysis.json` file is generated:
337
320
 
338
321
  | Format | Best For | Tracking | File Structure |
339
322
  |--------|----------|----------|----------------|
340
- | Flat (PRODUCT.md) | Small projects, MVPs | Feature level | Single file |
341
- | Flat (.claude/product/index.md) | Small projects, organized | Feature level | Single file in .claude |
323
+ | Flat (.claude/product/index.md) | Small projects, MVPs | Feature level | Single file |
342
324
  | Hierarchical | Large projects, teams | Subtask/feature/domain level | Multiple files, domain folders |
343
325
 
344
326
  Choose the format that matches your project needs. The system will auto-detect and adapt!
@@ -16,10 +16,8 @@ This skill tracks the completion progress of product development with support fo
16
16
  The system supports **both** flat and hierarchical product structures with automatic detection:
17
17
 
18
18
  ```
19
- Option 1: Flat Structure (Legacy/Quick Start)
20
- ├── PRODUCT.md # Single file with all features
21
- OR
22
- ├── .claude/product/
19
+ Option 1: Flat Structure (Simple)
20
+ └── .claude/product/
23
21
  └── index.md # Single file with all features
24
22
 
25
23
  Option 2: Hierarchical Structure (Organized)
@@ -53,11 +51,7 @@ if exists(".claude/product/domains/*/index.md"):
53
51
  use_domains = true
54
52
  else:
55
53
  # Step 2: Fall back to flat structure
56
- if exists("PRODUCT.md"):
57
- structure_type = "flat"
58
- product_root = "."
59
- use_domains = false
60
- elif exists(".claude/product/index.md"):
54
+ if exists(".claude/product/index.md"):
61
55
  structure_type = "flat"
62
56
  product_root = ".claude/product"
63
57
  use_domains = false
@@ -67,8 +61,7 @@ else:
67
61
 
68
62
  **Priority Order:**
69
63
  1. Hierarchical (`.claude/product/domains/*/index.md`) - preferred for organized projects
70
- 2. Flat (`PRODUCT.md`) - legacy quick-start format at root
71
- 3. Flat (`.claude/product/index.md`) - new flat format in .claude directory
64
+ 2. Flat (`.claude/product/index.md`) - simple flat format for projects without domains
72
65
 
73
66
  ### Parsing Product Structure
74
67
 
@@ -105,9 +98,7 @@ if domain_files.length > 0:
105
98
 
106
99
  ```bash
107
100
  # 1. Detect structure
108
- if exists("PRODUCT.md"):
109
- product_file = "PRODUCT.md"
110
- elif exists(".claude/product/index.md"):
101
+ if exists(".claude/product/index.md"):
111
102
  product_file = ".claude/product/index.md"
112
103
  else:
113
104
  error("No product specification found")
@@ -549,7 +540,7 @@ Map to completion.json:
549
540
 
550
541
  ### Parsing Flat Product Structure
551
542
 
552
- Parse `PRODUCT.md` (or `.claude/product/index.md`) to extract feature list:
543
+ Parse `.claude/product/index.md` to extract feature list:
553
544
 
554
545
  ```markdown
555
546
  ## Features
@@ -591,12 +582,11 @@ Always detect structure type before any operation:
591
582
  ```bash
592
583
  # Detect structure
593
584
  domains_found = Glob(".claude/product/domains/*/index.md")
594
- product_md_exists = exists("PRODUCT.md")
595
585
  product_index_exists = exists(".claude/product/index.md")
596
586
 
597
587
  if domains_found:
598
588
  use_hierarchical_tracking()
599
- else if product_md_exists or product_index_exists:
589
+ else if product_index_exists:
600
590
  use_flat_tracking()
601
591
  else:
602
592
  error("No product specification found")
@@ -629,8 +619,8 @@ When subtask work completes:
629
619
 
630
620
  When orchestrator asks for progress update:
631
621
 
632
- 1. Detect structure type (no domains, PRODUCT.md exists → flat)
633
- 2. Determine product file: `PRODUCT.md` or `.claude/product/index.md`
622
+ 1. Detect structure type (no domains, `.claude/product/index.md` exists → flat)
623
+ 2. Read `.claude/product/index.md` for product specification
634
624
  3. Read completion.json
635
625
  4. Calculate overall percentage
636
626
  5. Identify next priority feature
@@ -650,5 +640,4 @@ When feature work completes:
650
640
  | Structure Type | Detection | Product File | Completion Schema | Tracking Method |
651
641
  |---------------|-----------|--------------|-------------------|-----------------|
652
642
  | Hierarchical | `.claude/product/domains/*/index.md` exists | `.claude/product/index.md` | Nested `domains` object | Track at subtask → feature → domain levels |
653
- | Flat (legacy) | `PRODUCT.md` exists | `PRODUCT.md` | Flat `features` object | Track at feature level |
654
- | Flat (new) | `.claude/product/index.md` exists | `.claude/product/index.md` | Flat `features` object | Track at feature level |
643
+ | Flat | `.claude/product/index.md` exists | `.claude/product/index.md` | Flat `features` object | Track at feature level |
package/README.md CHANGED
@@ -38,10 +38,10 @@ Use `/agentful-product` for guided product planning:
38
38
 
39
39
  #### Option B: Manual Creation
40
40
 
41
- Create your specification manually:
41
+ Create your specification manually in `.claude/product/`:
42
42
 
43
- **Flat structure** (single file at project root):
44
- - `PRODUCT.md` - All features in one file
43
+ **Flat structure** (single file):
44
+ - `.claude/product/index.md` - All features in one file
45
45
 
46
46
  **Hierarchical structure** (organized by domain):
47
47
  - `.claude/product/index.md` - Product overview
@@ -195,10 +195,11 @@ Full documentation: [agentful.app](https://agentful.app)
195
195
 
196
196
  ```
197
197
  your-project/
198
- ├── PRODUCT.md # Product specification (flat)
199
198
  ├── CLAUDE.md # Project instructions
200
199
  ├── .claude/
201
- │ ├── product/ # Product specification (hierarchical)
200
+ │ ├── product/ # Product specification
201
+ │ │ ├── index.md # Product spec (flat or hierarchical)
202
+ │ │ └── domains/ # Optional: hierarchical structure
202
203
  │ ├── agents/ # Agent definitions
203
204
  │ ├── commands/ # Slash commands
204
205
  │ ├── skills/ # Reusable skills
package/bin/cli.js CHANGED
@@ -131,7 +131,7 @@ async function init() {
131
131
  // Initialize using lib/init.js
132
132
  log(colors.dim, 'Copying templates...');
133
133
  try {
134
- const result = await initProject(targetDir, { includeProduct: true });
134
+ const result = await initProject(targetDir);
135
135
 
136
136
  console.log('');
137
137
  log(colors.green, 'Initialized agentful successfully!');
@@ -161,7 +161,7 @@ async function init() {
161
161
  log(colors.dim, ' - Domain-specific agents (auth, billing, etc.)');
162
162
  log(colors.dim, ' - Skills for frameworks you use');
163
163
  console.log('');
164
- log(colors.dim, 'Optional: Edit CLAUDE.md and PRODUCT.md first to customize.');
164
+ log(colors.dim, 'Optional: Edit CLAUDE.md and .claude/product/index.md first to customize.');
165
165
  console.log('');
166
166
  }
167
167
 
package/lib/init.js CHANGED
@@ -9,12 +9,9 @@ const CLAUDE_DIR = path.join(__dirname, '..', '.claude');
9
9
  /**
10
10
  * Initialize agentful in a target project directory
11
11
  * @param {string} targetDir - Target project directory
12
- * @param {Object} options - Initialization options
13
- * @param {boolean} options.includeProduct - Whether to include PRODUCT.md template
14
12
  * @returns {Promise<{success: boolean, files: string[]}>}
15
13
  */
16
- export async function initProject(targetDir, options = {}) {
17
- const { includeProduct = false } = options;
14
+ export async function initProject(targetDir) {
18
15
  const createdFiles = [];
19
16
 
20
17
  try {
@@ -79,19 +76,271 @@ export async function initProject(targetDir, options = {}) {
79
76
  await fs.writeFile(decisionsFile, JSON.stringify(initialDecisions, null, 2));
80
77
  createdFiles.push('.agentful/decisions.json');
81
78
 
82
- // 4. Optionally copy PRODUCT.md template
83
- if (includeProduct) {
84
- const productMdSource = path.join(TEMPLATE_DIR, 'PRODUCT.md');
85
- const productMdTarget = path.join(targetDir, 'PRODUCT.md');
86
-
87
- try {
88
- await fs.access(productMdSource);
89
- await fs.copyFile(productMdSource, productMdTarget);
90
- createdFiles.push('PRODUCT.md');
91
- } catch (err) {
92
- // PRODUCT.md template doesn't exist, skip
93
- }
94
- }
79
+ // 4. Create .claude/product/ hierarchical structure
80
+ const productDir = path.join(targetDir, '.claude', 'product');
81
+ await fs.mkdir(productDir, { recursive: true });
82
+
83
+ // Create basic index.md template
84
+ const indexMdContent = `# Product Specification
85
+
86
+ ## Overview
87
+
88
+ [Describe what you're building in 2-3 sentences]
89
+
90
+ Example:
91
+ > 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.
92
+
93
+ ## Goals
94
+
95
+ - [ ] [Primary goal 1]
96
+ - [ ] [Primary goal 2]
97
+ - [ ] [Primary goal 3]
98
+
99
+ ## Tech Stack
100
+
101
+ ### Frontend
102
+ - **Framework**: [Next.js 14 / React + Vite / Vue + Nuxt / SvelteKit]
103
+ - **Language**: [TypeScript / JavaScript]
104
+ - **Styling**: [Tailwind CSS / CSS Modules / styled-components / shadcn/ui]
105
+ - **State Management**: [Zustand / Context API / Redux / Jotai]
106
+
107
+ ### Backend
108
+ - **Runtime**: [Node.js / Bun / Deno]
109
+ - **Framework**: [Next.js API Routes / Express / Fastify / NestJS / Hono]
110
+ - **Language**: [TypeScript / JavaScript]
111
+
112
+ ### Database
113
+ - **Database**: [PostgreSQL / MySQL / SQLite / MongoDB / PlanetScale]
114
+ - **ORM**: [Prisma / Drizzle / TypeORM / Mongoose]
115
+
116
+ ### Authentication
117
+ - **Method**: [JWT / NextAuth / Clerk / Auth0 / Lucia]
118
+
119
+ ### Testing
120
+ - **Unit**: [Vitest / Jest]
121
+ - **E2E**: [Playwright / Cypress]
122
+
123
+ ### Deployment
124
+ - **Hosting**: [Vercel / Netlify / Railway / Fly.io]
125
+
126
+ ## Domains
127
+
128
+ Create domain-specific subdirectories under \`.claude/product/domains/\` to organize your features:
129
+
130
+ \`\`\`
131
+ .claude/product/
132
+ ├── index.md (this file)
133
+ ├── README.md
134
+ └── domains/
135
+ ├── authentication/
136
+ │ ├── index.md
137
+ │ └── features/
138
+ │ ├── login.md
139
+ │ └── register.md
140
+ └── user-management/
141
+ ├── index.md
142
+ └── features/
143
+ └── profile.md
144
+ \`\`\`
145
+
146
+ See \`.claude/product/README.md\` for detailed structure guidance.
147
+
148
+ ## Architecture Notes
149
+
150
+ ### Design Patterns
151
+
152
+ - [Any specific patterns to use]
153
+ - [Any patterns to avoid]
154
+
155
+ ### Constraints
156
+
157
+ - [Performance requirements]
158
+ - [Accessibility requirements]
159
+ - [Browser support requirements]
160
+
161
+ ## Third-Party Integrations (Optional)
162
+
163
+ - [API 1]: [Purpose]
164
+ - [API 2]: [Purpose]
165
+
166
+ ## Out of Scope (for MVP)
167
+
168
+ List what you're explicitly NOT building:
169
+
170
+ - [Feature X] - Will add in v2
171
+ - [Feature Y] - Out of scope
172
+ - [Feature Z] - Not needed
173
+
174
+ ## Success Criteria
175
+
176
+ The product is complete when:
177
+
178
+ 1. [All critical features implemented and tested]
179
+ 2. [All tests passing with 80%+ coverage]
180
+ 3. [No TypeScript errors]
181
+ 4. [No security vulnerabilities]
182
+ 5. [Deployed to production]
183
+
184
+ ## Notes
185
+
186
+ [Any additional context, links, or documentation]
187
+
188
+ ---
189
+
190
+ **Tip**: The more detailed your product specification, the better agentful can understand what to build. Include:
191
+ - Clear acceptance criteria
192
+ - User stories for context
193
+ - Technical constraints
194
+ - Examples when helpful
195
+ `;
196
+
197
+ const indexMdPath = path.join(productDir, 'index.md');
198
+ await fs.writeFile(indexMdPath, indexMdContent);
199
+ createdFiles.push('.claude/product/index.md');
200
+
201
+ // Create README.md explaining the structure
202
+ const readmeMdContent = `# Product Structure Guide
203
+
204
+ agentful uses a hierarchical product structure to organize features by domain.
205
+
206
+ ## Structure
207
+
208
+ \`\`\`
209
+ .claude/product/
210
+ ├── index.md # Product overview (name, description, tech stack)
211
+ ├── README.md # This file - documentation about the structure
212
+ └── domains/ # Business domains (create as needed)
213
+ ├── authentication/
214
+ │ ├── index.md # Domain overview
215
+ │ └── features/
216
+ │ ├── login.md
217
+ │ └── register.md
218
+ └── user-management/
219
+ ├── index.md
220
+ └── features/
221
+ └── profile.md
222
+ \`\`\`
223
+
224
+ ## Files Explained
225
+
226
+ ### \`index.md\` (Product Level)
227
+ - Product name and description
228
+ - Tech stack
229
+ - High-level goals
230
+ - List of domains
231
+ - Architecture notes
232
+ - Success criteria
233
+
234
+ ### \`domains/{domain-name}/index.md\` (Domain Level)
235
+ - Domain description and purpose
236
+ - List of features in this domain
237
+ - Domain-specific constraints
238
+ - Dependencies on other domains
239
+
240
+ ### \`domains/{domain-name}/features/{feature-name}.md\` (Feature Level)
241
+ - Feature description
242
+ - Priority (CRITICAL, HIGH, MEDIUM, LOW)
243
+ - Acceptance criteria (checkboxes)
244
+ - User stories
245
+ - Technical notes
246
+ - Subtasks breakdown
247
+
248
+ ## When to Create a Domain
249
+
250
+ Create a new domain when you have:
251
+ - A distinct business area (e.g., authentication, billing, analytics)
252
+ - Multiple related features (e.g., login, register, password reset)
253
+ - Shared logic or data models
254
+ - Clear boundaries from other domains
255
+
256
+ **Example domains:**
257
+ - \`authentication\` - Login, registration, password reset
258
+ - \`user-management\` - Profile, settings, preferences
259
+ - \`purchasing\` - Cart, checkout, orders, payments
260
+ - \`analytics\` - Dashboards, reports, metrics
261
+ - \`content\` - Posts, comments, media uploads
262
+
263
+ ## Example Feature File
264
+
265
+ \`\`\`markdown
266
+ <!-- .claude/product/domains/authentication/features/login.md -->
267
+
268
+ # Feature: User Login
269
+
270
+ **Priority**: CRITICAL
271
+
272
+ **Description**: Allow existing users to authenticate with email and password.
273
+
274
+ ## Acceptance Criteria
275
+
276
+ - [ ] Login form with email and password fields
277
+ - [ ] Client-side validation before submission
278
+ - [ ] API endpoint POST /api/auth/login
279
+ - [ ] Returns JWT token on success
280
+ - [ ] Sets httpOnly cookie with token
281
+ - [ ] Returns 401 for invalid credentials
282
+ - [ ] Rate limited to 10 requests per minute
283
+ - [ ] Account lockout after 5 failed attempts
284
+
285
+ ## User Stories
286
+
287
+ - As a returning user, I want to log in with my credentials so that I can access my account
288
+
289
+ ## Subtasks
290
+
291
+ ### 1. Create login form UI
292
+ **Status**: pending
293
+
294
+ - [ ] Email and password input fields
295
+ - [ ] "Remember me" checkbox
296
+ - [ ] "Forgot password" link
297
+ - [ ] Loading state during authentication
298
+ - [ ] Error message display
299
+
300
+ ### 2. Implement login API endpoint
301
+ **Status**: pending
302
+
303
+ - [ ] Verify email exists in database
304
+ - [ ] Compare hashed password using bcrypt
305
+ - [ ] Generate JWT token with 7-day expiration
306
+ - [ ] Set secure httpOnly cookie
307
+ - [ ] Implement rate limiting
308
+ - [ ] Track failed login attempts
309
+
310
+ ## Technical Notes
311
+
312
+ - Use jose or jsonwebtoken for JWT
313
+ - Store failed attempts in Redis
314
+ - Set cookie flags: httpOnly, secure, sameSite=strict
315
+ \`\`\`
316
+
317
+ ## Priority Levels
318
+
319
+ - **CRITICAL** - Must have for MVP, blocks other features
320
+ - **HIGH** - Important for MVP, should include
321
+ - **MEDIUM** - Nice to have if time permits
322
+ - **LOW** - Future enhancement, not for MVP
323
+
324
+ ## Status Tracking
325
+
326
+ - \`pending\` - Not started
327
+ - \`in-progress\` - Currently being worked on
328
+ - \`complete\` - Done and tested
329
+ - \`blocked\` - Waiting for decision or dependency
330
+
331
+ ## Getting Started
332
+
333
+ 1. Edit \`index.md\` to describe your product
334
+ 2. Create domains under \`domains/\` for major functional areas
335
+ 3. Add features under each domain's \`features/\` directory
336
+ 4. Run \`/agentful-start\` in Claude Code to begin development
337
+
338
+ For more information, see the agentful documentation.
339
+ `;
340
+
341
+ const readmeMdPath = path.join(productDir, 'README.md');
342
+ await fs.writeFile(readmeMdPath, readmeMdContent);
343
+ createdFiles.push('.claude/product/README.md');
95
344
 
96
345
  return {
97
346
  success: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itz4blitz/agentful",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Human-in-the-loop development kit for Claude Code with smart product analysis and natural conversation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Quick Start
6
6
 
7
- 1. Edit `PRODUCT.md` (or `.claude/product/` for larger projects)
7
+ 1. Edit `.claude/product/index.md` to define your product requirements
8
8
  2. Run: `claude`
9
9
  3. Type: `/agentful-start`
10
10
 
@@ -28,7 +28,7 @@ claude --dangerously-skip-permissions
28
28
  ## When to Use What
29
29
 
30
30
  **Starting fresh?**
31
- → Run `/agentful-product` to analyze your PRODUCT.md, then `/agentful-start`
31
+ → Run `/agentful-product` to analyze your product spec, then `/agentful-start`
32
32
 
33
33
  **Existing project?**
34
34
  → Run `/agentful-start` directly (auto-detects tech stack)
@@ -43,16 +43,16 @@ claude --dangerously-skip-permissions
43
43
  → Check `.agentful/decisions.json` or run `/agentful-decide`
44
44
 
45
45
  **Unclear requirements?**
46
- → Run `/agentful-product` in reverse-engineering mode or improve PRODUCT.md
46
+ → Run `/agentful-product` in reverse-engineering mode or improve `.claude/product/index.md`
47
47
 
48
48
  **Want to add features?**
49
- → Edit PRODUCT.md, then run `/agentful-start` (picks up changes automatically)
49
+ → Edit `.claude/product/index.md`, then run `/agentful-start` (picks up changes automatically)
50
50
 
51
51
  ## File Structure
52
52
 
53
53
  **Product Specification** (you edit these):
54
- - `PRODUCT.md` - Flat structure (recommended for <20 features)
55
- - `.claude/product/` - Hierarchical structure (for larger projects)
54
+ - `.claude/product/index.md` - Flat structure (all features in one file)
55
+ - `.claude/product/domains/` - Hierarchical structure (organized by domain)
56
56
 
57
57
  **Runtime State** (managed by agentful, gitignored):
58
58
  - `.agentful/state.json` - Current work phase and progress
@@ -81,22 +81,22 @@ The `reviewer` agent runs these checks automatically. The `fixer` agent resolves
81
81
  ## Troubleshooting
82
82
 
83
83
  **"agentful keeps asking me unclear questions"**
84
- → Your PRODUCT.md needs more detail. Run `/agentful-product` to analyze and improve it.
84
+ → Your product spec needs more detail. Run `/agentful-product` to analyze and improve it.
85
85
 
86
86
  **"Validation keeps failing"**
87
87
  → Check `.agentful/last-validation.json` for details. The `fixer` agent should auto-resolve, but you can run `/agentful-validate` manually.
88
88
 
89
89
  **"Agent isn't working on the right feature"**
90
- → Check priority in PRODUCT.md. CRITICAL > HIGH > MEDIUM > LOW. Run `/agentful-status` to see current focus.
90
+ → Check priority in `.claude/product/index.md`. CRITICAL > HIGH > MEDIUM > LOW. Run `/agentful-status` to see current focus.
91
91
 
92
92
  **"State seems stuck or corrupted"**
93
93
  → Delete `.agentful/state.json` and run `/agentful-start` to reset. Completion progress is preserved.
94
94
 
95
95
  **"Tech stack not detected correctly"**
96
- → Add explicit tech stack section to PRODUCT.md or check `.agentful/architecture.json` for what was detected.
96
+ → Add explicit tech stack section to `.claude/product/index.md` or check `.agentful/architecture.json` for what was detected.
97
97
 
98
- **"How do I switch from flat to hierarchical product structure?"**
99
- Run `/agentful-product migrate` or manually create `.claude/product/index.md` and move content. Auto-detected.
98
+ **"How do I expand to hierarchical product structure?"**
99
+ Create `.claude/product/domains/` directories and organize features by domain. Auto-detected.
100
100
 
101
101
  **"Agent generated wrong type of code"**
102
102
  → Check that the right specialized agent was generated. Run `/agents` to list all agents.
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.2.1"
2
+ "version": "0.3.0"
3
3
  }
@@ -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!