@fluentcommerce/ai-skills 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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +622 -0
  3. package/bin/cli.mjs +1973 -0
  4. package/content/cli/agents/fluent-cli/agent.json +149 -0
  5. package/content/cli/agents/fluent-cli.md +132 -0
  6. package/content/cli/skills/fluent-bootstrap/SKILL.md +181 -0
  7. package/content/cli/skills/fluent-cli-index/SKILL.md +63 -0
  8. package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +77 -0
  9. package/content/cli/skills/fluent-cli-reference/SKILL.md +1031 -0
  10. package/content/cli/skills/fluent-cli-retailer/SKILL.md +85 -0
  11. package/content/cli/skills/fluent-cli-settings/SKILL.md +106 -0
  12. package/content/cli/skills/fluent-connect/SKILL.md +886 -0
  13. package/content/cli/skills/fluent-module-deploy/SKILL.md +349 -0
  14. package/content/cli/skills/fluent-profile/SKILL.md +180 -0
  15. package/content/cli/skills/fluent-workflow/SKILL.md +310 -0
  16. package/content/dev/agents/fluent-dev/agent.json +88 -0
  17. package/content/dev/agents/fluent-dev.md +525 -0
  18. package/content/dev/reference-modules/catalog.json +4754 -0
  19. package/content/dev/skills/fluent-build/SKILL.md +192 -0
  20. package/content/dev/skills/fluent-connection-analysis/SKILL.md +386 -0
  21. package/content/dev/skills/fluent-custom-code/SKILL.md +895 -0
  22. package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +714 -0
  23. package/content/dev/skills/fluent-e2e-test/SKILL.md +394 -0
  24. package/content/dev/skills/fluent-event-api/SKILL.md +945 -0
  25. package/content/dev/skills/fluent-feature-explain/SKILL.md +603 -0
  26. package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +695 -0
  27. package/content/dev/skills/fluent-feature-plan/SKILL.md +227 -0
  28. package/content/dev/skills/fluent-job-batch/SKILL.md +138 -0
  29. package/content/dev/skills/fluent-mermaid-validate/SKILL.md +86 -0
  30. package/content/dev/skills/fluent-module-scaffold/SKILL.md +1928 -0
  31. package/content/dev/skills/fluent-module-validate/SKILL.md +775 -0
  32. package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1108 -0
  33. package/content/dev/skills/fluent-retailer-config/SKILL.md +1111 -0
  34. package/content/dev/skills/fluent-rule-scaffold/SKILL.md +385 -0
  35. package/content/dev/skills/fluent-scope-decompose/SKILL.md +1021 -0
  36. package/content/dev/skills/fluent-session-audit-export/SKILL.md +632 -0
  37. package/content/dev/skills/fluent-session-summary/SKILL.md +195 -0
  38. package/content/dev/skills/fluent-settings/SKILL.md +1058 -0
  39. package/content/dev/skills/fluent-source-onboard/SKILL.md +632 -0
  40. package/content/dev/skills/fluent-system-monitoring/SKILL.md +767 -0
  41. package/content/dev/skills/fluent-test-data/SKILL.md +513 -0
  42. package/content/dev/skills/fluent-trace/SKILL.md +1143 -0
  43. package/content/dev/skills/fluent-transition-api/SKILL.md +346 -0
  44. package/content/dev/skills/fluent-version-manage/SKILL.md +744 -0
  45. package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +959 -0
  46. package/content/dev/skills/fluent-workflow-builder/SKILL.md +319 -0
  47. package/content/dev/skills/fluent-workflow-deploy/SKILL.md +267 -0
  48. package/content/mcp-extn/agents/fluent-mcp.md +69 -0
  49. package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +461 -0
  50. package/content/mcp-official/agents/fluent-mcp-core.md +91 -0
  51. package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -0
  52. package/content/rfl/agents/fluent-rfl.md +56 -0
  53. package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -0
  54. package/docs/CAPABILITY_MAP.md +77 -0
  55. package/docs/CLI_COVERAGE.md +47 -0
  56. package/docs/DEV_WORKFLOW.md +802 -0
  57. package/docs/FLOW_RUN.md +142 -0
  58. package/docs/USE_CASES.md +404 -0
  59. package/metadata.json +156 -0
  60. package/package.json +51 -0
