@comfanion/workflow 3.9.0 → 4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/workflow",
3
- "version": "3.9.0",
3
+ "version": "4.1.0",
4
4
  "description": "Initialize OpenCode Workflow system for AI-assisted development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "3.0.0",
3
- "buildDate": "2026-01-23T17:06:57.357Z",
3
+ "buildDate": "2026-01-23T17:40:44.228Z",
4
4
  "files": [
5
5
  "config.yaml",
6
6
  "FLOW.yaml",
@@ -6,7 +6,7 @@
6
6
  # PROJECT CONFIGURATION
7
7
  # =============================================================================
8
8
  project_name: "ai-wf"
9
- version: "3.9.0"
9
+ version: "4.1.0"
10
10
 
11
11
  # =============================================================================
12
12
  # USER CONFIGURATION
@@ -206,26 +206,27 @@ S01 (Domain) ──┬──► S02 (Repo Interface) ──► S04 (Repo Impl)
206
206
  └──► S03 (Use Cases) ──► S05 (HTTP) ─┴──► S06 (Events) ──► S07 (Tests)
207
207
  ```
208
208
 
209
- ### Total Effort Calculation
209
+ ### Story Breakdown
210
210
 
211
211
  ```markdown
212
- ### Effort Summary
213
-
214
- | Story | Tasks | Hours | Days |
215
- |-------|-------|-------|------|
216
- | S01 | 4 | 20h | 2.5d |
217
- | S02 | 3 | 15h | 2d |
218
- | S03 | 5 | 26h | 3d |
219
- | S04 | 4 | 22h | 3d |
220
- | S05 | 3 | 16h | 2d |
221
- | S06 | 3 | 15h | 2d |
222
- | S07 | 3 | 15h | 2d |
223
- | **Total** | **25** | **129h** | **~16d** |
212
+ ### Stories Summary
213
+
214
+ | Story | Tasks | Size | Deps |
215
+ |-------|-------|------|------|
216
+ | S01 | 4 | M | - |
217
+ | S02 | 3 | S | S01 |
218
+ | S03 | 5 | L | S01 |
219
+ | S04 | 4 | M | S02 |
220
+ | S05 | 3 | S | S03 |
221
+ | S06 | 3 | S | S04 |
222
+ | S07 | 3 | S | S05,S06 |
223
+ | **Total** | **25** | | |
224
224
 
225
225
  **Parallel Opportunities:** S02+S03, S04+S05
226
- **With Parallelism:** ~10 days (2 weeks)
227
226
  ```
228
227
 
228
+ **Note:** No hour estimates. Use T-shirt sizes (XS/S/M/L/XL) for relative complexity.
229
+
229
230
  ## Epic Sizing
230
231
 
231
232
  ### Guidelines
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: story-writing
3
- description: How to write user stories with proper format, acceptance criteria in Given/When/Then, and technical tasks
3
+ description: How to write stories as execution plans with self-contained tasks
4
4
  license: MIT
5
5
  compatibility: opencode
6
6
  metadata:
@@ -85,37 +85,54 @@ Use template at: `@.opencode/templates/story-template.md`
85
85
 
86
86
  ## Story Structure
87
87
 
88
- ### Header
88
+ **Philosophy:** Story = execution plan. Tasks are the main content, not ceremony.
89
+
90
+ ### Header (Minimal)
89
91
 
90
92
  ```markdown
91
93
  # Story N.M: [Title]
92
94
 
93
95
  **Story ID:** [MODULE]-S[EPIC]-[NN]
94
96
  **Epic:** [MODULE]-E[EPIC] - [Epic Title]
95
- **Status:** TODO | IN_PROGRESS | REVIEW | DONE
96
- **Priority:** P0 | P1 | P2
97
- **Estimate:** XS | S | M | L | XL
97
+ **Status:** draft | ready-for-dev | in-progress | review | done
98
+ **Size:** XS | S | M | L | XL
99
+ ```
100
+
101
+ ### Goal (1-2 sentences)
102
+
103
+ ```markdown
104
+ ## Goal
105
+
106
+ Implement CRUD use cases for merchant products with validation and event publishing.
98
107
  ```
99
108
 
100
- ### User Story Format (MANDATORY)
109
+ **NOT** the verbose "As a... I want... So that..." format. Just state what the story achieves.
110
+
111
+ ### Acceptance Criteria (Brief List)
101
112
 
102
113
  ```markdown
103
- ## User Story
114
+ ## Acceptance Criteria
104
115
 
105
- **As a** [user type],
106
- **I want** [capability/action],
107
- **So that** [benefit/value].
116
+ - [ ] Products can be created with EAN validation
117
+ - [ ] Products can be retrieved by ID
118
+ - [ ] Products can be updated with optimistic locking
119
+ - [ ] Products can be listed with filters and pagination
120
+ - [ ] All operations publish domain events
108
121
  ```
109
122
 
110
- ### Sections
123
+ **NOT** detailed Given/When/Then for each. Just a checklist of what "done" looks like.
124
+
125
+ ### Tasks (MAIN CONTENT - 80% of file)
111
126
 
112
- 1. **User Story** - As a... I want... So that...
113
- 2. **Acceptance Criteria** - Given/When/Then (MANDATORY)
114
- 3. **Technical Tasks** - Implementation checklist
115
- 4. **Definition of Done** - Quality gates
116
- 5. **Technical Context** - Related files, patterns
117
- 6. **Test Scenarios** - Unit and integration tests
118
- 7. **Notes** - Additional context
127
+ Self-contained tasks with documentation links. See Task Structure below.
128
+
129
+ ### Sections (Simplified)
130
+
131
+ 1. **Header** - Minimal metadata
132
+ 2. **Goal** - 1-2 sentences
133
+ 3. **Acceptance Criteria** - Brief checklist
134
+ 4. **Tasks** - MAIN CONTENT (80% of file)
135
+ 5. **Notes** - Optional additional context
119
136
 
120
137
  ## Naming Conventions
121
138
 
@@ -141,65 +158,23 @@ Examples:
141
158
  - INVENTORY-S10-01
142
159
  ```
143
160
 
144
- ## Acceptance Criteria (MANDATORY)
161
+ ## Self-Contained Tasks (NO ESTIMATES)
145
162
 
146
- Use skill: `acceptance-criteria`
163
+ ### Task Philosophy
147
164
 
148
- ### Format: Given/When/Then
165
+ **CRITICAL:** Tasks must be **SELF-CONTAINED** - an AI agent or developer can take ANY task and execute it independently without asking questions.
149
166
 
150
- ```markdown
151
- ## Acceptance Criteria
152
-
153
- ### AC1: Create product with valid data
154
-
155
- **Given** authenticated merchant with "product:create" permission
156
- **When** POST /api/v1/products with:
157
- - name: "Test Product"
158
- - price: 100.00
159
- - currency: "UAH"
160
- **Then** 201 Created returned
161
- **And** response contains product with generated UUID
162
- **And** product status is "pending"
163
- **And** "product.created" event published to Kafka
164
-
165
- ### AC2: Reject invalid product data
166
-
167
- **Given** authenticated merchant
168
- **When** POST /api/v1/products with missing required field "name"
169
- **Then** 400 Bad Request returned
170
- **And** error response contains:
171
- - field: "name"
172
- - message: "name is required"
173
- **And** no product is created in database
174
-
175
- ### AC3: Unauthorized access rejected
176
-
177
- **Given** user without "product:create" permission
178
- **When** POST /api/v1/products
179
- **Then** 403 Forbidden returned
180
- ```
181
-
182
- ### AC Coverage
183
-
184
- Each story should have:
185
- - **Happy path** - At least 1 success scenario
186
- - **Validation errors** - Invalid input handling
187
- - **Authorization** - Permission checks
188
- - **Edge cases** - Boundary conditions
189
-
190
- ## Atomic Tasks (4-6 hours each)
167
+ **NO ESTIMATES** - Don't estimate time. Focus on clear scope and outcomes.
191
168
 
192
169
  ### Task Decomposition Rules
193
170
 
194
- **MANDATORY**: Every story MUST be broken into atomic tasks:
195
-
196
171
  | Rule | Description |
197
172
  |------|-------------|
198
- | **4-6 hours** | Each task should be 4-6 hours of focused work |
199
- | **Single responsibility** | One clear deliverable per task |
200
- | **Explicit dependencies** | Every task declares what it depends on |
201
- | **Parallel opportunities** | Independent tasks can run in parallel |
202
- | **Red-Green-Refactor** | Follow TDD cycle in task types |
173
+ | **Self-contained** | Task has ALL information needed to execute |
174
+ | **Documentation links** | Every task links to relevant docs, schemas, examples |
175
+ | **Clear input/output** | What exists before, what must exist after |
176
+ | **Testable outcome** | How to verify task is complete |
177
+ | **Independent execution** | Can be picked up without context from other tasks |
203
178
 
204
179
  ## Development Methodologies
205
180
 
@@ -235,203 +210,137 @@ Interface → Stub Implementation → Tests → Real Implementation
235
210
 
236
211
  **Best for:** Exploratory work, unclear requirements, rapid prototyping
237
212
 
238
- ### Task Structure by Methodology
213
+ ### Task Structure (MANDATORY FORMAT)
239
214
 
240
- **TDD Task:**
241
- ```markdown
242
- ### T2: Implement {{Entity}} Aggregate + Tests
243
- - **Estimate:** 5h
244
- - **Depends on:** T1
245
- - **Methodology:** TDD
246
- - **Deliverables:**
247
- - [ ] Aggregate: `domain/aggregate/entity.go`
248
- - [ ] Value objects: `domain/valueobject/*.go`
249
- - **Validation Test:** `domain/aggregate/entity_test.go`
250
- - [ ] Test creation happy path
251
- - [ ] Test validation errors
252
- - [ ] Test business rules
253
- - [ ] **⚠️ ALL TESTS MUST PASS**
254
- ```
215
+ Each task MUST have this structure to be self-contained:
255
216
 
256
- **STUB Task:**
257
217
  ```markdown
258
- ### T2: Implement Repository (Stub → Real) + Tests
259
- - **Estimate:** 6h
260
- - **Depends on:** T1
261
- - **Methodology:** STUB
262
- - **Deliverables:**
263
- - [ ] Stub: `infrastructure/repo/entity_memory_repo.go`
264
- - [ ] Real: `infrastructure/repo/entity_postgres_repo.go`
265
- - **Validation Test:** `infrastructure/repo/entity_repo_test.go`
266
- - [ ] Test Save, FindByID, List
267
- - [ ] Test with stub first
268
- - [ ] Replace stub with real
269
- - [ ] **⚠️ ALL TESTS MUST PASS**
270
- ```
271
-
272
- ---
218
+ ### T{N}: {Clear Task Name}
273
219
 
274
- ### Task Types
220
+ **Goal:** One sentence describing what this task achieves.
275
221
 
276
- | Type | Icon | Description |
277
- |------|------|-------------|
278
- | INTERFACE | 📐 | Define interface/contract |
279
- | RED | 🔴 | Write failing test first (TDD) |
280
- | GREEN | 🟢 | Implement to pass tests |
281
- | STUB | 🧪 | Stub implementation (STUB methodology) |
282
- | REFACTOR | 🔵 | Clean up, no new functionality |
283
- | INTEGRATION | 🔗 | E2E integration test |
284
- | DOCS | 📝 | Documentation only |
222
+ **Documentation:**
223
+ - [AGENTS.md#section](../../../AGENTS.md#section) - Relevant coding patterns
224
+ - [data-model.md#table](../docs/data-model.md#table) - Database schema
225
+ - [example.go](../src/path/example.go) - Pattern to follow
285
226
 
286
- ### Task Structure
227
+ **Input (Prerequisites):**
228
+ - T{N-1} completed (if dependent)
229
+ - Existing file: `path/to/existing.go` - what it provides
230
+ - Repository interface defined in: `path/to/interface.go`
287
231
 
288
- ```markdown
289
- ### T{N}: {Task Name}
290
- - **Estimate:** 4h | 5h | 6h
291
- - **Depends on:** T1, T2 | - (none)
292
- - **Blocks:** T5, T6 | - (none)
293
- - **Type:** 🔴 RED | 🟢 GREEN | 🔵 REFACTOR | 📝 DOCS
294
- - **Files:** `path/to/file.go`
295
- - **Definition of Done:**
296
- - [ ] Specific deliverable 1
297
- - [ ] Specific deliverable 2
298
- - **Notes:** Implementation hints
299
- ```
232
+ **Output (Deliverables):**
233
+ - `path/to/new_file.go` - Description of what this file does
234
+ - `path/to/new_file_test.go` - Tests covering X, Y, Z
300
235
 
301
- ### Dependency Graph (ASCII)
236
+ **Implementation Steps:**
237
+ 1. Read documentation links above
238
+ 2. Create file structure following pattern from [example.go]
239
+ 3. Implement X following AGENTS.md conventions
240
+ 4. Write tests covering: happy path, validation errors, edge cases
241
+ 5. Run tests, ensure all pass
302
242
 
303
- Visualize task dependencies:
243
+ **Acceptance Criteria:**
244
+ - [ ] File created at correct path
245
+ - [ ] Follows naming conventions from AGENTS.md
246
+ - [ ] All tests pass: `go test ./path/to/...`
247
+ - [ ] No linting errors: `golangci-lint run`
304
248
 
249
+ **Notes:** Additional hints, gotchas, or context
305
250
  ```
306
- T1 ──┬──► T2 ──► T4
307
- │ │
308
- └──► T3 ────┴──► T5 ──► T6
309
- ```
310
251
 
311
- - `──►` = depends on (must complete before)
312
- - `┬` = fork (parallel branches)
313
- - `┴` = join (waits for all)
252
+ ### Why This Structure?
253
+
254
+ | Section | Purpose |
255
+ |---------|---------|
256
+ | **Goal** | Agent knows the "why" |
257
+ | **Documentation** | Agent can read all needed context |
258
+ | **Input** | Agent knows what must exist before starting |
259
+ | **Output** | Agent knows exactly what to create |
260
+ | **Implementation Steps** | Agent has step-by-step guidance |
261
+ | **Acceptance Criteria** | Agent can verify completion |
314
262
 
315
- ### Summary Table (MANDATORY)
263
+ ### Tasks Summary Table
316
264
 
317
265
  ```markdown
318
- | ID | Task | Est | Depends On | Status |
319
- |----|------|-----|------------|--------|
320
- | T1 | Domain layer (aggregates, value objects, tests) | 6h | - | ⬜ |
321
- | T2 | Repository interface + use case tests | 5h | T1 | ⬜ |
322
- | T3 | Use case implementation | 5h | T2 | ⬜ |
323
- | T4 | Repository implementation (PostgreSQL) | 6h | T2 | ⬜ |
324
- | T5 | HTTP handlers + tests | 5h | T3 | ⬜ |
325
- | T6 | Integration tests + refactor | 5h | T4, T5 | ⬜ |
266
+ | ID | Task | Deps | Status |
267
+ |----|------|------|--------|
268
+ | T1 | MerchantProduct Aggregate + Value Objects | - | ⬜ |
269
+ | T2 | Repository Interface | T1 | ⬜ |
270
+ | T3 | CreateProduct Use Case | T2 | ⬜ |
271
+ | T4 | PostgreSQL Repository Implementation | T2 | ⬜ |
272
+ | T5 | HTTP Handler + Routes | T3, T4 | ⬜ |
326
273
  ```
327
274
 
328
275
  **Status:** ⬜ TODO | 🔄 IN_PROGRESS | ✅ DONE | ⏸️ BLOCKED
329
276
 
330
- ### Execution Phases
331
-
332
- Group tasks by parallel execution opportunity:
277
+ ### Dependency Graph (Optional)
333
278
 
334
- ```markdown
335
- ### Execution Order
336
-
337
- Phase 1: T1 (no deps)
338
- Phase 2: T2, T3 (parallel - both depend only on T1)
339
- Phase 3: T4, T6 (parallel - independent branches)
340
- Phase 4: T5 (waits for T3, T4)
341
- Phase 5: T7 (waits for T5)
342
- Phase 6: T8, T6-continued (parallel)
343
- Phase 7: T9 (waits for T6, T8)
344
- Phase 8: T10 (final)
345
-
346
- **Critical Path:** T1 → T2 → T4 → T5 → T7 → T8 → T9 → T10
347
- **Total Estimate:** 32h (4 days)
348
- **Parallel Savings:** ~3h (25%)
349
279
  ```
350
-
351
- ### Example: CreateProduct Story Tasks
352
-
353
- ```markdown
354
- | ID | Task | Est | Depends On | Type |
355
- |----|------|-----|------------|------|
356
- | T1 | Domain layer: Product aggregate + value objects + tests | 6h | - | 🔴🟢 |
357
- | T2 | Repository interface + CreateProduct use case tests | 5h | T1 | 🔴 |
358
- | T3 | CreateProduct use case implementation | 5h | T2 | 🟢 |
359
- | T4 | PostgreSQL repository implementation + tests | 6h | T2 | 🟢 |
360
- | T5 | HTTP handler + tests | 5h | T3 | 🔴🟢 |
361
- | T6 | Integration tests + refactor + documentation | 5h | T4, T5 | 🔵 |
362
-
363
- **Graph:**
364
- T1 ──► T2 ──┬──► T4 ──► T5 ──► T7 ──► T8 ──┬──► T9 ──► T10
365
- │ │
366
- T3 ─────────┴───────────► T6 ───────────────┘
280
+ T1 ──► T2 ──┬──► T3 ──┬──► T5
281
+ │ │
282
+ └──► T4 ──┘
367
283
  ```
368
284
 
369
- ### Splitting Large Tasks
370
-
371
- If a task exceeds 6h, consider splitting it. **Each task MUST have validation test.**
372
-
373
- | Original (8h+) | Split Into (with tests) |
374
- |----------------|------------------------|
375
- | "Full domain layer" (10h) | **T1:** Value objects + tests (4h)<br>**T2:** Aggregate + business rules + tests (6h) |
376
- | "Full repository" (10h) | **T1:** Interface + Save/FindByID + tests (5h)<br>**T2:** List/Search + advanced queries + tests (5h) |
377
-
378
- ### Task Template with Validation
379
-
380
- ```markdown
381
- ### T{N}: {Task Name}
382
- - **Estimate:** 5h
383
- - **Depends on:** T{N-1}
384
- - **Methodology:** TDD | STUB
385
- - **Deliverables:**
386
- - [ ] File: `path/to/implementation.go`
387
- - [ ] File: `path/to/implementation2.go`
388
- - **Validation Test:** `path/to/implementation_test.go`
389
- - [ ] Test case 1: happy path
390
- - [ ] Test case 2: error handling
391
- - [ ] Test case 3: edge case
392
- - [ ] **⚠️ ALL TESTS MUST PASS** ← MANDATORY
393
- - **Notes:** Implementation hints
394
- ```
395
-
396
- ### Validation Test Requirements
397
-
398
- **Every task MUST have:**
285
+ ---
399
286
 
400
- | Test Type | Required | Description |
401
- |-----------|----------|-------------|
402
- | Happy path | ✅ Yes | Normal success case |
403
- | Error handling | ✅ Yes | Expected failures |
404
- | Edge cases | Recommended | Boundary conditions |
405
- | **Pass gate** | ✅ MANDATORY | `⚠️ ALL TESTS MUST PASS` |
287
+ ## Full Task Example
406
288
 
407
- ### TDD vs STUB Task Examples
289
+ Here's a complete example of a self-contained task:
408
290
 
409
- **TDD Example:**
410
291
  ```markdown
411
- ### T2: Implement Product Aggregate
412
- - **Methodology:** TDD
413
- - **Deliverables:**
414
- - [ ] `domain/aggregate/product.go`
415
- - **Validation Test:** `domain/aggregate/product_test.go`
416
- - [ ] 🔴 Write test first (should FAIL)
417
- - [ ] 🟢 Implement until test PASSES
418
- - [ ] 🔵 Refactor, tests still PASS
419
- - [ ] **⚠️ ALL TESTS MUST PASS**
420
- ```
421
-
422
- **STUB Example:**
423
- ```markdown
424
- ### T4: Implement Repository
425
- - **Methodology:** STUB
426
- - **Deliverables:**
427
- - [ ] Stub: `infrastructure/repo/product_memory_repo.go`
428
- - [ ] Real: `infrastructure/repo/product_postgres_repo.go`
429
- - **Validation Test:** `infrastructure/repo/product_repo_test.go`
430
- - [ ] 🧪 Write stub (mock data)
431
- - [ ] Write tests against stub
432
- - [ ] 🟢 Replace with real impl
433
- - [ ] **⚠️ ALL TESTS MUST PASS**
434
- ```
292
+ ### T1: MerchantProduct Aggregate + Value Objects
293
+
294
+ **Goal:** Create the MerchantProduct aggregate with all value objects and domain validation.
295
+
296
+ **Documentation:**
297
+ - [AGENTS.md#type-safety](../../../AGENTS.md#type-safety) - Value object patterns
298
+ - [AGENTS.md#naming-conventions](../../../AGENTS.md#naming-conventions) - File/package naming
299
+ - [catalog-data-model.md#merchant_products](../docs/catalog-data-model.md#31-merchant-products) - Database schema
300
+ - [modules/catalog/domain/entity/marketplace_category.go](../src/services/catalog/modules/catalog/domain/entity/marketplace_category.go) - Example entity pattern
301
+
302
+ **Input (Prerequisites):**
303
+ - None (first task in story)
304
+ - Existing patterns in `modules/catalog/domain/` to follow
305
+
306
+ **Output (Deliverables):**
307
+ - `modules/catalog/domain/valueobject/merchant_id.go` - UUID wrapper with validation
308
+ - `modules/catalog/domain/valueobject/product_id.go` - UUID wrapper
309
+ - `modules/catalog/domain/valueobject/merchant_sku.go` - String with max length validation
310
+ - `modules/catalog/domain/valueobject/ean.go` - GTIN-13 checksum validation
311
+ - `modules/catalog/domain/valueobject/product_status.go` - Enum (pending, active, etc.)
312
+ - `modules/catalog/domain/entity/merchant_product.go` - Aggregate with private fields + getters
313
+ - `modules/catalog/domain/entity/merchant_product_test.go` - All tests
314
+
315
+ **Implementation Steps:**
316
+ 1. Read AGENTS.md sections on value objects and naming
317
+ 2. Look at existing `marketplace_category.go` for entity pattern
318
+ 3. Create value objects with `New*()` factory functions that validate
319
+ 4. Create aggregate with private fields, public getters, factory method
320
+ 5. Write tests: creation happy path, validation errors, status transitions
321
+ 6. Run `go test ./modules/catalog/domain/...`
322
+
323
+ **Acceptance Criteria:**
324
+ - [ ] All files created at correct paths
325
+ - [ ] Value objects validate on construction (not setters)
326
+ - [ ] EAN validates GTIN-13 checksum
327
+ - [ ] Aggregate uses private fields with getters
328
+ - [ ] Tests cover: valid creation, invalid data rejection, status transitions
329
+ - [ ] `go test ./modules/catalog/domain/...` passes
330
+ - [ ] `golangci-lint run ./modules/catalog/domain/...` passes
331
+
332
+ **Notes:**
333
+ - EAN checksum algorithm: sum odd positions × 1, even × 3, check digit makes sum divisible by 10
334
+ - Status enum values from PRD: pending, pending_category, pending_dedup, pending_pim, active, declined
335
+ ```
336
+
337
+ ### What Makes This Task Self-Contained?
338
+
339
+ 1. **Agent can start immediately** - all documentation links provided
340
+ 2. **No guessing** - exact file paths specified
341
+ 3. **Pattern to follow** - links to existing code examples
342
+ 4. **Clear verification** - specific test commands and criteria
343
+ 5. **Context included** - notes explain non-obvious details (EAN algorithm)
435
344
 
436
345
  ## Definition of Done
437
346
 
@@ -610,13 +519,11 @@ Add to each story:
610
519
 
611
520
  Before completing story:
612
521
  - [ ] Story ID is unique
613
- - [ ] User story follows format
614
- - [ ] **Acceptance criteria in Given/When/Then** (MANDATORY!)
615
- - [ ] At least 3 AC (happy path, error, edge case)
616
- - [ ] Technical tasks are specific
617
- - [ ] **TODO placeholders defined for future work**
522
+ - [ ] Goal is clear (1-2 sentences)
523
+ - [ ] Acceptance criteria as checklist (what "done" looks like)
524
+ - [ ] Tasks are self-contained with documentation links
525
+ - [ ] Each task has: Goal, Documentation, Input, Output, Steps, AC
618
526
  - [ ] Definition of Done is complete
619
- - [ ] Estimate is reasonable
620
527
  - [ ] Links to epic are correct
621
528
 
622
529
  ## Output
@@ -84,8 +84,8 @@ S01 ──► S02 ──► S03 ──► S04
84
84
  ### Story Decomposition Rules
85
85
 
86
86
  Each story MUST:
87
- 1. Be completable in 2-5 days
88
- 2. Have 3-6 atomic tasks (4-6h each)
87
+ 1. Be completable (not too big, not too small)
88
+ 2. Have self-contained tasks with documentation links
89
89
  3. Have clear dependencies on other stories
90
90
  4. Map to specific Acceptance Criteria
91
91
 
@@ -99,15 +99,17 @@ Each story MUST:
99
99
  6. **Events** - Domain events, Kafka publishers
100
100
  7. **Integration Tests** - End-to-end verification
101
101
 
102
- ### Total Effort Breakdown
102
+ ### Stories by Layer
103
103
 
104
- | Layer | Stories | Tasks | Hours |
105
- |-------|---------|-------|-------|
106
- | Domain | 1 | 4 | 20h |
107
- | Application | 1 | 4 | 22h |
108
- | Infrastructure | 2 | 5 | 28h |
109
- | Testing | 1 | 3 | 15h |
110
- | **Total** | **5** | **16** | **85h** |
104
+ | Layer | Stories | Tasks | Size |
105
+ |-------|---------|-------|------|
106
+ | Domain | 1 | 4 | M |
107
+ | Application | 2 | 6 | M |
108
+ | Infrastructure | 2 | 5 | L |
109
+ | Testing | 1 | 3 | S |
110
+ | **Total** | **6** | **18** | |
111
+
112
+ **Note:** No hour estimates. Size = relative complexity (XS/S/M/L/XL).
111
113
 
112
114
  ---
113
115
 
@@ -8,436 +8,170 @@ workflowType: 'story'
8
8
 
9
9
  **Story ID:** {{module}}-S{{epic_number}}-{{story_number}}
10
10
  **Epic:** {{module}}-E{{epic_number}} - {{epic_title}}
11
- **Status:** draft | ready-for-dev | in-progress | review | done | blocked
12
- **Priority:** P0 | P1 | P2
13
- **Estimate:** XS | S | M | L | XL
14
- **Created:** {{date}}
15
- **Last Updated:** {{date}}
11
+ **Status:** draft | ready-for-dev | in-progress | review | done
12
+ **Size:** XS | S | M | L | XL
16
13
 
17
14
  ---
18
15
 
19
- ## User Story
16
+ ## Prerequisites (PM reads before writing tasks)
20
17
 
21
- **As a** {{user_type}},
22
- **I want** {{capability}},
23
- **So that** {{benefit}}.
18
+ <!-- ⚠️ MANDATORY: Read these docs before writing tasks! -->
24
19
 
25
- ---
26
-
27
- ## Acceptance Criteria
28
-
29
- ### AC1: {{criterion_name}}
30
-
31
- **Given** {{precondition}}
32
- **When** {{action}}
33
- **Then** {{expected_result}}
34
- **And** {{additional_check}}
35
-
36
- ### AC2: {{criterion_name}}
37
-
38
- **Given** {{precondition}}
39
- **When** {{action}}
40
- **Then** {{expected_result}}
41
-
42
- ### AC3: {{criterion_name}}
43
-
44
- **Given** {{precondition}}
45
- **When** {{action}}
46
- **Then** {{expected_result}}
20
+ - [ ] `AGENTS.md` / `CLAUDE.md` - coding patterns, naming, error handling
21
+ - [ ] `docs/coding-standards/` - detailed coding standards
22
+ - [ ] `docs/architecture/{{module}}/` - module architecture, data model
23
+ - [ ] Existing code in `src/services/{{module}}/` - patterns to follow
47
24
 
48
25
  ---
49
26
 
50
- ## Atomic Tasks
51
-
52
- <!--
53
- METHODOLOGY: {{methodology}} (tdd | stub)
54
- - TDD: Interface → Test (failing) → Implementation → Refactor
55
- - STUB: Interface → Stub → Test → Full Implementation
56
-
57
- RULES:
58
- - Each task is 4-6 hours of focused work
59
- - Each task includes TEST as validation gate
60
- - Tasks have explicit dependencies
61
- - Dev agent respects dependency order
62
- -->
63
-
64
- ### Development Methodology: **{{methodology}}**
27
+ ## Goal
65
28
 
66
- ```
67
- {{#if methodology == "tdd"}}
68
- TDD Flow per Task:
69
- 1. Define Interface/Contract
70
- 2. Write Failing Test (RED)
71
- 3. Implement Minimal Code (GREEN)
72
- 4. Refactor
73
- 5. Validate: Test MUST pass
74
- {{/if}}
75
- {{#if methodology == "stub"}}
76
- STUB Flow per Task:
77
- 1. Define Interface/Contract
78
- 2. Write Stub Implementation (returns mock data)
79
- 3. Write Tests against Stub
80
- 4. Replace Stub with Real Implementation
81
- 5. Validate: Test MUST pass
82
- {{/if}}
83
- ```
29
+ {{Short description - 1-2 sentences. What this story achieves. Same as in epic's stories table.}}
84
30
 
85
31
  ---
86
32
 
87
- ### Task Dependency Graph
88
-
89
- ```
90
- T1 ──┬──► T2 ──► T3
91
-
92
- └──► T4 ──► T5
93
-
94
- T3 ───────────────┴──► T6
95
- ```
96
-
97
- ### Tasks Summary
98
-
99
- | ID | Task | Est | Deps | Test | Status |
100
- |----|------|-----|------|------|--------|
101
- | T1 | {{task_1}} | 5h | - | unit | ⬜ |
102
- | T2 | {{task_2}} | 6h | T1 | unit | ⬜ |
103
- | T3 | {{task_3}} | 5h | T2 | unit | ⬜ |
104
- | T4 | {{task_4}} | 5h | T1 | unit | ⬜ |
105
- | T5 | {{task_5}} | 5h | T3,T4 | integration | ⬜ |
33
+ ## Acceptance Criteria
106
34
 
107
- **Status:** TODO | 🔄 IN_PROGRESS | ✅ DONE | ⏸️ BLOCKED | ❌ FAILED
35
+ - [ ] {{criterion_1}}
36
+ - [ ] {{criterion_2}}
37
+ - [ ] {{criterion_3}}
38
+ - [ ] All tests pass
39
+ - [ ] No linting errors
108
40
 
109
41
  ---
110
42
 
111
- ### T1: Domain Layer (Aggregates, Value Objects)
112
- - **Estimate:** 6h
113
- - **Depends on:** -
114
- - **Blocks:** T2
115
- - **Deliverables:**
116
- - [ ] Interface/contract defined
117
- - [ ] Value objects with validation
118
- - [ ] Aggregate with business rules
119
- - [ ] Factory methods
120
- - **Validation Test:**
121
- - [ ] Value object tests (validation, equality)
122
- - [ ] Aggregate creation tests
123
- - [ ] Business rules tests
124
- - [ ] **⚠️ ALL TESTS MUST PASS**
125
- - **Notes:** {{implementation_hint}}
43
+ ## Tasks
126
44
 
127
- ---
45
+ | ID | Task | Deps | Status |
46
+ |----|------|------|--------|
47
+ | T1 | {{task_1_name}} | - | ⬜ |
48
+ | T2 | {{task_2_name}} | T1 | ⬜ |
49
+ | T3 | {{task_3_name}} | T2 | ⬜ |
128
50
 
129
- ### T2: Repository Interface + Use Case Tests
130
- - **Estimate:** 5h
131
- - **Depends on:** T1
132
- - **Blocks:** T3, T4
133
- - **Deliverables:**
134
- - [ ] Repository interface (ports)
135
- - [ ] Use case interface
136
- - [ ] Use case DTOs (input/output)
137
- - [ ] Use case tests (with mock repository)
138
- - **Validation Test:**
139
- - [ ] Use case happy path test
140
- - [ ] Use case error handling tests
141
- - [ ] **⚠️ ALL TESTS MUST PASS**
142
- - **Notes:** {{implementation_hint}}
51
+ **Status:** TODO | 🔄 IN_PROGRESS | ✅ DONE | ⏸️ BLOCKED
143
52
 
144
53
  ---
145
54
 
146
- ### T3: Use Case Implementation
147
- - **Estimate:** 5h
148
- - **Depends on:** T2
149
- - **Blocks:** T5
150
- - **Deliverables:**
151
- - [ ] Use case handler implementation
152
- - [ ] Mappers (entity ↔ DTO)
153
- - [ ] Error handling
154
- - **Validation Test:**
155
- - [ ] All use case tests pass
156
- - [ ] Edge cases covered
157
- - [ ] **⚠️ ALL TESTS MUST PASS**
158
- - **Notes:** {{implementation_hint}}
159
-
160
- ---
55
+ ### T1: {{task_1_name}}
161
56
 
162
- ### T4: Repository Implementation
163
- - **Estimate:** 6h
164
- - **Depends on:** T2
165
- - **Blocks:** T5
166
- - **Deliverables (TDD):**
167
- - [ ] Write repository tests first
168
- - [ ] PostgreSQL repository implementation
169
- - **Deliverables (STUB):**
170
- - [ ] In-memory stub first
171
- - [ ] PostgreSQL implementation
172
- - **Validation Test:**
173
- - [ ] Test Save
174
- - [ ] Test FindByID (found/not found)
175
- - [ ] Test List with filters
176
- - [ ] **⚠️ ALL TESTS MUST PASS**
177
- - **Notes:** {{implementation_hint}}
57
+ **Goal:** {{what_this_task_achieves}}
178
58
 
179
- ---
59
+ **Documentation:**
60
+ - [AGENTS.md#section](../../../AGENTS.md#section) - {{what_pattern}}
61
+ - [data-model.md#table](../../../docs/data-model.md#section) - {{schema_info}}
62
+ - [existing_example.go](../path/to/example.go) - Pattern to follow
180
63
 
181
- ### T5: HTTP Handlers + Integration Tests
182
- - **Estimate:** 5h
183
- - **Depends on:** T3, T4
184
- - **Blocks:** -
185
- - **Deliverables:**
186
- - [ ] HTTP handler/controller
187
- - [ ] Routes registered
188
- - [ ] Request/response validation
189
- - [ ] Integration tests
190
- - [ ] Documentation updated
191
- - **Validation Test:**
192
- - [ ] Test 201 Created
193
- - [ ] Test 400 Bad Request (validation)
194
- - [ ] Test 404 Not Found
195
- - [ ] E2E: API → Service → Repo → DB
196
- - [ ] **⚠️ ALL TESTS MUST PASS**
197
- - [ ] **⚠️ NO REGRESSIONS**
198
- - **Notes:** {{implementation_hint}}
64
+ **Input (Prerequisites):**
65
+ - {{what_must_exist_before_starting}}
66
+ - Existing file: `path/to/dependency.go` - provides {{what}}
199
67
 
200
- ---
68
+ **Output (Deliverables):**
69
+ - `path/to/new_file.go` - {{description}}
70
+ - `path/to/new_file_test.go` - Tests for {{what}}
201
71
 
202
- ### Execution Phases
72
+ **Implementation Steps:**
73
+ 1. Read documentation links above
74
+ 2. {{step_2}}
75
+ 3. {{step_3}}
76
+ 4. Write tests covering: happy path, errors, edge cases
77
+ 5. Run: `go test ./path/to/...`
203
78
 
204
- | Phase | Tasks (Parallel) | Duration | Tests Required |
205
- |-------|-----------------|----------|----------------|
206
- | 1 | T1 | 6h | Domain layer tests |
207
- | 2 | T2 | 5h | Use case tests |
208
- | 3 | T3, T4 | 6h | Implementation tests |
209
- | 4 | T5 | 5h | Integration tests |
210
- | **Total** | | **22h** | **All green** |
79
+ **Acceptance Criteria:**
80
+ - [ ] Files created at specified paths
81
+ - [ ] Follows patterns from AGENTS.md
82
+ - [ ] Tests pass: `go test ./path/to/...`
83
+ - [ ] Lint passes: `golangci-lint run`
211
84
 
212
- **Critical Path:** T1 → T2 → T3 → T5 = 21h (~3 days)
213
- **With Parallelism (T3 || T4):** ~2.5 days
85
+ **Notes:** {{additional_context_or_gotchas}}
214
86
 
215
87
  ---
216
88
 
217
- ## TODO Placeholders
89
+ ### T2: {{task_2_name}}
218
90
 
219
- <!--
220
- When implementing, leave TODO comments for:
221
- - Next tasks in this story
222
- - Future stories/epics
223
- - Technical debt
224
- - Planned improvements
225
-
226
- Format: TODO({TYPE}:{ID}): {description}
227
- -->
91
+ **Goal:** {{what_this_task_achieves}}
228
92
 
229
- ### TODOs to Create During Implementation
93
+ **Documentation:**
94
+ - [AGENTS.md#section](link) - {{pattern}}
95
+ - [T1 output](../path/from/T1) - Uses types from T1
230
96
 
231
- | Location | TODO | Type | Reference |
232
- |----------|------|------|-----------|
233
- | `src/domain/{{entity}}` | Add validation for X | TASK | T3 |
234
- | `src/application/{{usecase}}` | Add caching | STORY | S{{epic}}-04 |
235
- | `src/infrastructure/repo/` | Add batch operations | EPIC | E{{next_epic}} |
236
- | `src/api/` | Add rate limiting | BACKLOG | - |
97
+ **Input (Prerequisites):**
98
+ - T1 completed
99
+ - Files from T1: `path/to/aggregate.go`
237
100
 
238
- ### TODO Format Reference (IDE-compatible)
239
-
240
- ```go
241
- // TODO(TASK:T3): Implement validation logic here
242
- // Called from: T2 implementation
243
- // Blocked until: T3 starts
244
-
245
- // TODO(STORY:{{module}}-S05-04): Add pagination support
246
- // This story implements basic list, pagination in next story
247
- // See: docs/sprint-artifacts/sprint-1/stories/story-05-04.md
248
-
249
- // TODO(EPIC:{{module}}-E06): Replace with event-driven approach
250
- // Current sync implementation, async in Epic 6
251
- // See: docs/sprint-artifacts/backlog/epic-06.md
252
-
253
- // TODO(SPRINT:SP3): Performance optimization needed
254
- // Current O(n²), optimize in Sprint 3
255
-
256
- // TODO(BACKLOG): Consider adding retry logic
257
- // Not planned yet, but would improve reliability
258
-
259
- // TODO(TECH_DEBT): Refactor this duplication
260
- // Copy-pasted from X, extract common logic
261
-
262
- // FIXME(BUG:GH-123): Fix null pointer exception
263
- // Occurs when input is empty
264
- // Ticket: https://github.com/org/repo/issues/123
265
-
266
- // HACK: Temporary workaround for API limitation
267
- // Remove when: STORY:{{module}}-S05-08 implemented
268
- ```
101
+ **Output (Deliverables):**
102
+ - `path/to/file.go` - {{description}}
103
+ - `path/to/file_test.go` - Tests
269
104
 
270
- **GoLand/IntelliJ Setup:**
271
- ```
272
- Settings → Editor → TODO → Add Pattern:
273
- \bTODO\(.*\):.*
274
- \bFIXME\(.*\):.*
275
- \bHACK:.*
276
- ```
105
+ **Implementation Steps:**
106
+ 1. {{step}}
107
+ 2. {{step}}
277
108
 
278
- ### Related Future Work
109
+ **Acceptance Criteria:**
110
+ - [ ] {{criterion}}
111
+ - [ ] Tests pass
279
112
 
280
- | ID | Type | Description | Blocks This? |
281
- |----|------|-------------|--------------|
282
- | T3 | Task | Validation logic | No |
283
- | S{{epic}}-04 | Story | Pagination | No |
284
- | E{{next_epic}} | Epic | Event-driven | No |
113
+ **Notes:** {{notes}}
285
114
 
286
115
  ---
287
116
 
288
- ## Dev Notes
289
-
290
- <!-- Context for the developer implementing this story -->
291
-
292
- ### Coding Standards Applied (MANDATORY)
293
-
294
- **Standards documents used for this story:**
295
- - [ ] `CLAUDE.md` - Project patterns, file structure, conventions
296
- - [ ] `docs/coding-standards/` - Detailed coding standards
297
- - [ ] Naming conventions
298
- - [ ] Error handling patterns
299
- - [ ] Testing patterns
300
- - [ ] `docs/architecture/{{module}}/architecture.md` - Module-specific patterns
301
-
302
- **Key patterns from CLAUDE.md:**
303
- - File naming: `{{file_naming_pattern}}`
304
- - Package structure: `{{package_structure}}`
305
- - Error handling: `{{error_handling_pattern}}`
306
- - Test file naming: `{{test_naming_pattern}}`
307
-
308
- ### Architecture Requirements
309
- - Follow hexagonal architecture patterns
310
- - Domain layer must not import infrastructure
311
- - Use value objects for domain concepts
312
-
313
- ### Technical Specifications
314
- - {{technical_specs}}
315
-
316
- ### Dependencies
317
- - Depends on: {{dependencies}}
318
- - Blocked by: {{blockers}}
319
-
320
- ### Previous Learnings
321
- - {{learnings_from_similar_work}}
117
+ ### T3: {{task_3_name}}
322
118
 
323
- ### Reference Files
324
- - `src/path/to/related/file` - [why relevant]
325
- - `docs/architecture.md#section` - [architecture guidance]
326
- - `CLAUDE.md#section` - [coding patterns]
119
+ **Goal:** {{goal}}
327
120
 
328
- ### Patterns to Follow
329
- - **MANDATORY:** Follow patterns from `CLAUDE.md`
330
- - **MANDATORY:** Follow `docs/coding-standards/`
331
- - Match existing code style in module
121
+ **Documentation:**
122
+ - {{links}}
332
123
 
333
- ### API/Interface
334
- ```
335
- // Expected interface or function signature
336
- // (language-specific syntax)
337
- ```
124
+ **Input (Prerequisites):**
125
+ - T2 completed
126
+ - {{dependencies}}
338
127
 
339
- ---
128
+ **Output (Deliverables):**
129
+ - {{files}}
340
130
 
341
- ## Test Scenarios
131
+ **Implementation Steps:**
132
+ 1. {{steps}}
342
133
 
343
- ### Unit Tests
344
- 1. {{test_scenario_1}}
345
- 2. {{test_scenario_2}}
346
- 3. {{edge_case_1}}
134
+ **Acceptance Criteria:**
135
+ - [ ] {{criteria}}
136
+ - [ ] All tests pass
137
+ - [ ] **⚠️ NO REGRESSIONS** (run full test suite)
347
138
 
348
- ### Integration Tests
349
- 1. {{integration_scenario_1}}
350
- 2. {{integration_scenario_2}}
139
+ **Notes:** {{notes}}
351
140
 
352
141
  ---
353
142
 
354
- ## Dev Agent Record
355
-
356
- <!-- Automatically updated by Dev agent during implementation -->
357
-
358
- ### Implementation Plan
359
- <!-- Dev agent documents approach here -->
143
+ ## Notes
360
144
 
361
- ### Debug Log
362
- <!-- Dev agent logs debugging notes here -->
363
-
364
- ### Completion Notes
365
- <!-- Dev agent summarizes what was implemented -->
145
+ <!-- Optional: additional context, learnings, blockers -->
366
146
 
367
147
  ---
368
148
 
369
- ## File List
370
-
371
- <!-- Dev agent updates with all changed files -->
372
-
373
- ### Created Files
374
- -
375
-
376
- ### Modified Files
377
- -
149
+ ## Definition of Done
378
150
 
379
- ### Deleted Files
380
- -
151
+ - [ ] All acceptance criteria met
152
+ - [ ] All tasks completed
153
+ - [ ] Tests passing (>80% coverage)
154
+ - [ ] Code follows AGENTS.md patterns
155
+ - [ ] No linting errors
156
+ - [ ] PR merged to epic branch
381
157
 
382
158
  ---
383
159
 
384
160
  ## Changelog
385
161
 
386
- <!-- UPDATE AT END OF SESSION -->
387
-
388
162
  | Version | Date | Author | Changes |
389
163
  |---------|------|--------|---------|
390
- | 0.1 | {{date}} | @sm | Story created |
164
+ | 0.1 | {{date}} | @pm | Story created |
391
165
 
392
166
  <!--
393
167
  Changelog Guidelines:
394
168
  - Update at END of work session
395
169
  - Dev: summarize what was implemented
396
170
  - Version: 0.x=draft, 1.0=ready-for-dev, 1.x=in-progress, 2.0=done
397
-
398
- Example session entries:
399
- | 2.0 | 2024-01-25 | @dev | Complete: T1-T7 done; All tests pass; Ready for review |
400
- | 1.1 | 2024-01-23 | @dev | Progress: T1-T4 complete; T5 blocked by API issue |
401
- | 1.0 | 2024-01-20 | @sm | Ready for dev: 7 tasks defined; AC reviewed |
402
171
  -->
403
172
 
404
173
  ---
405
174
 
406
- ## Definition of Done
407
-
408
- - [ ] All acceptance criteria implemented and verified
409
- - [ ] All tasks/subtasks marked complete [x]
410
- - [ ] Unit tests written and passing (>80% coverage)
411
- - [ ] Integration tests written and passing
412
- - [ ] Code follows CLAUDE.md patterns
413
- - [ ] Code reviewed and approved
414
- - [ ] No linting errors
415
- - [ ] No failing tests (full suite)
416
- - [ ] File List complete
417
- - [ ] Change Log updated
418
- - [ ] PR merged to epic branch
419
-
420
- ---
421
-
422
- ## Senior Developer Review (AI)
423
-
424
- <!-- Added after code-review workflow runs -->
425
-
426
- ### Review Date
427
- <!-- Date of review -->
428
-
429
- ### Review Outcome
430
- <!-- Approve | Changes Requested | Blocked -->
431
-
432
- ### Action Items
433
- - [ ] {{action_item_1}}
434
- - [ ] {{action_item_2}}
435
-
436
- ### Review Follow-ups (AI)
437
- <!-- Tasks added based on review findings -->
438
-
439
- ---
440
-
441
175
  ## Jira Metadata
442
176
 
443
177
  ```yaml