@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,654 @@
1
+ ---
2
+ name: product-tracking
3
+ description: Tracks product completion progress across domains, features, subtasks, and quality gates. Supports hierarchical product structure.
4
+ model: sonnet
5
+ tools: Read, Write, Edit, Glob, Grep
6
+ ---
7
+
8
+ # Product Tracking Skill
9
+
10
+ This skill tracks the completion progress of product development with support for hierarchical product structure.
11
+
12
+ ## Product Structure
13
+
14
+ ### Hybrid Product Organization
15
+
16
+ The system supports **both** flat and hierarchical product structures with automatic detection:
17
+
18
+ ```
19
+ Option 1: Flat Structure (Legacy/Quick Start)
20
+ ├── PRODUCT.md # Single file with all features
21
+ OR
22
+ ├── .claude/product/
23
+ └── index.md # Single file with all features
24
+
25
+ Option 2: Hierarchical Structure (Organized)
26
+ └── .claude/product/
27
+ ├── index.md # Product overview and goals
28
+ └── domains/
29
+ ├── authentication/
30
+ │ ├── index.md # Domain overview
31
+ │ └── features/
32
+ │ ├── login.md
33
+ │ ├── register.md
34
+ │ └── logout.md
35
+ ├── user-management/
36
+ │ ├── index.md
37
+ │ └── features/
38
+ │ ├── profile.md
39
+ │ └── settings.md
40
+ └── dashboard/
41
+ ├── index.md
42
+ └── features/
43
+ └── main-dashboard.md
44
+ ```
45
+
46
+ ### Auto-Detection Algorithm
47
+
48
+ ```bash
49
+ # Step 1: Check for hierarchical structure first
50
+ if exists(".claude/product/domains/*/index.md"):
51
+ structure_type = "hierarchical"
52
+ product_root = ".claude/product"
53
+ use_domains = true
54
+ else:
55
+ # 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"):
61
+ structure_type = "flat"
62
+ product_root = ".claude/product"
63
+ use_domains = false
64
+ else:
65
+ error("No product specification found")
66
+ ```
67
+
68
+ **Priority Order:**
69
+ 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
72
+
73
+ ### Parsing Product Structure
74
+
75
+ #### For Hierarchical Structure
76
+
77
+ ```bash
78
+ # 1. Detect structure
79
+ domain_files = Glob(".claude/product/domains/*/index.md")
80
+
81
+ if domain_files.length > 0:
82
+ # Hierarchical structure detected
83
+ structure_type = "hierarchical"
84
+
85
+ # 2. Read product index
86
+ Read .claude/product/index.md
87
+ # Extract: product name, overview, goals
88
+
89
+ # 3. Discover all domains
90
+ for domain_file in domain_files:
91
+ Read domain_file
92
+ # Extract: domain name, description, priority
93
+
94
+ # 4. For each domain, discover features
95
+ domain_name = extract_from_path(domain_file)
96
+ feature_files = Glob(".claude/product/domains/{domain_name}/features/*.md")
97
+
98
+ # 5. For each feature, read feature details
99
+ for feature_file in feature_files:
100
+ Read feature_file
101
+ # Extract: feature name, priority, acceptance criteria, subtasks
102
+ ```
103
+
104
+ #### For Flat Structure
105
+
106
+ ```bash
107
+ # 1. Detect structure
108
+ if exists("PRODUCT.md"):
109
+ product_file = "PRODUCT.md"
110
+ elif exists(".claude/product/index.md"):
111
+ product_file = ".claude/product/index.md"
112
+ else:
113
+ error("No product specification found")
114
+
115
+ # 2. Read product specification
116
+ Read product_file
117
+ # Extract: product name, overview, goals, feature list
118
+
119
+ # 3. Parse features from markdown
120
+ # Features are typically under "## Features" section
121
+ # Each feature has: name, priority, acceptance criteria
122
+ ```
123
+
124
+ ## State File: .agentful/completion.json
125
+
126
+ ### Hierarchical Schema
127
+
128
+ ```json
129
+ {
130
+ "domains": {
131
+ "domain-id": {
132
+ "name": "Domain Name",
133
+ "priority": "CRITICAL|HIGH|MEDIUM|LOW",
134
+ "status": "pending|in_progress|complete|blocked",
135
+ "score": 0-100,
136
+ "started_at": "2026-01-18T00:00:00Z",
137
+ "completed_at": "2026-01-18T01:00:00Z",
138
+ "features": {
139
+ "feature-id": {
140
+ "name": "Feature Name",
141
+ "priority": "CRITICAL|HIGH|MEDIUM|LOW",
142
+ "status": "pending|in_progress|complete|blocked",
143
+ "score": 0-100,
144
+ "started_at": "2026-01-18T00:00:00Z",
145
+ "completed_at": "2026-01-18T01:00:00Z",
146
+ "subtasks": {
147
+ "subtask-id": {
148
+ "name": "Subtask Name",
149
+ "status": "pending|in_progress|complete",
150
+ "completed_at": "2026-01-18T01:00:00Z"
151
+ }
152
+ },
153
+ "notes": "Optional notes about progress"
154
+ }
155
+ },
156
+ "notes": "Optional notes about domain progress"
157
+ }
158
+ },
159
+ "gates": {
160
+ "tests_passing": false,
161
+ "no_type_errors": false,
162
+ "no_dead_code": false,
163
+ "coverage_80": false,
164
+ "security_clean": false
165
+ },
166
+ "overall": 0,
167
+ "last_updated": "2026-01-18T00:00:00Z"
168
+ }
169
+ ```
170
+
171
+ ### Flat Schema (Legacy Support)
172
+
173
+ For products without domain structure, the flat schema is still supported:
174
+
175
+ ```json
176
+ {
177
+ "features": {
178
+ "feature-id": {
179
+ "status": "pending|in_progress|complete|blocked",
180
+ "score": 0-100,
181
+ "started_at": "2026-01-18T00:00:00Z",
182
+ "completed_at": "2026-01-18T01:00:00Z",
183
+ "notes": "Optional notes about progress"
184
+ }
185
+ },
186
+ "gates": {
187
+ "tests_passing": false,
188
+ "no_type_errors": false,
189
+ "no_dead_code": false,
190
+ "coverage_80": false,
191
+ "security_clean": false
192
+ },
193
+ "overall": 0,
194
+ "last_updated": "2026-01-18T00:00:00Z"
195
+ }
196
+ ```
197
+
198
+ ## Reading Progress
199
+
200
+ ### Hierarchical Structure
201
+
202
+ ```bash
203
+ # Read current state
204
+ Read .agentful/completion.json
205
+
206
+ # Display hierarchical progress
207
+ # Overall: 48%
208
+ # Domains: 2/3 complete
209
+ # - Authentication: 100% (3/3 features)
210
+ # - User Management: 45% (1/2 features)
211
+ # - Dashboard: 0% (0/1 features)
212
+ # Gates passing: 3/5
213
+ ```
214
+
215
+ ### Flat Structure (Legacy)
216
+
217
+ ```bash
218
+ # Read current state
219
+ Read .agentful/completion.json
220
+
221
+ # Parse and display
222
+ # Overall: 48%
223
+ # Features complete: 2/5
224
+ # Gates passing: 3/5
225
+ ```
226
+
227
+ ## Updating Progress
228
+
229
+ ### Updating Hierarchical Structure
230
+
231
+ When a subtask is completed:
232
+
233
+ ```json
234
+ {
235
+ "domains": {
236
+ "authentication": {
237
+ "features": {
238
+ "login": {
239
+ "subtasks": {
240
+ "login-ui": {
241
+ "status": "complete",
242
+ "completed_at": "2026-01-18T01:00:00Z"
243
+ },
244
+ "login-api": {
245
+ "status": "in_progress"
246
+ }
247
+ },
248
+ "score": 50,
249
+ "status": "in_progress"
250
+ }
251
+ },
252
+ "score": 50,
253
+ "status": "in_progress"
254
+ }
255
+ }
256
+ }
257
+ ```
258
+
259
+ When a feature is completed (all subtasks done):
260
+
261
+ ```json
262
+ {
263
+ "domains": {
264
+ "authentication": {
265
+ "features": {
266
+ "login": {
267
+ "status": "complete",
268
+ "score": 100,
269
+ "completed_at": "2026-01-18T02:00:00Z",
270
+ "notes": "Login UI and API fully implemented with tests"
271
+ }
272
+ },
273
+ "score": 33,
274
+ "status": "in_progress"
275
+ }
276
+ }
277
+ }
278
+ ```
279
+
280
+ When starting work on a feature:
281
+
282
+ ```json
283
+ {
284
+ "domains": {
285
+ "authentication": {
286
+ "features": {
287
+ "register": {
288
+ "status": "in_progress",
289
+ "score": 0,
290
+ "started_at": "2026-01-18T02:30:00Z",
291
+ "subtasks": {
292
+ "register-ui": {
293
+ "status": "in_progress"
294
+ },
295
+ "register-api": {
296
+ "status": "pending"
297
+ }
298
+ }
299
+ }
300
+ },
301
+ "score": 22,
302
+ "status": "in_progress"
303
+ }
304
+ }
305
+ }
306
+ ```
307
+
308
+ ### Updating Flat Structure (Legacy)
309
+
310
+ When work is completed on a feature:
311
+
312
+ ```json
313
+ {
314
+ "features": {
315
+ "authentication": {
316
+ "status": "complete",
317
+ "score": 100,
318
+ "started_at": "2026-01-18T00:00:00Z",
319
+ "completed_at": "2026-01-18T01:30:00Z",
320
+ "notes": "JWT authentication fully implemented with tests"
321
+ }
322
+ }
323
+ }
324
+ ```
325
+
326
+ When starting work on a feature:
327
+
328
+ ```json
329
+ {
330
+ "features": {
331
+ "user-profile": {
332
+ "status": "in_progress",
333
+ "score": 0,
334
+ "started_at": "2026-01-18T01:30:00Z"
335
+ }
336
+ }
337
+ }
338
+ ```
339
+
340
+ When progress is made:
341
+
342
+ ```json
343
+ {
344
+ "features": {
345
+ "user-profile": {
346
+ "status": "in_progress",
347
+ "score": 45,
348
+ "notes": "Backend service complete, frontend pending"
349
+ }
350
+ }
351
+ }
352
+ ```
353
+
354
+ ## Calculating Overall Score
355
+
356
+ ### Hierarchical Score Calculation
357
+
358
+ ```javascript
359
+ // For hierarchical structure with domains
360
+ function calculateHierarchicalScore(domains, gates) {
361
+ let totalDomainScore = 0;
362
+ let domainCount = 0;
363
+
364
+ // Calculate each domain's score
365
+ for (const [domainId, domain] of Object.entries(domains)) {
366
+ const features = domain.features;
367
+ if (!features || Object.keys(features).length === 0) continue;
368
+
369
+ // Calculate feature scores (average of subtasks or direct score)
370
+ let featureTotal = 0;
371
+ let featureCount = 0;
372
+
373
+ for (const [featureId, feature] of Object.entries(features)) {
374
+ if (feature.subtasks) {
375
+ // Calculate from subtasks
376
+ const subtasks = Object.values(feature.subtasks);
377
+ const completed = subtasks.filter(st => st.status === 'complete').length;
378
+ feature.score = Math.round((completed / subtasks.length) * 100);
379
+ }
380
+ featureTotal += feature.score;
381
+ featureCount++;
382
+ }
383
+
384
+ // Domain score is average of its features
385
+ domain.score = Math.round(featureTotal / featureCount);
386
+ totalDomainScore += domain.score;
387
+ domainCount++;
388
+ }
389
+
390
+ // Calculate gate scores
391
+ const gateScores = Object.values(gates).map(g => g ? 100 : 0);
392
+ const gateScore = gateScores.reduce((a, b) => a + b, 0) / gateScores.length;
393
+
394
+ // Overall is weighted average of domains and gates
395
+ const domainScore = domainCount > 0 ? totalDomainScore / domainCount : 0;
396
+ const overall = Math.round((domainScore * 0.8) + (gateScore * 0.2));
397
+
398
+ return { overall, domainScore, gateScore };
399
+ }
400
+ ```
401
+
402
+ **Priority Weights:**
403
+
404
+ | Priority | Weight |
405
+ |----------|--------|
406
+ | CRITICAL | 1.5x |
407
+ | HIGH | 1.2x |
408
+ | MEDIUM | 1.0x |
409
+ | LOW | 0.5x |
410
+
411
+ Weighted score calculation:
412
+ ```javascript
413
+ function calculateWeightedScore(domains) {
414
+ let totalWeightedScore = 0;
415
+ let totalWeight = 0;
416
+
417
+ const priorityWeights = {
418
+ CRITICAL: 1.5,
419
+ HIGH: 1.2,
420
+ MEDIUM: 1.0,
421
+ LOW: 0.5
422
+ };
423
+
424
+ for (const [domainId, domain] of Object.entries(domains)) {
425
+ const weight = priorityWeights[domain.priority] || 1.0;
426
+ totalWeightedScore += domain.score * weight;
427
+ totalWeight += weight;
428
+ }
429
+
430
+ return Math.round(totalWeightedScore / totalWeight);
431
+ }
432
+ ```
433
+
434
+ ### Flat Score Calculation (Legacy)
435
+
436
+ ```javascript
437
+ // Average of all feature scores
438
+ const featureScores = Object.values(features).map(f => f.score);
439
+ const featureScore = Math.round(
440
+ featureScores.reduce((a, b) => a + b, 0) / featureScores.length
441
+ );
442
+
443
+ // Gate scores
444
+ const gateScores = Object.values(gates).map(g => g ? 100 : 0);
445
+ const gateScore = gateScores.reduce((a, b) => a + b, 0) / gateScores.length;
446
+
447
+ // Overall is average of features and gates
448
+ const overall = Math.round((featureScore * 0.8) + (gateScore * 0.2));
449
+
450
+ // Adjusted by gates (legacy method)
451
+ const gatePenalty = Object.values(gates).filter(g => !g).length * 5;
452
+ const finalScore = Math.max(0, overall - gatePenalty);
453
+ ```
454
+
455
+ ## Quality Gates
456
+
457
+ Each gate must pass for production readiness:
458
+
459
+ | Gate | Check | Command |
460
+ |------|-------|---------|
461
+ | tests_passing | All tests pass | `npm test` |
462
+ | no_type_errors | No TypeScript errors | `npx tsc --noEmit` |
463
+ | no_dead_code | No unused code | `npx knip` |
464
+ | coverage_80 | Test coverage ≥ 80% | `npm test -- --coverage` |
465
+ | security_clean | No secrets/vulnerabilities | `npm audit` |
466
+
467
+ ## Feature Status Values
468
+
469
+ | Status | Meaning | Score Range |
470
+ |--------|---------|-------------|
471
+ | pending | Not started | 0 |
472
+ | in_progress | Work in progress | 1-99 |
473
+ | complete | Fully done and validated | 100 |
474
+ | blocked | Waiting on decision/dependency | any |
475
+
476
+ ## Integration with Product Structure
477
+
478
+ ### Parsing Hierarchical Product Structure
479
+
480
+ Parse `.claude/product/index.md` and all domain/feature files:
481
+
482
+ ```markdown
483
+ <!-- .claude/product/index.md -->
484
+ # My Product
485
+
486
+ ## Domain: Authentication
487
+ Priority: CRITICAL
488
+
489
+ ## Domain: User Management
490
+ Priority: HIGH
491
+
492
+ <!-- .claude/product/domains/authentication/index.md -->
493
+ # Authentication Domain
494
+
495
+ Provides user authentication and authorization features.
496
+
497
+ ## Features
498
+ - User Registration
499
+ - User Login
500
+ - Password Reset
501
+
502
+ <!-- .claude/product/domains/authentication/features/login.md -->
503
+ # Feature: User Login
504
+
505
+ Priority: CRITICAL
506
+
507
+ ## Subtasks
508
+ 1. Create login form UI
509
+ - Status: pending
510
+ - Acceptance: [ ] Email field, [ ] Password field, [ ] Submit button
511
+ 2. Implement login API
512
+ - Status: pending
513
+ - Acceptance: [ ] POST /api/auth/login, [ ] JWT generation, [ ] Error handling
514
+ ```
515
+
516
+ Map to completion.json:
517
+
518
+ ```json
519
+ {
520
+ "domains": {
521
+ "authentication": {
522
+ "name": "Authentication",
523
+ "priority": "CRITICAL",
524
+ "status": "in_progress",
525
+ "score": 33,
526
+ "features": {
527
+ "login": {
528
+ "name": "User Login",
529
+ "priority": "CRITICAL",
530
+ "status": "in_progress",
531
+ "score": 50,
532
+ "subtasks": {
533
+ "login-ui": {
534
+ "name": "Create login form UI",
535
+ "status": "complete",
536
+ "completed_at": "2026-01-18T01:00:00Z"
537
+ },
538
+ "login-api": {
539
+ "name": "Implement login API",
540
+ "status": "pending"
541
+ }
542
+ }
543
+ }
544
+ }
545
+ }
546
+ }
547
+ }
548
+ ```
549
+
550
+ ### Parsing Flat Product Structure
551
+
552
+ Parse `PRODUCT.md` (or `.claude/product/index.md`) to extract feature list:
553
+
554
+ ```markdown
555
+ ## Features
556
+
557
+ ### 1. Authentication - CRITICAL
558
+ **Description**: User login with JWT
559
+ **Acceptance**:
560
+ - [x] Login endpoint
561
+ - [x] Registration endpoint
562
+ - [x] JWT token generation
563
+ - [ ] Refresh token flow
564
+ ```
565
+
566
+ Map to completion.json:
567
+
568
+ ```json
569
+ {
570
+ "features": {
571
+ "authentication": {
572
+ "status": "in_progress",
573
+ "score": 75,
574
+ "acceptance": {
575
+ "login_endpoint": true,
576
+ "registration_endpoint": true,
577
+ "jwt_generation": true,
578
+ "refresh_token": false
579
+ }
580
+ }
581
+ }
582
+ }
583
+ ```
584
+
585
+ ## Usage
586
+
587
+ ### Auto-Detection First
588
+
589
+ Always detect structure type before any operation:
590
+
591
+ ```bash
592
+ # Detect structure
593
+ domains_found = Glob(".claude/product/domains/*/index.md")
594
+ product_md_exists = exists("PRODUCT.md")
595
+ product_index_exists = exists(".claude/product/index.md")
596
+
597
+ if domains_found:
598
+ use_hierarchical_tracking()
599
+ else if product_md_exists or product_index_exists:
600
+ use_flat_tracking()
601
+ else:
602
+ error("No product specification found")
603
+ ```
604
+
605
+ ### For Hierarchical Structure
606
+
607
+ When orchestrator asks for progress update:
608
+
609
+ 1. Detect structure type (domains found → hierarchical)
610
+ 2. Read `.claude/product/index.md` to discover domains
611
+ 3. Use Glob to find all `.claude/product/domains/*/index.md` files
612
+ 4. For each domain, read its index and discover features
613
+ 5. Read `.agentful/completion.json`
614
+ 6. Calculate overall percentage with weighted hierarchy
615
+ 7. Identify next priority subtask within highest priority domain
616
+ 8. Check for blocked items
617
+ 9. Report summary with domain/feature/subtask breakdown
618
+
619
+ When subtask work completes:
620
+
621
+ 1. Update subtask status to "complete"
622
+ 2. Add completed_at timestamp
623
+ 3. Recalculate feature score (based on completed subtasks)
624
+ 4. Recalculate domain score (based on feature scores)
625
+ 5. Recalculate overall score (weighted average)
626
+ 6. Write back to completion.json
627
+
628
+ ### For Flat Structure
629
+
630
+ When orchestrator asks for progress update:
631
+
632
+ 1. Detect structure type (no domains, PRODUCT.md exists → flat)
633
+ 2. Determine product file: `PRODUCT.md` or `.claude/product/index.md`
634
+ 3. Read completion.json
635
+ 4. Calculate overall percentage
636
+ 5. Identify next priority feature
637
+ 6. Check for blocked items
638
+ 7. Report summary
639
+
640
+ When feature work completes:
641
+
642
+ 1. Update feature status to "complete"
643
+ 2. Set score to 100
644
+ 3. Add completed_at timestamp
645
+ 4. Recalculate overall score
646
+ 5. Write back to completion.json
647
+
648
+ ### Structure Compatibility
649
+
650
+ | Structure Type | Detection | Product File | Completion Schema | Tracking Method |
651
+ |---------------|-----------|--------------|-------------------|-----------------|
652
+ | 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 |