@@ -0,0 +1,1021 @@
1
+ ---
2
+ name: fluent-scope-decompose
3
+ description: Decompose a structured scope document into an ordered task list with dependencies, skill mappings, and ambiguity detection. Converts ADD scope packs into executable agent work plans. Triggers on "decompose scope", "plan from scope", "task breakdown", "scope to tasks", "parse scope document".
4
+ user-invocable: true
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
+ argument-hint: <scope-file-path> [--output-format json|markdown] [--validate-only]
7
+ ---
8
+
9
+ # Scope-to-Task Decomposition
10
+
11
+ Parse a structured scope document (Markdown following the ADD template) and produce a JSON task list with dependency ordering, skill mappings, and ambiguity flags. This bridges the gap between human-authored scope and agent-executable work — ADD Phase 2: Agent Planning.
12
+
13
+ ## Ownership Boundary
14
+
15
+ This skill owns scope document parsing, task generation, dependency DAG construction, ambiguity detection, and the output task list artifact.
16
+
17
+ Other skills own:
18
+ - Module scaffolding execution --> `/fluent-module-scaffold`
19
+ - Rule scaffolding execution --> `/fluent-rule-scaffold`
20
+ - Workflow editing --> `/fluent-workflow-builder`
21
+ - Build orchestration --> `/fluent-build`
22
+ - Deployment --> `/fluent-module-deploy`
23
+ - Session orchestration across tasks --> `/fluent-dev` agent
24
+
25
+ This skill produces the plan; other skills execute it.
26
+
27
+ ## When to Use
28
+
29
+ - A structured scope document (ADD template) exists and needs to be converted into an actionable work plan
30
+ - Starting a new module development cycle and need to know what tasks are required
31
+ - Validating a scope document for completeness before agent work begins
32
+ - Generating a traceability matrix from stories to tasks
33
+ - Identifying ambiguities or gaps in a scope document that need human resolution before agents can proceed
34
+
35
+ ## Inputs
36
+
37
+ | Parameter | Required | Default | Description |
38
+ |-----------|----------|---------|-------------|
39
+ | `scope-file-path` | Yes | -- | Path to the scope document (Markdown) |
40
+ | `--output-format` | No | `json` | Output format: `json` (machine-readable) or `markdown` (human-readable) |
41
+ | `--validate-only` | No | `false` | Only validate the scope document structure without generating tasks |
42
+ | `--profile` | No | Active profile | Target Fluent profile for environment-aware decomposition |
43
+
44
+ ## Scope Document Format
45
+
46
+ The skill expects a Markdown document with sections following the ADD template. All section headings are case-insensitive. Sections may appear in any order. The `Module` and `Objective` sections are required; all others are optional but recommended.
47
+
48
+ ```markdown
49
+ # Module
50
+ <module-identifier>
51
+
52
+ ## Objective
53
+ <business context and goal>
54
+
55
+ ## User stories
56
+ - [US-NNN] As a <role>, I can <action>
57
+ - [US-NNN] As a <role>, I can <action>
58
+
59
+ ## Acceptance criteria
60
+ - Given <condition>, when <trigger>, then <outcome>
61
+ - Given <condition>, when <trigger>, then <outcome>
62
+
63
+ ## Non-functional requirements
64
+ - <requirement with measurable threshold>
65
+
66
+ ## Constraints
67
+ - <constraint_keyword>
68
+
69
+ ## Interfaces
70
+ - <system/module name> (<details>)
71
+
72
+ ## Conventions
73
+ - <convention>
74
+
75
+ ## Artifacts requested
76
+ - <artifact-type> (<details>)
77
+
78
+ ## Deployment targets
79
+ - <target-account/retailer>
80
+ - feature flag: <flag.name>
81
+ ```
82
+
83
+ ### Section Extraction Rules
84
+
85
+ Each section maps to specific task properties during decomposition:
86
+
87
+ | Section | Extraction Logic | Maps To |
88
+ |---------|-----------------|---------|
89
+ | `Module` | First non-empty line after heading | `task.module` for all generated tasks; used as directory/file name stem |
90
+ | `Objective` | All text until next heading | `task.context` — injected as business context into every generated task description |
91
+ | `User stories` | Parse lines matching `[US-NNN]` pattern; extract identifier + role + action | Individual task groups — each story generates one or more tasks |
92
+ | `Acceptance criteria` | Parse Given/When/Then triples (single-line or multi-line Gherkin) | `task.acceptanceCriteria[]` on the corresponding TEST tasks |
93
+ | `Non-functional requirements` | Parse as constraint list; extract numeric thresholds where present | Quality gate parameters on BUILD, TEST_E2E, and CHECKLIST tasks |
94
+ | `Constraints` | Keyword extraction (`backward_compatible`, `no_pii_in_logs`, etc.) | `constraints` object — applied as guard rails across all generated tasks |
95
+ | `Interfaces` | System/module names with optional details | Dependency declarations; flag as ambiguity if no skill mapping exists |
96
+ | `Conventions` | Free text conventions | Injected into SCAFFOLD and BUILD task descriptions |
97
+ | `Artifacts requested` | Artifact type keywords (Code, Workflow, Tests, Docs, etc.) | Drive task type assignments — each artifact maps to one or more task types |
98
+ | `Deployment targets` | Account/retailer refs and feature flags | DEPLOY and CONFIG task targets |
99
+
100
+ ### Story Identifier Parsing
101
+
102
+ Story identifiers follow the pattern `[US-NNN]` where NNN is any alphanumeric sequence. The parser:
103
+
104
+ 1. Scans each bullet line under `## User stories` for a `[` prefix
105
+ 2. Extracts the identifier between `[` and `]`
106
+ 3. Extracts the description after the `]` (trimmed)
107
+ 4. Deduplicates by identifier — if the same ID appears twice, flag as ambiguity
108
+
109
+ ### Acceptance Criteria Parsing
110
+
111
+ Acceptance criteria follow Given/When/Then structure. The parser supports:
112
+
113
+ - **Single-line:** `Given X, when Y, then Z`
114
+ - **Multi-line Gherkin:**
115
+ ```
116
+ - Given multiple profile variants and a traffic split
117
+ When requests are routed
118
+ Then variants receive traffic according to the split within +/-1% error
119
+ ```
120
+ - **Free-form:** Lines not matching Given/When/Then are treated as unstructured criteria and attached verbatim
121
+
122
+ Criteria are linked to stories by proximity or explicit `[US-NNN]` references within the criteria text.
123
+
124
+ ## Task List JSON Schema
125
+
126
+ The output is a JSON document containing the full decomposition:
127
+
128
+ ```json
129
+ {
130
+ "schema": "scope-decomposition-v1",
131
+ "scopeDocument": "path/to/scope.md",
132
+ "module": "fcx.sourcing.abtesting",
133
+ "generatedAt": "2026-02-23T10:00:00Z",
134
+ "profile": "HMDEV",
135
+ "tasks": [
136
+ {
137
+ "id": "T-001",
138
+ "type": "SCAFFOLD",
139
+ "title": "Scaffold module fcx.sourcing.abtesting",
140
+ "description": "Create module skeleton with entity types ORDER, FULFILMENT",
141
+ "skill": "fluent-module-scaffold",
142
+ "dependsOn": [],
143
+ "storyRef": null,
144
+ "inputs": {
145
+ "module-name": "sourcing-abtesting",
146
+ "entity-types": ["ORDER"]
147
+ },
148
+ "acceptanceCriteria": [],
149
+ "priority": 1,
150
+ "status": "pending"
151
+ }
152
+ ],
153
+ "ambiguities": [],
154
+ "constraints": {},
155
+ "traceabilityMatrix": {},
156
+ "nfrs": [],
157
+ "deploymentTargets": []
158
+ }
159
+ ```
160
+
161
+ ### Task Fields
162
+
163
+ | Field | Type | Description |
164
+ |-------|------|-------------|
165
+ | `id` | string | Unique identifier, pattern `T-NNN` (zero-padded, assigned in topological order) |
166
+ | `type` | string | One of the task types from the Task Types table below |
167
+ | `title` | string | Human-readable summary of what this task does |
168
+ | `description` | string | Detailed description including business context from Objective |
169
+ | `skill` | string | The exact skill name to invoke for execution (e.g., `fluent-rule-scaffold`) |
170
+ | `dependsOn` | string[] | Array of task IDs that must complete before this task can start |
171
+ | `storyRef` | string or null | The `[US-NNN]` identifier this task traces to, or null for infrastructure tasks |
172
+ | `inputs` | object | Key-value pairs passed to the skill at execution time |
173
+ | `acceptanceCriteria` | string[] | Given/When/Then triples that define done for this task |
174
+ | `priority` | number | Execution order (1 = first); derived from topological sort position |
175
+ | `status` | string | Always `"pending"` at generation time |
176
+
177
+ ## Task Types
178
+
179
+ Every task has a type that determines which skill executes it and what its default dependencies are.
180
+
181
+ | Type | Skill Mapping | Description | Typical Dependencies |
182
+ |------|--------------|-------------|---------------------|
183
+ | `SCAFFOLD` | `fluent-module-scaffold` | Create new module skeleton with Maven structure, module.json, build scripts | None (always first for new modules) |
184
+ | `EXTEND` | `fluent-rule-scaffold` | Add rules/functionality to an existing module whose source is already in `SOURCE/` | SOURCE_ONBOARD (if source was missing) or none (if source already present) |
185
+ | `SOURCE_ONBOARD` | `fluent-custom-code` | Clone repo or obtain source code for an existing deployed module into `accounts/<PROFILE>/SOURCE/` and analyze it | None (always first for extending existing modules) |
186
+ | `RULE` | `fluent-rule-scaffold` | Scaffold a new Rubix rule class with @RuleInfo, parameters, and test skeleton | SCAFFOLD or EXTEND |
187
+ | `WORKFLOW` | `fluent-workflow-builder` | Create or modify workflow JSON — add rulesets, statuses, triggers | RULE (rules must exist before wiring into rulesets) |
188
+ | `SETTING` | `fluent-settings` | Create or update retailer/account settings required by rules | SCAFFOLD or EXTEND |
189
+ | `TEST_UNIT` | `fluent-build` | Write or run unit tests for rule classes | RULE |
190
+ | `TEST_E2E` | `fluent-e2e-test` | Run end-to-end test sequences against deployed workflows | WORKFLOW_DEPLOY, DEPLOY |
191
+ | `BUILD` | `fluent-build` | Compile, package, and produce deployable ZIP artifact | RULE, WORKFLOW (all code changes must be complete) |
192
+ | `DEPLOY` | `fluent-module-deploy` | Deploy module ZIP to target Fluent account/retailer | BUILD, VALIDATE |
193
+ | `WORKFLOW_DEPLOY` | `fluent-workflow` | Upload workflow JSON to target retailer | WORKFLOW |
194
+ | `CONFIG` | `fluent-retailer-config` | Configure retailer-level settings, feature flags, and sample data | DEPLOY (retailer must have module installed) |
195
+ | `VALIDATE` | `fluent-module-validate` | Run structural validation on the module before deployment | BUILD |
196
+ | `ANALYZE` | `fluent-connection-analysis` | Analyze workflow connection topology and cross-entity event flows | WORKFLOW_DEPLOY |
197
+ | `DOC` | Manual / agent | Generate README, Confluence pages, or other documentation | BUILD |
198
+ | `VERSION` | `fluent-version-manage` | Bump semver version, update CHANGELOG, sync all version files | BUILD passes |
199
+ | `CHECKLIST` | `fluent-pre-deploy-check` | Run full pre-deployment checklist across all gates | All prior tasks |
200
+
201
+ ## Dependency Resolution Algorithm
202
+
203
+ The skill constructs a directed acyclic graph (DAG) of task dependencies and produces a topologically sorted execution order.
204
+
205
+ ### Step 1: Environment-Aware Module Decision
206
+
207
+ **Before generating any tasks, determine whether this is a new module or an extension of an existing one.**
208
+
209
+ ```
210
+ 1. Extract module name from scope document's ## Module section
211
+
212
+ 2. Search local workspace for existing source:
213
+ Glob: accounts/<PROFILE>/SOURCE/*/resources/module.json
214
+ Parse each module.json → build list of local modules with their rule names
215
+
216
+ 3. Query deployed modules in live environment:
217
+ MCP tool: plugin.list (compact: true)
218
+ Parse rule keys → extract module names (group by ACCOUNT prefix)
219
+
220
+ 4. Decision tree:
221
+ ├── Module source found in accounts/<PROFILE>/SOURCE/?
222
+ │ └── YES → EXTEND path
223
+ │ - Generate EXTEND task (not SCAFFOLD)
224
+ │ - RULE tasks depend on EXTEND
225
+ │ - inputs.existingModulePath = path to source directory
226
+
227
+ ├── Module deployed (rules in plugin.list) but NO source in SOURCE/?
228
+ │ └── SOURCE_ONBOARD path
229
+ │ - Generate SOURCE_ONBOARD task first (clone repo / obtain source)
230
+ │ - Generate EXTEND task (depends on SOURCE_ONBOARD)
231
+ │ - RULE tasks depend on EXTEND
232
+ │ - Flag ambiguity if repo URL is unknown
233
+
234
+ └── Module NOT found anywhere?
235
+ └── SCAFFOLD path (new module)
236
+ - Generate SCAFFOLD task
237
+ - RULE tasks depend on SCAFFOLD
238
+ ```
239
+
240
+ ### Step 2: Generate Tasks from Scope Sections
241
+
242
+ ```
243
+ For each section in the scope document:
244
+ Module -> generate 1 SCAFFOLD, EXTEND, or SOURCE_ONBOARD+EXTEND task (per Step 1 decision)
245
+ User stories -> for each story, generate RULE and/or WORKFLOW tasks based on story content
246
+ Acceptance criteria -> generate TEST_UNIT and TEST_E2E tasks
247
+ Artifacts requested -> generate task types matching the artifact keyword:
248
+ "Code" -> RULE (if not already generated from stories)
249
+ "Workflow" -> WORKFLOW
250
+ "Tests" -> TEST_UNIT + TEST_E2E
251
+ "Docs" -> DOC
252
+ "Settings" -> SETTING
253
+ "OMX Components" -> flag as ambiguity (no skill mapping)
254
+ Deployment targets -> generate DEPLOY, WORKFLOW_DEPLOY, CONFIG tasks
255
+ Always generate: BUILD, VALIDATE, VERSION, CHECKLIST (infrastructure tasks)
256
+ ```
257
+
258
+ ### Step 3: Build Dependency Edges
259
+
260
+ Apply these rules to construct edges in the DAG:
261
+
262
+ ```
263
+ SCAFFOLD -> no dependencies (new module path)
264
+ SOURCE_ONBOARD -> no dependencies (extend-without-source path)
265
+ EXTEND -> depends on SOURCE_ONBOARD if source was missing; else no dependencies
266
+ RULE -> depends on SCAFFOLD (new) or EXTEND (existing)
267
+ WORKFLOW -> depends on all RULE tasks that the workflow references
268
+ SETTING -> depends on SCAFFOLD or EXTEND
269
+ TEST_UNIT -> depends on the RULE task it tests
270
+ BUILD -> depends on all RULE + WORKFLOW + SETTING tasks
271
+ VALIDATE -> depends on BUILD
272
+ DEPLOY -> depends on BUILD + VALIDATE
273
+ WORKFLOW_DEPLOY -> depends on all WORKFLOW tasks
274
+ TEST_E2E -> depends on DEPLOY + WORKFLOW_DEPLOY
275
+ CONFIG -> depends on DEPLOY
276
+ DOC -> depends on BUILD
277
+ VERSION -> depends on BUILD (build must pass before version bump)
278
+ CHECKLIST -> depends on all other tasks (always last)
279
+ ```
280
+
281
+ ### Step 4: Cycle Detection
282
+
283
+ Run a depth-first search on the DAG. If a back edge is found, report the cycle and abort with an error:
284
+
285
+ ```
286
+ ERROR: Circular dependency detected: T-003 -> T-005 -> T-008 -> T-003
287
+ Resolve the cycle in the scope document before decomposition can proceed.
288
+ ```
289
+
290
+ ### Step 5: Topological Sort
291
+
292
+ Perform Kahn's algorithm (BFS-based topological sort) on the validated DAG:
293
+
294
+ ```
295
+ 1. Compute in-degree for each task node
296
+ 2. Enqueue all nodes with in-degree 0
297
+ 3. While queue is not empty:
298
+ a. Dequeue node, assign next priority number
299
+ b. For each outgoing edge, decrement target in-degree
300
+ c. If target in-degree reaches 0, enqueue it
301
+ 4. If processed count < total tasks -> cycle exists (caught in Step 3)
302
+ ```
303
+
304
+ The priority field on each task reflects its position in the topological order.
305
+
306
+ ## Ambiguity Detection
307
+
308
+ The skill flags ambiguities that require human resolution before agents can execute the task list.
309
+
310
+ | Condition | Severity | Detection Rule | Example |
311
+ |-----------|----------|---------------|---------|
312
+ | Interface has no skill mapping | HIGH | Interface name does not match any known skill or MCP tool | "Fluent Analytics (Google Looker)" -- no skill covers Looker dashboard creation |
313
+ | Acceptance criteria references unmeasurable metric | MEDIUM | Criteria contains percentage, statistical term, or threshold that cannot be verified by existing test tools | "within +/-1% error over sufficient volume" -- needs statistical validation |
314
+ | User story lacks acceptance criteria | HIGH | Story ID from `## User stories` has no matching criteria in `## Acceptance criteria` | Story [US-203] exists but no Given/When/Then references it |
315
+ | Artifact type has no skill mapping | MEDIUM | Artifact keyword does not match any known task type | "OMX Components" -- no skill covers OMX creation |
316
+ | Constraint keyword is unknown | LOW | Keyword not in known set: `backward_compatible`, `no_pii_in_logs`, `no_breaking_changes`, `idempotent`, `audit_trail` | "gdpr_compliant" -- recognized but no automated enforcement |
317
+ | Non-functional requirement lacks threshold | MEDIUM | NFR line has no numeric value or measurable bound | "high availability" without an SLA percentage |
318
+ | Duplicate story identifiers | HIGH | Two or more stories share the same `[US-NNN]` identifier | `[US-201]` appears twice with different descriptions |
319
+ | Deployment target unresolvable | MEDIUM | Target does not match known profile/retailer pattern | "fluent:account/retailer-demo" when no matching profile exists |
320
+
321
+ ### Ambiguity Output Format
322
+
323
+ ```json
324
+ {
325
+ "section": "Interfaces",
326
+ "item": "Fluent Analytics (Google Looker)",
327
+ "issue": "No skill or MCP tool covers Looker dashboard creation. Requires manual implementation or external tooling.",
328
+ "severity": "HIGH"
329
+ }
330
+ ```
331
+
332
+ ## Traceability Matrix
333
+
334
+ The skill produces a mapping from every user story to the tasks generated from it, enabling end-to-end traceability from requirement to implementation:
335
+
336
+ ```json
337
+ {
338
+ "US-201": ["T-002", "T-003", "T-007", "T-012"],
339
+ "US-202": ["T-004", "T-005", "T-008"],
340
+ "US-203": ["T-006", "T-009"]
341
+ }
342
+ ```
343
+
344
+ **Coverage validation:** After building the matrix, check that:
345
+ 1. Every story has at least one task -> if not, flag as ambiguity (story with no work)
346
+ 2. Every task with a `storyRef` maps back to a valid story -> if not, flag as orphaned task
347
+ 3. Every story has at least one TEST task -> if not, flag as untested story (severity: HIGH)
348
+
349
+ ## Execution Flow
350
+
351
+ ```
352
+ 1. READ scope document from file path
353
+ - Validate file exists and is readable
354
+ - Parse as Markdown (split by heading levels)
355
+
356
+ 2. VALIDATE structure:
357
+ a. Check required sections present (Module, Objective)
358
+ b. Check recommended sections present (User stories, Acceptance criteria, Artifacts)
359
+ c. Parse user story identifiers [US-NNN] — validate uniqueness
360
+ d. Parse acceptance criteria — extract Given/When/Then triples
361
+ e. Parse constraints — extract known keywords
362
+ f. If --validate-only:
363
+ - Report section presence/absence table
364
+ - Report parsed story count, criteria count, constraint count
365
+ - Report any structural issues found
366
+ - STOP (do not generate tasks)
367
+
368
+ 3. DECOMPOSE into tasks:
369
+ a. Run environment-aware module decision (see Dependency Resolution Step 1):
370
+ - Search accounts/<PROFILE>/SOURCE/ for existing module source
371
+ - Query plugin.list for deployed custom rules
372
+ - Decision: SCAFFOLD (new) / EXTEND (source available) / SOURCE_ONBOARD+EXTEND (deployed but no source)
373
+ - Extract module name, derive entity types from stories/interfaces
374
+ b. For each user story, generate RULE and/or WORKFLOW tasks
375
+ - Analyze story text for rule-like behavior ("route", "allocate", "validate")
376
+ - Analyze story text for workflow-like behavior ("status", "transition", "flow")
377
+ c. For each acceptance criterion, generate TEST tasks
378
+ - Unit test tasks for rule-level criteria
379
+ - E2E test tasks for workflow-level criteria
380
+ d. For each artifact requested, generate corresponding task type
381
+ - Map artifact keywords to task types (see Task Types table)
382
+ e. Generate infrastructure tasks: BUILD, VALIDATE, DEPLOY, VERSION, CHECKLIST
383
+ f. Generate SETTING tasks for any rule that references settings
384
+ g. Generate CONFIG tasks for deployment targets with feature flags
385
+
386
+ 4. RESOLVE dependencies:
387
+ a. Build adjacency list from dependency rules
388
+ b. Run cycle detection (DFS)
389
+ c. Run topological sort (Kahn's algorithm)
390
+ d. Assign priority numbers from sort order
391
+
392
+ 5. DETECT ambiguities:
393
+ a. Check all interfaces against known skill mappings
394
+ b. Check all acceptance criteria for measurability
395
+ c. Check all stories for criteria coverage
396
+ d. Check all artifact types for skill mappings
397
+ e. Check all constraints for known keywords
398
+ f. Check all NFRs for numeric thresholds
399
+ g. Check deployment targets for resolvability
400
+
401
+ 6. BUILD traceability matrix:
402
+ a. Map each story ID to its generated task IDs
403
+ b. Validate coverage (every story has tasks, every story has tests)
404
+
405
+ 7. WRITE output:
406
+ a. JSON task list to:
407
+ accounts/<PROFILE>/analysis/scope-decomposition/<module>.tasks.json
408
+ b. If --output-format markdown, also write human-readable table to:
409
+ accounts/<PROFILE>/analysis/scope-decomposition/<module>.tasks.md
410
+
411
+ 8. REPORT summary:
412
+ - Total tasks generated (by type)
413
+ - Ambiguities found (by severity)
414
+ - Coverage: stories with tasks, stories with tests
415
+ - Dependency chain depth (longest path in DAG)
416
+ - Output file paths
417
+ ```
418
+
419
+ ## Output Paths
420
+
421
+ Task list artifacts are written to the analysis directory scoped by profile:
422
+
423
+ ```
424
+ accounts/<PROFILE>/analysis/scope-decomposition/
425
+ <module>.tasks.json <- Machine-readable task list (primary output)
426
+ <module>.tasks.md <- Human-readable table (when --output-format markdown)
427
+ ```
428
+
429
+ The `<module>` stem is derived from the scope document's `# Module` section with dots replaced by dashes and lowercased (e.g., `fcx.sourcing.abtesting` becomes `fcx-sourcing-abtesting`).
430
+
431
+ ## Integration with fluent-dev Agent
432
+
433
+ The task list produced by this skill is consumed by the `/fluent-dev` orchestration agent:
434
+
435
+ 1. `/fluent-dev` reads `<module>.tasks.json` from the analysis directory
436
+ 2. For each task in priority order:
437
+ a. Check `dependsOn` — all dependencies must have `status: "completed"`
438
+ b. Invoke the skill named in `task.skill` with `task.inputs` as arguments
439
+ c. On success: update `task.status` to `"completed"`
440
+ d. On failure: update `task.status` to `"failed"`, log error, assess whether to continue or abort
441
+ 3. After all tasks complete, update the traceability matrix with completion status
442
+ 4. If any ambiguities have severity HIGH, pause and request human resolution before proceeding past the affected tasks
443
+
444
+ The task list is a living document — `/fluent-dev` updates it in-place as work progresses.
445
+
446
+ ## Edge Cases
447
+
448
+ ### Module Already Exists
449
+
450
+ If the environment-aware check (Step 1) finds the module already deployed or has local source:
451
+
452
+ | State | First Task(s) | Subsequent RULE depends on |
453
+ |-------|--------------|---------------------------|
454
+ | Source in `SOURCE/` with `module.json` | `EXTEND` (no dependencies) | `EXTEND` |
455
+ | Deployed but no source in `SOURCE/` | `SOURCE_ONBOARD` → `EXTEND` | `EXTEND` |
456
+ | Not found anywhere | `SCAFFOLD` (classic new module) | `SCAFFOLD` |
457
+ | Source exists but repo URL unknown | `SOURCE_ONBOARD` with ambiguity flag | `EXTEND` |
458
+
459
+ **When extending:** The EXTEND task's `inputs.existing-module-path` tells downstream skills where to find the existing POM, `module.json`, and package structure. The `/fluent-rule-scaffold` skill uses this to wire new rules into the correct package and registration.
460
+
461
+ ### Missing Sections
462
+
463
+ If optional sections are missing, the skill generates a minimal task list:
464
+
465
+ | Missing Section | Behavior |
466
+ |----------------|----------|
467
+ | `User stories` | Generate only SCAFFOLD/EXTEND + BUILD + VALIDATE tasks; flag as ambiguity: "No user stories — task list is infrastructure-only" |
468
+ | `Acceptance criteria` | Generate all tasks but no TEST tasks; flag each story as untested (HIGH severity) |
469
+ | `Artifacts requested` | Infer artifact types from user stories (Code implies RULE, Workflow implies WORKFLOW) |
470
+ | `Deployment targets` | Skip DEPLOY, WORKFLOW_DEPLOY, CONFIG, CHECKLIST tasks; flag as ambiguity |
471
+ | `Constraints` | Empty constraints object; no guard rails applied |
472
+ | `Interfaces` | No interface-related ambiguity checks |
473
+ | `Non-functional requirements` | No NFR-related ambiguity checks |
474
+
475
+ ### Duplicate Story IDs
476
+
477
+ If two stories share the same `[US-NNN]` identifier:
478
+
479
+ 1. Flag as HIGH severity ambiguity
480
+ 2. Keep the first occurrence and rename the second to `[US-NNN-DUP]`
481
+ 3. Generate tasks for both but mark the duplicate's tasks with a warning
482
+
483
+ ### Circular Dependencies
484
+
485
+ If the dependency resolution algorithm detects a cycle:
486
+
487
+ 1. Report the cycle path: `T-003 -> T-005 -> T-008 -> T-003`
488
+ 2. Identify the likely cause (usually a WORKFLOW depending on a TEST that depends on the WORKFLOW)
489
+ 3. Suggest resolution: break the cycle by removing the weakest dependency edge
490
+ 4. Abort task list generation — a valid DAG is required
491
+
492
+ ### Unknown Artifact Types
493
+
494
+ If an artifact type in `## Artifacts requested` does not match any known mapping:
495
+
496
+ 1. Flag as MEDIUM severity ambiguity
497
+ 2. Generate a DOC-type task as a placeholder with the description: "Manual: create <artifact-type>"
498
+ 3. The placeholder task has no skill mapping (`skill: null`)
499
+
500
+ ### Empty Scope Document
501
+
502
+ If the file is empty or contains only headings with no content:
503
+
504
+ 1. Return a validation error: "Scope document is empty or contains no actionable content"
505
+ 2. List which sections were found (headings only) vs which had content
506
+ 3. Do not generate any tasks
507
+
508
+ ## Example
509
+
510
+ ### Input: Scope Document
511
+
512
+ ```markdown
513
+ # Module
514
+ fcx.sourcing.abtesting
515
+
516
+ ## Objective
517
+ Extend sourcing profiles to support A/B testing so we can compare profile
518
+ variants on conversion, latency, and cost in demo scenarios.
519
+
520
+ ## User stories
521
+ - [US-201] As a merchandiser, I can define two or more sourcing profile
522
+ variants (A/B/...) for an experiment.
523
+ - [US-202] As a merchandiser, I can allocate traffic splits (e.g., 50/50,
524
+ 10/90) across variants.
525
+ - [US-203] As an analyst, I can view experiment results with metrics per
526
+ variant in Fluent Analytics.
527
+
528
+ ## Acceptance criteria
529
+ - Given multiple profile variants and a traffic split, when requests are
530
+ routed, then variants receive traffic according to the split within
531
+ +/-1% error over sufficient volume.
532
+ - Given an active experiment, when a variant underperforms thresholds,
533
+ then the system can pause/adjust the split via config without redeploy.
534
+ - Given experiment data, when results are requested, then metrics
535
+ (conversion, p95 latency, cost per order) are reported per variant.
536
+
537
+ ## Non-functional requirements
538
+ - p95 latency: +<5 ms overhead from routing logic.
539
+ - Availability: 99.9%.
540
+ - Auditability: experiment definitions and changes are versioned.
541
+
542
+ ## Constraints
543
+ - backward_compatible
544
+ - no_pii_in_logs
545
+
546
+ ## Interfaces
547
+ - Fluent AI Skills (Fluent CLI, Fluent MCP)
548
+ - Fluent Analytics (Google Looker)
549
+
550
+ ## Conventions
551
+ - Testing: unit (routing), contract (Profile APIs), smoke (experiment
552
+ start/stop), golden (metrics aggregation).
553
+ - Versioning: semver
554
+
555
+ ## Artifacts requested
556
+ - Code (new or updated orchestration rules)
557
+ - Orchestration Workflow (updated orchestration workflow)
558
+ - Tests (unit / orchestration / end to end)
559
+ - Docs (README, Confluence)
560
+
561
+ ## Deployment targets
562
+ - fluent:account/retailer-demo
563
+ - feature flag: sourcing.abtest.enabled
564
+ ```
565
+
566
+ ### Output: Task List (JSON)
567
+
568
+ ```json
569
+ {
570
+ "schema": "scope-decomposition-v1",
571
+ "scopeDocument": "scope/sourcing-abtesting.md",
572
+ "module": "fcx.sourcing.abtesting",
573
+ "generatedAt": "2026-02-23T10:00:00Z",
574
+ "profile": "HMDEV",
575
+ "tasks": [
576
+ {
577
+ "id": "T-001",
578
+ "type": "SCAFFOLD",
579
+ "title": "Scaffold module fcx.sourcing.abtesting",
580
+ "description": "Create module skeleton for sourcing A/B testing. Entity type: ORDER. Includes Maven structure, module.json, build scripts, and test harness.",
581
+ "skill": "fluent-module-scaffold",
582
+ "dependsOn": [],
583
+ "storyRef": null,
584
+ "inputs": {
585
+ "module-name": "sourcing-abtesting",
586
+ "entity-types": ["ORDER"],
587
+ "rules": ["ExperimentVariantRouter", "TrafficSplitAllocator", "ExperimentConfigReader"]
588
+ },
589
+ "acceptanceCriteria": [],
590
+ "priority": 1,
591
+ "status": "pending"
592
+ },
593
+ {
594
+ "id": "T-002",
595
+ "type": "RULE",
596
+ "title": "Implement experiment variant definition rule",
597
+ "description": "Rule to allow defining two or more sourcing profile variants (A/B/...) for an experiment. Reads experiment config from settings, registers variants on the entity.",
598
+ "skill": "fluent-rule-scaffold",
599
+ "dependsOn": ["T-001"],
600
+ "storyRef": "US-201",
601
+ "inputs": {
602
+ "rule-name": "ExperimentVariantRouter",
603
+ "entity-type": "ORDER"
604
+ },
605
+ "acceptanceCriteria": [],
606
+ "priority": 2,
607
+ "status": "pending"
608
+ },
609
+ {
610
+ "id": "T-003",
611
+ "type": "RULE",
612
+ "title": "Implement traffic split allocation rule",
613
+ "description": "Rule to allocate traffic across sourcing profile variants based on configured percentage splits (e.g., 50/50, 10/90).",
614
+ "skill": "fluent-rule-scaffold",
615
+ "dependsOn": ["T-001"],
616
+ "storyRef": "US-202",
617
+ "inputs": {
618
+ "rule-name": "TrafficSplitAllocator",
619
+ "entity-type": "ORDER"
620
+ },
621
+ "acceptanceCriteria": [
622
+ "Given multiple profile variants and a traffic split, when requests are routed, then variants receive traffic according to the split within +/-1% error over sufficient volume."
623
+ ],
624
+ "priority": 3,
625
+ "status": "pending"
626
+ },
627
+ {
628
+ "id": "T-004",
629
+ "type": "RULE",
630
+ "title": "Implement experiment config reader rule",
631
+ "description": "Rule to read experiment configuration (variant definitions, split ratios, pause/adjust state) from retailer settings without requiring redeploy.",
632
+ "skill": "fluent-rule-scaffold",
633
+ "dependsOn": ["T-001"],
634
+ "storyRef": "US-202",
635
+ "inputs": {
636
+ "rule-name": "ExperimentConfigReader",
637
+ "entity-type": "ORDER"
638
+ },
639
+ "acceptanceCriteria": [
640
+ "Given an active experiment, when a variant underperforms thresholds, then the system can pause/adjust the split via config without redeploy."
641
+ ],
642
+ "priority": 4,
643
+ "status": "pending"
644
+ },
645
+ {
646
+ "id": "T-005",
647
+ "type": "SETTING",
648
+ "title": "Create experiment configuration settings",
649
+ "description": "Create retailer-scoped settings for experiment definitions, variant splits, and threshold configuration. Settings must be updatable without module redeploy.",
650
+ "skill": "fluent-settings",
651
+ "dependsOn": ["T-001"],
652
+ "storyRef": "US-202",
653
+ "inputs": {
654
+ "settings": [
655
+ { "name": "sourcing.experiment.config", "context": "RETAILER" },
656
+ { "name": "sourcing.experiment.thresholds", "context": "RETAILER" }
657
+ ]
658
+ },
659
+ "acceptanceCriteria": [],
660
+ "priority": 5,
661
+ "status": "pending"
662
+ },
663
+ {
664
+ "id": "T-006",
665
+ "type": "WORKFLOW",
666
+ "title": "Add A/B test rulesets to ORDER sourcing workflow",
667
+ "description": "Extend the ORDER workflow with rulesets for experiment routing: insert ExperimentVariantRouter and TrafficSplitAllocator into the sourcing event chain. Add statuses if needed for experiment branching.",
668
+ "skill": "fluent-workflow-builder",
669
+ "dependsOn": ["T-002", "T-003", "T-004"],
670
+ "storyRef": "US-201",
671
+ "inputs": {
672
+ "workflow-type": "ORDER",
673
+ "rulesets-to-add": ["ExperimentRouting"]
674
+ },
675
+ "acceptanceCriteria": [],
676
+ "priority": 6,
677
+ "status": "pending"
678
+ },
679
+ {
680
+ "id": "T-007",
681
+ "type": "TEST_UNIT",
682
+ "title": "Write unit tests for routing and split rules",
683
+ "description": "Unit tests for ExperimentVariantRouter, TrafficSplitAllocator, and ExperimentConfigReader. Cover: correct split distribution, config read/parse, edge cases (0% split, 100% split, missing config).",
684
+ "skill": "fluent-build",
685
+ "dependsOn": ["T-002", "T-003", "T-004"],
686
+ "storyRef": "US-201",
687
+ "inputs": {},
688
+ "acceptanceCriteria": [
689
+ "Given multiple profile variants and a traffic split, when requests are routed, then variants receive traffic according to the split within +/-1% error over sufficient volume."
690
+ ],
691
+ "priority": 7,
692
+ "status": "pending"
693
+ },
694
+ {
695
+ "id": "T-008",
696
+ "type": "BUILD",
697
+ "title": "Build module fcx.sourcing.abtesting",
698
+ "description": "Compile all rule classes, run unit tests, and package into deployable ZIP artifact.",
699
+ "skill": "fluent-build",
700
+ "dependsOn": ["T-002", "T-003", "T-004", "T-005", "T-006", "T-007"],
701
+ "storyRef": null,
702
+ "inputs": {},
703
+ "acceptanceCriteria": [],
704
+ "priority": 8,
705
+ "status": "pending"
706
+ },
707
+ {
708
+ "id": "T-009",
709
+ "type": "VALIDATE",
710
+ "title": "Validate module structure",
711
+ "description": "Run /fluent-module-validate to confirm module.json, Maven structure, rule wiring, test coverage, and version consistency.",
712
+ "skill": "fluent-module-validate",
713
+ "dependsOn": ["T-008"],
714
+ "storyRef": null,
715
+ "inputs": {},
716
+ "acceptanceCriteria": [],
717
+ "priority": 9,
718
+ "status": "pending"
719
+ },
720
+ {
721
+ "id": "T-010",
722
+ "type": "VERSION",
723
+ "title": "Bump version to 1.0.0",
724
+ "description": "Set initial release version across module.json, all POMs, and CHANGELOG.md. Tag as v1.0.0.",
725
+ "skill": "fluent-version-manage",
726
+ "dependsOn": ["T-008"],
727
+ "storyRef": null,
728
+ "inputs": {
729
+ "command": "bump",
730
+ "level": "minor"
731
+ },
732
+ "acceptanceCriteria": [],
733
+ "priority": 10,
734
+ "status": "pending"
735
+ },
736
+ {
737
+ "id": "T-011",
738
+ "type": "DEPLOY",
739
+ "title": "Deploy module to retailer-demo",
740
+ "description": "Deploy fc-module-sourcing-abtesting ZIP to fluent:account/retailer-demo.",
741
+ "skill": "fluent-module-deploy",
742
+ "dependsOn": ["T-008", "T-009"],
743
+ "storyRef": null,
744
+ "inputs": {
745
+ "target": "fluent:account/retailer-demo"
746
+ },
747
+ "acceptanceCriteria": [],
748
+ "priority": 11,
749
+ "status": "pending"
750
+ },
751
+ {
752
+ "id": "T-012",
753
+ "type": "WORKFLOW_DEPLOY",
754
+ "title": "Deploy updated ORDER workflow",
755
+ "description": "Upload the modified ORDER workflow with A/B test rulesets to the target retailer.",
756
+ "skill": "fluent-workflow",
757
+ "dependsOn": ["T-006"],
758
+ "storyRef": null,
759
+ "inputs": {},
760
+ "acceptanceCriteria": [],
761
+ "priority": 12,
762
+ "status": "pending"
763
+ },
764
+ {
765
+ "id": "T-013",
766
+ "type": "CONFIG",
767
+ "title": "Configure feature flag and experiment settings",
768
+ "description": "Enable feature flag sourcing.abtest.enabled on target retailer. Populate initial experiment configuration settings.",
769
+ "skill": "fluent-retailer-config",
770
+ "dependsOn": ["T-011"],
771
+ "storyRef": null,
772
+ "inputs": {
773
+ "feature-flag": "sourcing.abtest.enabled"
774
+ },
775
+ "acceptanceCriteria": [],
776
+ "priority": 13,
777
+ "status": "pending"
778
+ },
779
+ {
780
+ "id": "T-014",
781
+ "type": "TEST_E2E",
782
+ "title": "Run end-to-end experiment routing test",
783
+ "description": "Create orders against the deployed workflow and verify traffic is split across variants. Confirm experiment config changes take effect without redeploy.",
784
+ "skill": "fluent-e2e-test",
785
+ "dependsOn": ["T-011", "T-012", "T-013"],
786
+ "storyRef": "US-201",
787
+ "inputs": {},
788
+ "acceptanceCriteria": [
789
+ "Given multiple profile variants and a traffic split, when requests are routed, then variants receive traffic according to the split within +/-1% error over sufficient volume.",
790
+ "Given an active experiment, when a variant underperforms thresholds, then the system can pause/adjust the split via config without redeploy."
791
+ ],
792
+ "priority": 14,
793
+ "status": "pending"
794
+ },
795
+ {
796
+ "id": "T-015",
797
+ "type": "DOC",
798
+ "title": "Generate module documentation",
799
+ "description": "Create README.md with module overview, rule descriptions, configuration guide, and deployment instructions.",
800
+ "skill": null,
801
+ "dependsOn": ["T-008"],
802
+ "storyRef": null,
803
+ "inputs": {},
804
+ "acceptanceCriteria": [],
805
+ "priority": 15,
806
+ "status": "pending"
807
+ },
808
+ {
809
+ "id": "T-016",
810
+ "type": "CHECKLIST",
811
+ "title": "Run pre-deployment checklist",
812
+ "description": "Execute full pre-deploy validation: environment readiness, module integrity, workflow validity, settings completeness, and risk assessment.",
813
+ "skill": "fluent-pre-deploy-check",
814
+ "dependsOn": ["T-008", "T-009", "T-010", "T-011", "T-012", "T-013", "T-014", "T-015"],
815
+ "storyRef": null,
816
+ "inputs": {},
817
+ "acceptanceCriteria": [],
818
+ "priority": 16,
819
+ "status": "pending"
820
+ }
821
+ ],
822
+ "ambiguities": [
823
+ {
824
+ "section": "Interfaces",
825
+ "item": "Fluent Analytics (Google Looker)",
826
+ "issue": "No skill or MCP tool covers Looker dashboard creation. Story US-203 requires metrics visualization in Fluent Analytics, which is outside agent tooling scope. Requires manual implementation or external tooling.",
827
+ "severity": "HIGH"
828
+ },
829
+ {
830
+ "section": "Acceptance criteria",
831
+ "item": "within +/-1% error over sufficient volume",
832
+ "issue": "Statistical validation of traffic distribution requires volume thresholds and statistical testing that existing E2E test tools cannot automate. Manual verification or custom test harness needed.",
833
+ "severity": "MEDIUM"
834
+ },
835
+ {
836
+ "section": "User stories",
837
+ "item": "[US-203] view experiment results with metrics per variant",
838
+ "issue": "Story requires Fluent Analytics dashboard work. No tasks generated for Looker integration — only data-side tasks can be automated.",
839
+ "severity": "HIGH"
840
+ }
841
+ ],
842
+ "constraints": {
843
+ "backward_compatible": true,
844
+ "no_pii_in_logs": true
845
+ },
846
+ "traceabilityMatrix": {
847
+ "US-201": ["T-002", "T-006", "T-007", "T-014"],
848
+ "US-202": ["T-003", "T-004", "T-005", "T-014"],
849
+ "US-203": []
850
+ },
851
+ "nfrs": [
852
+ { "requirement": "p95 latency: +<5 ms overhead from routing logic", "threshold": "5ms", "appliesTo": ["T-002", "T-003"] },
853
+ { "requirement": "Availability: 99.9%", "threshold": "99.9%", "appliesTo": ["T-014"] },
854
+ { "requirement": "Auditability: experiment definitions and changes are versioned", "threshold": null, "appliesTo": ["T-004", "T-005"] }
855
+ ],
856
+ "deploymentTargets": [
857
+ { "target": "fluent:account/retailer-demo", "featureFlag": "sourcing.abtest.enabled" }
858
+ ]
859
+ }
860
+ ```
861
+
862
+ ### Variation: EXTEND Path (Existing Module)
863
+
864
+ If the scope document's module matches an existing deployed module with source in `SOURCE/`, the first task changes from SCAFFOLD to EXTEND:
865
+
866
+ ```json
867
+ {
868
+ "id": "T-001",
869
+ "type": "EXTEND",
870
+ "title": "Extend existing module hm-extensions with A/B testing rules",
871
+ "description": "Module hm-extensions already exists in accounts/HMDEV/SOURCE/fluentcommerce-fc-module-hm-extensions/. Add new rules for A/B testing. Source analyzed — existing rules: SendWebhook, ValidateOrder, ...",
872
+ "skill": "fluent-rule-scaffold",
873
+ "dependsOn": [],
874
+ "storyRef": null,
875
+ "inputs": {
876
+ "existing-module-path": "accounts/HMDEV/SOURCE/fluentcommerce-fc-module-hm-extensions/",
877
+ "entity-types": ["ORDER"],
878
+ "rules": ["ExperimentVariantRouter", "TrafficSplitAllocator", "ExperimentConfigReader"]
879
+ },
880
+ "acceptanceCriteria": [],
881
+ "priority": 1,
882
+ "status": "pending"
883
+ }
884
+ ```
885
+
886
+ If the module is deployed but source is **not** in `SOURCE/`, a SOURCE_ONBOARD task precedes EXTEND:
887
+
888
+ ```json
889
+ {
890
+ "id": "T-001",
891
+ "type": "SOURCE_ONBOARD",
892
+ "title": "Obtain source code for module hm-extensions",
893
+ "description": "Module hm-extensions is deployed (rules found via plugin.list) but no source in accounts/HMDEV/SOURCE/. Clone the repository or decompile the deployed JAR to obtain source before extending.",
894
+ "skill": "fluent-custom-code",
895
+ "dependsOn": [],
896
+ "storyRef": null,
897
+ "inputs": {
898
+ "module-name": "hm-extensions",
899
+ "profile": "HMDEV"
900
+ },
901
+ "acceptanceCriteria": [],
902
+ "priority": 1,
903
+ "status": "pending"
904
+ },
905
+ {
906
+ "id": "T-002",
907
+ "type": "EXTEND",
908
+ "title": "Extend module hm-extensions with A/B testing rules",
909
+ "description": "Add new rules to hm-extensions after source onboarding completes.",
910
+ "skill": "fluent-rule-scaffold",
911
+ "dependsOn": ["T-001"],
912
+ "storyRef": null,
913
+ "inputs": {
914
+ "entity-types": ["ORDER"],
915
+ "rules": ["ExperimentVariantRouter", "TrafficSplitAllocator"]
916
+ },
917
+ "acceptanceCriteria": [],
918
+ "priority": 2,
919
+ "status": "pending"
920
+ }
921
+ ```
922
+
923
+ **Key difference:** When extending, all RULE tasks depend on EXTEND (not SCAFFOLD), and the EXTEND task's inputs include the existing module path so the rule scaffolder knows where to add files.
924
+
925
+ ### Output: Traceability Gaps
926
+
927
+ From the example above, `US-203` has an empty task array in the traceability matrix. The skill reports this prominently:
928
+
929
+ ```
930
+ TRACEABILITY GAPS
931
+ [HIGH] US-203 "view experiment results with metrics per variant"
932
+ -> 0 tasks generated (Fluent Analytics integration outside agent scope)
933
+ -> Recommend: assign to human for manual Looker dashboard creation
934
+ ```
935
+
936
+ ## Console Output Format
937
+
938
+ After generating the task list, print a human-readable summary:
939
+
940
+ ```
941
+ === Scope Decomposition: fcx.sourcing.abtesting ===
942
+
943
+ Source: scope/sourcing-abtesting.md
944
+ Module: fcx.sourcing.abtesting
945
+ Profile: HMDEV
946
+
947
+ Tasks Generated: 16
948
+ SCAFFOLD: 1
949
+ RULE: 3
950
+ WORKFLOW: 1
951
+ SETTING: 1
952
+ TEST_UNIT: 1
953
+ BUILD: 1
954
+ VALIDATE: 1
955
+ VERSION: 1
956
+ DEPLOY: 1
957
+ WORKFLOW_DEPLOY: 1
958
+ CONFIG: 1
959
+ TEST_E2E: 1
960
+ DOC: 1
961
+ CHECKLIST: 1
962
+
963
+ Dependency Chain Depth: 5 (SCAFFOLD -> RULE -> WORKFLOW -> BUILD -> DEPLOY -> TEST_E2E)
964
+
965
+ Ambiguities: 3 (2 HIGH, 1 MEDIUM, 0 LOW)
966
+ [HIGH] Fluent Analytics (Google Looker) — no skill mapping
967
+ [HIGH] US-203 — no tasks generated (Looker integration)
968
+ [MEDIUM] +/-1% error — unmeasurable by existing test tools
969
+
970
+ Traceability:
971
+ US-201: 4 tasks (covered)
972
+ US-202: 4 tasks (covered)
973
+ US-203: 0 tasks (GAP — requires human action)
974
+
975
+ Constraints Applied: backward_compatible, no_pii_in_logs
976
+
977
+ Output:
978
+ accounts/HMDEV/analysis/scope-decomposition/fcx-sourcing-abtesting.tasks.json
979
+ ```
980
+
981
+ ## Markdown Output Format (--output-format markdown)
982
+
983
+ When markdown output is requested, produce a table-based summary alongside the JSON:
984
+
985
+ ```markdown
986
+ # Task List: fcx.sourcing.abtesting
987
+
988
+ | ID | Type | Title | Skill | Depends On | Story | Priority |
989
+ |----|------|-------|-------|-----------|-------|----------|
990
+ | T-001 | SCAFFOLD | Scaffold module fcx.sourcing.abtesting | fluent-module-scaffold | -- | -- | 1 |
991
+ | T-002 | RULE | Implement experiment variant definition rule | fluent-rule-scaffold | T-001 | US-201 | 2 |
992
+ | T-003 | RULE | Implement traffic split allocation rule | fluent-rule-scaffold | T-001 | US-202 | 3 |
993
+ | ... | ... | ... | ... | ... | ... | ... |
994
+
995
+ ## Ambiguities
996
+
997
+ | Severity | Section | Item | Issue |
998
+ |----------|---------|------|-------|
999
+ | HIGH | Interfaces | Fluent Analytics (Google Looker) | No skill mapping |
1000
+ | HIGH | User stories | US-203 | No tasks generated |
1001
+ | MEDIUM | Acceptance criteria | +/-1% error | Unmeasurable |
1002
+
1003
+ ## Traceability
1004
+
1005
+ | Story | Tasks | Coverage |
1006
+ |-------|-------|----------|
1007
+ | US-201 | T-002, T-006, T-007, T-014 | Covered |
1008
+ | US-202 | T-003, T-004, T-005, T-014 | Covered |
1009
+ | US-203 | (none) | GAP |
1010
+ ```
1011
+
1012
+ ## Tips
1013
+
1014
+ - **Run `--validate-only` first** to check the scope document structure before generating a full task list. This catches missing sections and structural issues early.
1015
+ - **Scope documents should be machine-parseable** — use consistent heading levels, bullet lists with identifiers, and Given/When/Then format for criteria. The ADD template enforces this.
1016
+ - **One module per scope document** — if the scope covers multiple modules, split it into separate documents and run decomposition on each.
1017
+ - **Review ambiguities before executing tasks** — HIGH severity ambiguities often indicate scope gaps that need human resolution. Running tasks against an ambiguous scope wastes agent cycles.
1018
+ - **The task list is a living document** — `/fluent-dev` updates task statuses in-place as work progresses. Re-running decomposition overwrites the file, so back up if in-progress work exists.
1019
+ - **Custom task types** — if a scope requires work outside the standard type table (e.g., database migration, external API setup), generate a DOC-type placeholder with `skill: null` and flag as ambiguity.
1020
+ - **Story-to-criteria linking** — if criteria do not explicitly reference story IDs, the skill links them by order of appearance. For precise linking, include `[US-NNN]` references in criteria text.
1021
+ - **Large scope documents** — for scopes with 20+ stories, the task list can exceed 50 tasks. Review the dependency DAG visualization to identify parallelizable task groups.