[BLOCKING] Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
[BLOCKING] Before each step or sub-skill call, update task tracking: set in_progress when step starts, set completed when step ends.
[BLOCKING] Every completed/skipped step MUST include brief evidence or explicit skip reason.
[BLOCKING] If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
Quick Summary
Goal: Produce sprint-ready, INVEST-valid user stories — tech-agnostic, testable GWT criteria, evidence-cited estimates, dependency-mapped — by breaking Product Backlog Items into implementable stories via vertical slicing and SPIDR splitting, so a team with zero codebase knowledge can implement on any stack.
Summary:
Main steps (the pipeline): (1) read PBI + active plan, load domain context — module, entities, BR-IDs; (2) identify VERTICAL end-to-end slices; (3) SPIDR-split anything SP >8 (MUST) / >5 (SHOULD) until INVEST-valid; (4) write each story with min 3 GWT scenarios + 1 authorization scenario; (5) estimate bottom-up (Blast-Radius pre-pass → phase-hours → days; SP DERIVED) and emit full estimate frontmatter; (6) emit Story Dependencies table (no orphans); (7) run MANDATORY AskUserQuestion validation; (8) save to team-artifacts/pbis/stories/{YYMMDD}-ba-story-{slug}.md; (9) suggest /spec [mode=tests] next.
Slice VERTICALLY (thin end-to-end), NEVER horizontally (backend/frontend split) — apply SPIDR (Spike/Paths/Interfaces/Data/Rules) until each story is INVEST-valid — why: horizontal slices delay deliverable user value.
Every story is tech-agnostic + rebuild-from-scratch + demoable (AI-SDD M1-M5 and M7): no framework/class/file names in prose, carry the inherited FR-/BR- logical ID plus a [Source: namespace/service/id] abstract anchor (NEVER file:line), and every criterion states an outcome a stakeholder could SEE — reject and rework on any STOP condition.
Min 3 GIVEN/WHEN/THEN scenarios (happy + edge + error) PLUS a mandatory authorization scenario per story; every criterion has exactly ONE observable interpretation.
Estimate bottom-up (phase-hours → days × productivity factor; SP DERIVED, never the driver) with explicit test_count and Blast-Radius pass; emit full man_days_* / risk_* / blast_radius / estimate_reasoning frontmatter — why: SP-first anchors to a guess, downstream /prioritize+/plan read these fields.
Story Dependencies table is mandatory (no orphan stories) and the AskUserQuestion validation interview runs before handoff — NEVER auto-decide slicing/scope/effort.
MANDATORY IMPORTANT MUST ATTENTION Plan ToDo Task to READ the following project-specific reference docs:
project-structure-reference.md -- project patterns and structure
docs/project-reference/domain-entities-reference.md — Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models)
docs/specs/ — Test specifications by module (read existing TCs for related features; include test story/acceptance criteria for new stories)
If file not found, search for: project documentation, coding standards, architecture docs.
Vertical Slice — Identify end-to-end slices of functionality
SPIDR Split — Apply Spike/Paths/Interfaces/Data/Rules splitting if effort >5
Write Stories — INVEST-validated stories with min 3 GIVEN/WHEN/THEN scenarios each
Validate — Interview user to confirm slicing, acceptance criteria, and effort estimates
Key Rules:
Slice VERTICALLY (thin end-to-end); NEVER horizontally (backend/frontend split) — why: a horizontal slice ships no user-visible value on its own.
SP >8 MUST ATTENTION be split; >5 SHOULD be split — apply SPIDR until each story is INVEST-valid.
Every story MUST ATTENTION carry story_points, complexity, man_days_traditional, man_days_ai — plus the risk_* / blast_radius / estimate_reasoning fields /prioritize and /plan read downstream.
SP is DERIVED from bottom-up phase-hours → days × productivity factor — NEVER the driver.
Min 3 GIVEN/WHEN/THEN scenarios (happy + edge + error) PLUS a mandatory authorization scenario; each criterion has exactly ONE observable interpretation.
Tech-agnostic prose ONLY — no framework/class/file names; anchor with [Source: namespace/service/id], NEVER file:line.
Story Dependencies table is mandatory — NEVER leave an orphan story.
Run the AskUserQuestion validation interview before handoff — NEVER auto-decide slicing, scope, or effort.
Frontend/UI Context (if applicable)
When the task involves frontend or UI changes, read:
Design system tokens: docs/project-reference/design-system/README.md
Greenfield Mode
Auto-detected: no existing codebase (no discovered source directories, no manifest files, no populated project-config.json) → greenfield mode switches on automatically. Planning artifacts (docs/, plans/, .claude/) do NOT count — the repository needs actual code directories with content.
When greenfield is detected:
Generate foundation PBIs instead of feature stories: infrastructure setup, project scaffold, CI/CD pipeline, first feature vertical slice
Dependency ordering: infrastructure stories BEFORE feature stories
Skip the project-structure-reference.md read — it will not exist
Include setup stories: dev environment, build tooling, deployment pipeline, monitoring
Priority order: infra → scaffold → first feature → remaining features
[CRITICAL] Architecture Scaffolding Story: FIRST story = "Architecture Scaffolding" — every OOP/SOLID base abstract class, generic interface, and infrastructure abstraction the chosen stack needs. AI self-investigates which base classes the project requires; every feature story depends on it — why: features built on an unscaffolded foundation encode the wrong abstractions permanently.
Scaffolding acceptance criteria: base classes compile/type-check, DI/IoC registrations resolve, smoke test passes
UI System Foundation Story: If the project has a frontend, generate a "UI System Foundation" story (Sprint 0) with these sub-stories:
Format: Single file with all stories (use ## headers per story)
Artifact Path (canonical convention) — Command /story → base path team-artifacts/pbis/stories/, role token ba, type story. General filename pattern: {YYMMDD}-{role}-{type}-{slug}.md → e.g. 260119-ba-story-invoice-approval.md. Slug = lowercased basename, non-alphanumeric → -, trimmed, max 50 chars.
Project Domain Context Loading
When slicing domain-related PBIs, automatically load business context.
Step 1: Detect Module
From PBI frontmatter:
Check module field
If missing, detect module from docs/specs/ directory names
Step 2: Load Feature Context
Glob("docs/specs/{module}/*.md")
Read module README (first 200 lines)
Identify related feature from related_features list
Extract existing business rules (BR-{MOD}-XXX)
Note entity names from feature docs
Step 3: Apply Domain Vocabulary
Read docs/project-config.json modules[] and docs/specs/ to detect domain vocabulary per module. Use entity names from feature docs — avoid ambiguous synonyms.
When to apply: Story SP >8 MUST ATTENTION split. SP >5 SHOULD split. SP 13 = SHOULD split into 2-3 stories. SP 21 = MUST ATTENTION split (epic-level).
Pattern
Question
Split Strategy
Spike
Unknown complexity?
Create research spike first, then stories
Paths
Multiple workflow branches?
One story per path/choice
Interfaces
Multiple UIs or APIs?
One story per interface
Data
Multiple data formats/types?
One story per data variation
Rules
Multiple business rules?
One story per rule variation
Splitting Examples
Paths: "User can pay by card OR PayPal" → Story A: Card payment, Story B: PayPal payment
Data: "Import CSV, Excel, JSON" → Story A: CSV import, Story B: Excel import, Story C: JSON import
Rules: "Different approval flows by amount" → Story A: <$1000 auto-approve, Story B: >$1000 manager approval
Size Validation
SP 1-5: ✅ Good size
SP 6-8: ⚠️ Consider splitting (apply SPIDR)
SP 13: ❌ SHOULD split into 2-3 stories
SP 21: ❌ MUST ATTENTION split — epic-level, not sprint-ready
Scenario Templates
Minimum 3 scenarios per story:
1. Happy Path (Positive)
Scenario: User successfully {completes action}
Given {user has required permissions/state}
And {required data exists}
When user {performs valid action}
Then {primary expected outcome}
And {secondary verification if needed}
2. Edge Case (Boundary)
Scenario: System handles {boundary condition}
Given {edge state: empty list, max items, zero value}
When user {attempts action at boundary}
Then {appropriate handling: pagination, warning, default}
3. Error Case (Negative)
Scenario: System prevents {invalid action}
Given {precondition}
When user {provides invalid input OR unauthorized action}
Then error message "{specific error message}"
And {system remains in valid state}
And {no partial changes saved}
4. Authorization (MANDATORY per story)
Scenario: Unauthorized user cannot {perform action}
Given user has role {unauthorized role}
When user attempts to {action}
Then system rejects with "Forbidden" or "Unauthorized"
And no data is modified
Additional Scenario Types
Performance: Response time under load
Concurrency: Simultaneous user actions
Integration: External service unavailable
AI-SDD Mandate Gate (M1-M5 and M7) — BLOCKING
See .claude/skills/shared/sdd-artifact-contract.md → "AI-SDD Mandates (M1-M7)" for BLOCKING criteria. Every generated story MUST satisfy M1-M5 and M7:
Separate intent from implementation (M1/M2): The story narrative and acceptance criteria stay tech-agnostic — describe observable business behavior, no framework/product/language/design-pattern names, no source identifiers. Keep optional hints in ## Technical Notes and source references in evidence carriers as stack-portable abstract anchors ([Source: namespace/service/id], never file:line). Prose follows docs/project-reference/spec-principles.md §3.
Logical Requirement ID (M3): Each story carries a logical requirement ID (FR-/BR-) inherited from its parent PBI as the PRIMARY citation spine; keep the [Source: namespace/service/id] abstract anchor as a SECONDARY, stack-portable carrier — KEEP it, never remove it and never replace it with file:line (physical coordinates live only in the provenance sidecar).
Testable GWT/EARS criteria (M4): Every Given/When/Then or EARS criterion has ONE valid interpretation, observable completion states, and named failure modes — no vague phrasing ("fast", "user-friendly", "handle appropriately") and no implementation details.
Rebuild-from-scratch (M5): A team with zero codebase knowledge can implement identical behavior on ANY stack from the story alone.
Business-visibility (M7): Apply the demo test to each criterion's BODY: "what would a stakeholder SEE change?" — no answer → FAIL as TECHNICAL-ONLY and drop it from the story. Every GIVEN = a state a user could arrange; every WHEN = an action a user could take; every THEN = an outcome a user could see. FAIL a WHEN that is an invocation (a handler runs, a consumer receives, a job fires, data syncs) or a THEN asserting schema/type/nullability/call-count. Judge the BODY, never the story's title or ID. Never derive the story or scenario count from an architecture inventory (handlers, consumers, jobs) — that count moves when the system is re-architected though no business behavior changed, falsifying M5.
M1 governs vocabulary; M7 governs subject matter. A technical story in impeccably tech-free prose satisfies M1 while violating M7 — "the system correctly synchronizes the record" names no framework and is still a technical case in a business costume. That gap is the most common way business specs rot. Ask what a user could SEE, not which words were used.
[STOP — rework before emitting] Reject and rework a story when ANY of these failure conditions holds:
Tech-specific prose — narrative/criteria name a framework, product, language type, or design-pattern class.
Source code reference in prose — a class/method name, file path, or namespace appears outside an evidence carrier.
Missing logical ID or evidence — no FR-/BR- ID, OR a requirement/rule with no [Source: namespace/service/id] abstract-anchor evidence (or explicit TBD (pre-implementation) marker).
Vague acceptance criteria — non-testable, non-observable, or more than one valid interpretation.
Not implementable from the artifact alone — a reader would have to read source or guess a rule, limit, role, or failure mode.
Not demoable (M7) — a criterion's body fails the demo test: its WHEN is an invocation, or its THEN asserts schema/type/nullability/call-count, or no stakeholder-visible change answers "what would they SEE?" — it is TECHNICAL-ONLY and belongs to the technical tree, not this story.
Story Artifact Template
---
id: US-{YYMMDD}-{NNN}
parent_pbi: '{PBI-ID}'
title: '{Brief story title}'
persona: '{User persona}'
priority: P1 | P2 | P3
story_points: 1 | 2 | 3 | 5 | 8 | 13
complexity: Low | Medium | High | Very High
man_days_traditional: '{ Xd (Yd code + Zd test) — from SP table }'
man_days_ai: '{ Xd (Yd code + Zd test) — from SP table with AI }'
sprint: 0 | 1 | 2 | ...
status: draft | ready | in_progress | done
module: '{ServiceA | ServiceB | ServiceC | ServiceD}'
---
# User Stories for {PBI Title}
## Story 1: {Title}
**As a** {user role}
**I want** {goal}
**So that** {benefit}
### Acceptance Criteria
#### Scenario 1: {Happy path title}
```gherkin
Given {context}
When {action}
Then {outcome}
```
#### Scenario 2: {Edge case title}
```gherkin
Given {edge state}
When {action}
Then {handling}
```
#### Scenario 3: {Error case title}
```gherkin
Given {context}
When {invalid action}
Then error "{message}"
```
---
## Story 2: {Title}
{Repeat structure...}
---
## Out of Scope
- {Explicitly excluded items}
## Story Dependencies
| Story | Depends On | Type | Reason |
| -------- | ---------- | ------------ | --------------------------------- |
| US-{NNN} | - | independent | First slice, no dependencies |
| US-{NNN} | US-{NNN} | must-after | Needs entity/API from prior story |
| US-{NNN} | US-{NNN} | can-parallel | Independent feature slice |
| US-{NNN} | US-{NNN} | blocked-by | Requires external service/infra |
## Domain Context
**Module:** {module}
**Related Feature:** {feature doc path}
**Entities:** {Entity1}, {Entity2}
**Requirement IDs (M3 — inherited from PBI):** {FR-XXX / BR-XXX — primary citation spine}
**Business Rules:** {BR-XXX references}
**Evidence (secondary, stack-portable):** {`[Source: namespace/service/id]` abstract anchor per requirement, or `TBD (pre-implementation)`}
## UI Wireframe
### Layout
{ASCII wireframe showing this story's UI slice — see UI wireframe protocol}
### Components
- **{ComponentName}** — {behavior for this story} _(tier: common | domain-shared | page/app)_
> Classify per **Component Hierarchy** in `UI wireframe protocol` — search existing libs before proposing new components.
### Interaction Flow
1. User {action} on {component}
2. System {response/feedback}
3. UI updates to show {result}
### States
| State | Behavior |
| ------- | -------------------------- |
| Default | {what user sees initially} |
| Loading | {spinner/skeleton} |
| Empty | {empty state message} |
| Error | {error handling} |
> If backend-only: `## UI Wireframe` → `N/A — Backend-only change. No UI affected.`
## Technical Notes
- {Implementation hints if needed}
## Validation Summary
**Validated:** {date}
### Confirmed
- {decision}: {user choice}
### Action Items
- [ ] {follow-up if any}
Sprint 0 / Foundation Stories (Production Readiness)
When the PBI includes a "Production Readiness Concerns" table with "Required" items, automatically generate Sprint 0 / foundation stories for each concern:
PBI Concern
Story Title
Story Points
Priority
Code linting/analyzers = Required
"Set up code linting and formatting"
1-2 SP
Must Have
Error handling setup = Required
"Set up error handling foundation"
2-3 SP
Must Have
Loading indicators = Required
"Set up loading indicator infrastructure"
1-2 SP
Must Have
Docker integration = Required
"Set up Docker development environment"
2-3 SP
Must Have
CI/CD quality gates = Required
"Set up CI/CD quality gates"
2-3 SP
Must Have
Seed data = Required
"Set up seed data / data seeder"
2-3 SP
Must Have
Data migration = Required
"Create data migration for schema changes"
1-3 SP
Must Have
Rules
Foundation stories MUST ATTENTION be completed before feature stories begin
Mark as sprint: 0 or sprint: foundation in story metadata
Each foundation story references the specific protocol section for implementation guidance
If PBI concern = "Existing", skip story generation (already set up)
If PBI concern = "No", skip story generation (explicitly opted out)
Anti-Patterns to Avoid
Anti-Pattern
Problem
Correct Approach
Horizontal slicing
"Backend story" + "Frontend story" = delays value
Vertical slice: thin end-to-end functionality
Single scenario
Missing edge/error cases
Minimum 3 scenarios: happy, edge, error
Vague criteria
"Fast", "user-friendly" untestable
Quantify: "< 200ms", "≤ 3 clicks"
Solution-speak
"Use Redis cache" constrains team
Outcome: "Results return within 200ms"
Effort >8
Won't fit sprint, hard to estimate
Apply SPIDR, split until ≤8
No error scenario
Missing negative test coverage
Always include invalid input handling
Generic persona
"As a user" too vague
Specific: "As a warehouse operator"
Key Rules
Every story set MUST ATTENTION include a Story Dependencies table — with types: must-after, can-parallel, blocked-by, independent. This enables /prioritize and /plan to respect implementation ordering.
SPIDR splits MUST ATTENTION include dependency chains — When splitting a story, declare which split stories depend on others.
No orphan stories — Every story must appear in the dependency table, even if independent.
Quality Checklist
Before completing user stories:
Each story follows "As a... I want... So that..." format
SPIDR splitting applied (effort ≤8, prefer ≤5)
At least 3 scenarios per story: happy, edge, error
All scenarios use GIVEN/WHEN/THEN format
Effort estimated in Fibonacci (1, 2, 3, 5, 8)
Stories independent (can develop in any order)
Out of scope explicitly listed
Story Dependencies table included with all stories listed
Authorization scenario included per story (unauthorized access rejection)
Seed data story included if PBI has seed data requirements
Data migration story included if PBI has schema changes
Validation interview completed
Validation Step (MANDATORY)
After creating user stories, validate with user.
Question Categories
Category
Example Question
Slicing
"Are the story slices independent enough?"
Size
"Any story >8 effort that needs further splitting?"
Scenarios
"Any acceptance criteria missing for edge cases?"
Dependencies
"Are there hidden dependencies between stories?"
Scope
"Should anything be explicitly excluded?"
Process
Generate 2-4 questions focused on slicing quality, scenarios, and dependencies
Use AskUserQuestion tool to interview
Document in story artifact under ## Validation Summary
Update stories based on answers (split if needed)
This step is NOT optional.
Related
Type
Reference
Role Skill
business-analyst
Command
/story
Input
/refine output (PBI)
Next Steps
/spec [mode=tests], /design-spec, /prioritize
MANDATORY: Systematic Task Breakdown for Stories
MANDATORY IMPORTANT MUST ATTENTION break down ALL stories into small, systematic todo tasks using TaskCreate BEFORE starting implementation. Each story MUST ATTENTION have its own set of tasks that cover:
Read & understand story — Load story artifact, acceptance criteria, domain context
Create implementation subtasks per layer — One task per file or logical unit (entity, command handler, DTO, component, service, test)
Include spec tasks — Each story MUST ATTENTION have corresponding test specifications (unit, integration, or E2E as appropriate)
Include validation task — Verify story against acceptance criteria GIVEN/WHEN/THEN after implementation
Include review task — Final quality check per story
Task Naming Convention
[Story US-{ID}] {Layer}: {Description}
Example for a "Create Invoice" story:
[Story US-001] Entity: Create Invoice entity with validation rules
[Story US-001] Command: CreateInvoiceCommand + Handler
[Story US-001] DTO: InvoiceDto with mapping
[Story US-001] API: POST /api/invoices endpoint
[Story US-001] Component: InvoiceCreateFormComponent
[Story US-001] Store: InvoiceVmStore with create action
[Story US-001] Test: Integration test for CreateInvoiceCommand
[Story US-001] Test: E2E test for invoice creation flow
[Story US-001] Review: Verify against AC scenarios
Why: Without systematic task breakdown, stories become monolithic — missed edge cases, incomplete specs, context loss during implementation.
Next Steps
MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS after completing this skill, you MUST ATTENTION use AskUserQuestion to present these options. Do NOT skip because the task seems "simple" or "obvious" — the user decides:
"/spec [mode=tests] (Recommended)" — Generate test specifications from stories
"/pbi-mockup" — Generate HTML mockup report from PBI and stories
"/plan-validate" — If stories need validation against plan
"Skip, continue manually" — user decides
[IMPORTANT] Use TaskCreate to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
External Memory: For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in plans/reports/ — prevents context loss and serves as deliverable.
Evidence Gate: MANDATORY IMPORTANT MUST ATTENTION — every claim, finding, and recommendation requires file:line proof or traced evidence with confidence percentage (>80% to act, <80% must verify first).
Estimation Framework — Bottom-up first; SP DERIVED; output min-max range when likely ≥3d. Stack-agnostic. Baseline: 3-5yr dev, 6 productive hrs/day. AI estimate assumes Claude Code + project context.
Method:
Blast Radius pass (below) — drives code AND test cost
Reference docs/project-config.json for project-specific paths.
UI Wireframe — Process visual design input (Figma URLs, screenshots, wireframes) via appropriate tool BEFORE creating wireframes. Use box-drawing ASCII characters for spatial layout. Classify every component into exactly ONE tier: Common (cross-app reusable) / Domain-Shared (cross-domain) / Page (single-page). Duplicate UI code = wrong tier. Search existing component libraries before creating new (>=80% match = reuse). Detail level varies by skill (idea=rough, story=full decomposition).
1---2name: story-33description: [Project Management] Use when creating user stories from PBIs, slicing features, or breaking down requirements.4---56<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:START -->78> **[BLOCKING]** Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.9> **[BLOCKING]** Before each step or sub-skill call, update task tracking: set `in_progress` when step starts, set `completed` when step ends.10> **[BLOCKING]** Every completed/skipped step MUST include brief evidence or explicit skip reason.11> **[BLOCKING]** If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.1213<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:END -->1415## Quick Summary1617**Goal:** Produce sprint-ready, INVEST-valid user stories — tech-agnostic, testable GWT criteria, evidence-cited estimates, dependency-mapped — by breaking Product Backlog Items into implementable stories via vertical slicing and SPIDR splitting, so a team with zero codebase knowledge can implement on any stack.1819**Summary:**2021- **Main steps (the pipeline):** (1) read PBI + active plan, load domain context — module, entities, BR-IDs; (2) identify VERTICAL end-to-end slices; (3) SPIDR-split anything SP >8 (MUST) / >5 (SHOULD) until INVEST-valid; (4) write each story with min 3 GWT scenarios + 1 authorization scenario; (5) estimate bottom-up (Blast-Radius pre-pass → phase-hours → days; SP DERIVED) and emit full estimate frontmatter; (6) emit Story Dependencies table (no orphans); (7) run MANDATORY `AskUserQuestion` validation; (8) save to `team-artifacts/pbis/stories/{YYMMDD}-ba-story-{slug}.md`; (9) suggest `/spec [mode=tests]` next.22- Slice VERTICALLY (thin end-to-end), NEVER horizontally (backend/frontend split) — apply SPIDR (Spike/Paths/Interfaces/Data/Rules) until each story is INVEST-valid — why: horizontal slices delay deliverable user value.23- Every story is tech-agnostic + rebuild-from-scratch + demoable (AI-SDD M1-M5 and M7): no framework/class/file names in prose, carry the inherited `FR-`/`BR-` logical ID plus a `[Source: namespace/service/id]` abstract anchor (NEVER `file:line`), and every criterion states an outcome a stakeholder could SEE — reject and rework on any STOP condition.24- Min 3 GIVEN/WHEN/THEN scenarios (happy + edge + error) PLUS a mandatory authorization scenario per story; every criterion has exactly ONE observable interpretation.25- Estimate bottom-up (phase-hours → days × productivity factor; SP DERIVED, never the driver) with explicit `test_count` and Blast-Radius pass; emit full `man_days_*` / `risk_*` / `blast_radius` / `estimate_reasoning` frontmatter — why: SP-first anchors to a guess, downstream `/prioritize`+`/plan` read these fields.26- Story Dependencies table is mandatory (no orphan stories) and the `AskUserQuestion` validation interview runs before handoff — NEVER auto-decide slicing/scope/effort.2728> **MANDATORY IMPORTANT MUST ATTENTION** Plan ToDo Task to READ the following project-specific reference docs:29>30> - `project-structure-reference.md` -- project patterns and structure31> - `docs/project-reference/domain-entities-reference.md` — Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models)32> - `docs/specs/` — Test specifications by module (read existing TCs for related features; include test story/acceptance criteria for new stories)33>34> If file not found, search for: project documentation, coding standards, architecture docs.3536**Workflow:**37381. **Read PBI** — Load PBI artifact, acceptance criteria, and domain context392. **Vertical Slice** — Identify end-to-end slices of functionality403. **SPIDR Split** — Apply Spike/Paths/Interfaces/Data/Rules splitting if effort >5414. **Write Stories** — INVEST-validated stories with min 3 GIVEN/WHEN/THEN scenarios each425. **Validate** — Interview user to confirm slicing, acceptance criteria, and effort estimates4344**Key Rules:**4546- Slice VERTICALLY (thin end-to-end); NEVER horizontally (backend/frontend split) — why: a horizontal slice ships no user-visible value on its own.47- SP >8 MUST ATTENTION be split; >5 SHOULD be split — apply SPIDR until each story is INVEST-valid.48- Every story MUST ATTENTION carry `story_points`, `complexity`, `man_days_traditional`, `man_days_ai` — plus the `risk_*` / `blast_radius` / `estimate_reasoning` fields `/prioritize` and `/plan` read downstream.49- SP is DERIVED from bottom-up phase-hours → days × productivity factor — NEVER the driver.50- Min 3 GIVEN/WHEN/THEN scenarios (happy + edge + error) PLUS a mandatory authorization scenario; each criterion has exactly ONE observable interpretation.51- Tech-agnostic prose ONLY — no framework/class/file names; anchor with `[Source: namespace/service/id]`, NEVER `file:line`.52- Story Dependencies table is mandatory — NEVER leave an orphan story.53- Run the `AskUserQuestion` validation interview before handoff — NEVER auto-decide slicing, scope, or effort.5455### Frontend/UI Context (if applicable)5657> When the task involves frontend or UI changes, read:5859- Component patterns: `docs/project-reference/frontend-patterns-reference.md`60- Styling/BEM guide: `docs/project-reference/scss-styling-guide.md`61- Design system tokens: `docs/project-reference/design-system/README.md`6263## Greenfield Mode6465> **Auto-detected:** no existing codebase (no discovered source directories, no manifest files, no populated `project-config.json`) → greenfield mode switches on automatically. Planning artifacts (`docs/`, `plans/`, `.claude/`) do NOT count — the repository needs actual code directories with content.6667**When greenfield is detected:**68691. Generate **foundation PBIs** instead of feature stories: infrastructure setup, project scaffold, CI/CD pipeline, first feature vertical slice702. Dependency ordering: infrastructure stories BEFORE feature stories713. Skip the `project-structure-reference.md` read — it will not exist724. Include setup stories: dev environment, build tooling, deployment pipeline, monitoring735. Priority order: infra → scaffold → first feature → remaining features746. **[CRITICAL] Architecture Scaffolding Story:** FIRST story = "Architecture Scaffolding" — every OOP/SOLID base abstract class, generic interface, and infrastructure abstraction the chosen stack needs. AI self-investigates which base classes the project requires; every feature story depends on it — why: features built on an unscaffolded foundation encode the wrong abstractions permanently.757. Scaffolding acceptance criteria: base classes compile/type-check, DI/IoC registrations resolve, smoke test passes768. **UI System Foundation Story:** If the project has a frontend, generate a "UI System Foundation" story (Sprint 0) with these sub-stories:7778 | Sub-Story | SP | Priority | Depends On |79 | ------------------------------------------------------------------------- | --- | --------- | ------------------------ |80 | "Set up design token system" | 2-3 | Must Have | Architecture Scaffolding |81 | "Create base layout and responsive grid" | 2-3 | Must Have | Design tokens |82 | "Create core UI components (loading, error, empty, toast, button, input)" | 3-5 | Must Have | Design tokens + layout |8384**Dependency rule:** All UI feature stories MUST ATTENTION depend on "UI System Foundation" stories.8586- Each story needs happy path, edge case, and error scenario (minimum)87- Use correct project domain vocabulary when available (check project docs for terminology)8889**Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).**9091# User Story Creation9293Break Product Backlog Items into implementable user stories using vertical slicing and SPIDR patterns.9495---9697## Step 0: Locate Active Plan (if in workflow)9899If running within a workflow (big-feature, greenfield-init, etc.):1001011. **Search for active plan** — Glob `plans/*/plan.md` sorted by modification time, or check `TaskList` for plan context1022. **Read `plan.md`** — understand project scope, architecture decisions, domain model, implementation plan1033. **Read existing research** — `{plan-dir}/research/*.md` and `{plan-dir}/phase-*.md` for domain model, tech stack, architecture1044. **Read `docs/project-reference/domain-entities-reference.md`** (if exists) — understand existing domain entities for accurate story scoping1055. Use plan context to inform story slicing (architecture decisions affect how stories are split)106107---108109## When to Use110111- PBI ready for story breakdown112- Feature needs vertical slicing113- Creating sprint-ready work items114- Story too large (effort >8)115116---117118## Quick Reference119120### Workflow1211221. Read PBI artifact and acceptance criteria1232. **Load domain context** (if project module detected)1243. Identify vertical slices (end-to-end functionality)1254. **Apply SPIDR splitting** if stories too large1265. Apply INVEST criteria to each story1276. Create user stories with GIVEN/WHEN/THEN (min 3 scenarios)1287. Save to `team-artifacts/pbis/stories/`1298. **Validate stories** (MANDATORY) - Interview user to confirm slicing, acceptance criteria, and effort1309. Suggest next: `/spec [mode=tests]` or `/design-spec`131132### Output133134- **Path:** `team-artifacts/pbis/stories/{YYMMDD}-us-{pbi-slug}.md`135- **Format:** Single file with all stories (use ## headers per story)136137> **Artifact Path (canonical convention)** — Command `/story` → base path `team-artifacts/pbis/stories/`, role token `ba`, type `story`. General filename pattern: `{YYMMDD}-{role}-{type}-{slug}.md` → e.g. `260119-ba-story-invoice-approval.md`. Slug = lowercased basename, non-alphanumeric → `-`, trimmed, max 50 chars.138139---140141## Project Domain Context Loading142143When slicing domain-related PBIs, automatically load business context.144145### Step 1: Detect Module146147**From PBI frontmatter:**1481491. Check `module` field1502. If missing, detect module from `docs/specs/` directory names151152### Step 2: Load Feature Context153154```155Glob("docs/specs/{module}/*.md")156```1571581. Read module README (first 200 lines)1592. Identify related feature from `related_features` list1603. Extract existing business rules (BR-{MOD}-XXX)1614. Note entity names from feature docs162163### Step 3: Apply Domain Vocabulary164165Read `docs/project-config.json` modules[] and `docs/specs/` to detect domain vocabulary per module. Use entity names from feature docs — avoid ambiguous synonyms.166167### Step 4: Include in Story168169```markdown170## Domain Context171172**Module:** {detected module}173**Feature:** {related feature}174**Entities:** {Entity1}, {Entity2}175**Business Rules:** BR-{MOD}-XXX (from feature docs)176```177178---179180## INVEST Criteria181182| Criterion | Definition | Validation Question |183| --------------- | -------------------------------- | ------------------------------------ |184| **I**ndependent | No dependencies on other stories | Can this be developed in any order? |185| **N**egotiable | Details can change | Is the "how" open for discussion? |186| **V**aluable | Delivers user value | Does user get observable benefit? |187| **E**stimable | Can estimate story points | Can team size this? (Fibonacci 1-21) |188| **S**mall | Completable in sprint | SP ≤8? (prefer ≤5) |189| **T**estable | Clear acceptance criteria | Can we write pass/fail tests? |190191---192193## SPIDR Splitting Checklist194195**When to apply:** Story SP >8 MUST ATTENTION split. SP >5 SHOULD split. SP 13 = SHOULD split into 2-3 stories. SP 21 = MUST ATTENTION split (epic-level).196197| Pattern | Question | Split Strategy |198| -------------- | ---------------------------- | ----------------------------------------- |199| **S**pike | Unknown complexity? | Create research spike first, then stories |200| **P**aths | Multiple workflow branches? | One story per path/choice |201| **I**nterfaces | Multiple UIs or APIs? | One story per interface |202| **D**ata | Multiple data formats/types? | One story per data variation |203| **R**ules | Multiple business rules? | One story per rule variation |204205### Splitting Examples206207**Paths:** "User can pay by card OR PayPal" → Story A: Card payment, Story B: PayPal payment208209**Data:** "Import CSV, Excel, JSON" → Story A: CSV import, Story B: Excel import, Story C: JSON import210211**Rules:** "Different approval flows by amount" → Story A: <$1000 auto-approve, Story B: >$1000 manager approval212213### Size Validation214215```216SP 1-5: ✅ Good size217SP 6-8: ⚠️ Consider splitting (apply SPIDR)218SP 13: ❌ SHOULD split into 2-3 stories219SP 21: ❌ MUST ATTENTION split — epic-level, not sprint-ready220```221222---223224## Scenario Templates225226**Minimum 3 scenarios per story:**227228### 1. Happy Path (Positive)229230```gherkin231Scenario: User successfully {completes action}232 Given {user has required permissions/state}233 And {required data exists}234 When user {performs valid action}235 Then {primary expected outcome}236 And {secondary verification if needed}237```238239### 2. Edge Case (Boundary)240241```gherkin242Scenario: System handles {boundary condition}243 Given {edge state: empty list, max items, zero value}244 When user {attempts action at boundary}245 Then {appropriate handling: pagination, warning, default}246```247248### 3. Error Case (Negative)249250```gherkin251Scenario: System prevents {invalid action}252 Given {precondition}253 When user {provides invalid input OR unauthorized action}254 Then error message "{specific error message}"255 And {system remains in valid state}256 And {no partial changes saved}257```258259### 4. Authorization (MANDATORY per story)260261```gherkin262Scenario: Unauthorized user cannot {perform action}263 Given user has role {unauthorized role}264 When user attempts to {action}265 Then system rejects with "Forbidden" or "Unauthorized"266 And no data is modified267```268269### Additional Scenario Types270271**Performance:** Response time under load272**Concurrency:** Simultaneous user actions273**Integration:** External service unavailable274275---276277## AI-SDD Mandate Gate (M1-M5 and M7) — BLOCKING278279See `.claude/skills/shared/sdd-artifact-contract.md` → "AI-SDD Mandates (M1-M7)" for BLOCKING criteria. Every generated story MUST satisfy M1-M5 and M7:280281- **Separate intent from implementation (M1/M2):** The story narrative and acceptance criteria stay tech-agnostic — describe observable business behavior, no framework/product/language/design-pattern names, no source identifiers. Keep optional hints in `## Technical Notes` and source references in evidence carriers as stack-portable abstract anchors (`[Source: namespace/service/id]`, never `file:line`). Prose follows `docs/project-reference/spec-principles.md` §3.282- **Logical Requirement ID (M3):** Each story carries a logical requirement ID (`FR-`/`BR-`) inherited from its parent PBI as the PRIMARY citation spine; keep the `[Source: namespace/service/id]` abstract anchor as a SECONDARY, stack-portable carrier — KEEP it, never remove it and never replace it with `file:line` (physical coordinates live only in the provenance sidecar).283- **Testable GWT/EARS criteria (M4):** Every Given/When/Then or EARS criterion has ONE valid interpretation, observable completion states, and named failure modes — no vague phrasing ("fast", "user-friendly", "handle appropriately") and no implementation details.284- **Rebuild-from-scratch (M5):** A team with zero codebase knowledge can implement identical behavior on ANY stack from the story alone.285- **Business-visibility (M7):** Apply the demo test to each criterion's BODY: _"what would a stakeholder SEE change?"_ — no answer → FAIL as TECHNICAL-ONLY and drop it from the story. Every `GIVEN` = a state a user could arrange; every `WHEN` = an action a user could take; every `THEN` = an outcome a user could see. FAIL a `WHEN` that is an invocation (a handler runs, a consumer receives, a job fires, data syncs) or a `THEN` asserting schema/type/nullability/call-count. Judge the BODY, never the story's title or ID. Never derive the story or scenario count from an architecture inventory (handlers, consumers, jobs) — that count moves when the system is re-architected though no business behavior changed, falsifying M5.286287> **M1 governs vocabulary; M7 governs subject matter.** A technical story in impeccably tech-free prose satisfies M1 while violating M7 — _"the system correctly synchronizes the record"_ names no framework and is still a technical case in a business costume. That gap is the most common way business specs rot. Ask what a user could SEE, not which words were used.288289> **[STOP — rework before emitting]** Reject and rework a story when ANY of these failure conditions holds:290>291> 1. Tech-specific prose — narrative/criteria name a framework, product, language type, or design-pattern class.292> 2. Source code reference in prose — a class/method name, file path, or namespace appears outside an evidence carrier.293> 3. Missing logical ID or evidence — no `FR-`/`BR-` ID, OR a requirement/rule with no `[Source: namespace/service/id]` abstract-anchor evidence (or explicit `TBD (pre-implementation)` marker).294> 4. Vague acceptance criteria — non-testable, non-observable, or more than one valid interpretation.295> 5. Not implementable from the artifact alone — a reader would have to read source or guess a rule, limit, role, or failure mode.296> 6. Not demoable (M7) — a criterion's body fails the demo test: its `WHEN` is an invocation, or its `THEN` asserts schema/type/nullability/call-count, or no stakeholder-visible change answers _"what would they SEE?"_ — it is TECHNICAL-ONLY and belongs to the technical tree, not this story.297298---299300## Story Artifact Template301302````markdown303---304id: US-{YYMMDD}-{NNN}305parent_pbi: '{PBI-ID}'306title: '{Brief story title}'307persona: '{User persona}'308priority: P1 | P2 | P3309story_points: 1 | 2 | 3 | 5 | 8 | 13310complexity: Low | Medium | High | Very High311man_days_traditional: '{ Xd (Yd code + Zd test) — from SP table }'312man_days_ai: '{ Xd (Yd code + Zd test) — from SP table with AI }'313sprint: 0 | 1 | 2 | ...314status: draft | ready | in_progress | done315module: '{ServiceA | ServiceB | ServiceC | ServiceD}'316---317318# User Stories for {PBI Title}319320## Story 1: {Title}321322**As a** {user role}323**I want** {goal}324**So that** {benefit}325326### Acceptance Criteria327328#### Scenario 1: {Happy path title}329330```gherkin331Given {context}332When {action}333Then {outcome}334```335336#### Scenario 2: {Edge case title}337338```gherkin339Given {edge state}340When {action}341Then {handling}342```343344#### Scenario 3: {Error case title}345346```gherkin347Given {context}348When {invalid action}349Then error "{message}"350```351352---353354## Story 2: {Title}355356{Repeat structure...}357358---359360## Out of Scope361362- {Explicitly excluded items}363364## Story Dependencies365366| Story | Depends On | Type | Reason |367| -------- | ---------- | ------------ | --------------------------------- |368| US-{NNN} | - | independent | First slice, no dependencies |369| US-{NNN} | US-{NNN} | must-after | Needs entity/API from prior story |370| US-{NNN} | US-{NNN} | can-parallel | Independent feature slice |371| US-{NNN} | US-{NNN} | blocked-by | Requires external service/infra |372373## Domain Context374375**Module:** {module}376**Related Feature:** {feature doc path}377**Entities:** {Entity1}, {Entity2}378**Requirement IDs (M3 — inherited from PBI):** {FR-XXX / BR-XXX — primary citation spine}379**Business Rules:** {BR-XXX references}380**Evidence (secondary, stack-portable):** {`[Source: namespace/service/id]` abstract anchor per requirement, or `TBD (pre-implementation)`}381382## UI Wireframe383384### Layout385386{ASCII wireframe showing this story's UI slice — see UI wireframe protocol}387388### Components389390- **{ComponentName}** — {behavior for this story} _(tier: common | domain-shared | page/app)_391392> Classify per **Component Hierarchy** in `UI wireframe protocol` — search existing libs before proposing new components.393394### Interaction Flow3953961. User {action} on {component}3972. System {response/feedback}3983. UI updates to show {result}399400### States401402| State | Behavior |403| ------- | -------------------------- |404| Default | {what user sees initially} |405| Loading | {spinner/skeleton} |406| Empty | {empty state message} |407| Error | {error handling} |408409> If backend-only: `## UI Wireframe` → `N/A — Backend-only change. No UI affected.`410411## Technical Notes412413- {Implementation hints if needed}414415## Validation Summary416417**Validated:** {date}418419### Confirmed420421- {decision}: {user choice}422423### Action Items424425- [ ] {follow-up if any}426````427428---429430## Sprint 0 / Foundation Stories (Production Readiness)431432When the PBI includes a "Production Readiness Concerns" table with "Required" items, automatically generate Sprint 0 / foundation stories for each concern:433434| PBI Concern | Story Title | Story Points | Priority |435| --------------------------------- | ------------------------------------------ | ------------ | --------- |436| Code linting/analyzers = Required | "Set up code linting and formatting" | 1-2 SP | Must Have |437| Error handling setup = Required | "Set up error handling foundation" | 2-3 SP | Must Have |438| Loading indicators = Required | "Set up loading indicator infrastructure" | 1-2 SP | Must Have |439| Docker integration = Required | "Set up Docker development environment" | 2-3 SP | Must Have |440| CI/CD quality gates = Required | "Set up CI/CD quality gates" | 2-3 SP | Must Have |441| Seed data = Required | "Set up seed data / data seeder" | 2-3 SP | Must Have |442| Data migration = Required | "Create data migration for schema changes" | 1-3 SP | Must Have |443444### Rules445446- Foundation stories MUST ATTENTION be completed before feature stories begin447- Mark as `sprint: 0` or `sprint: foundation` in story metadata448- Each foundation story references the specific protocol section for implementation guidance449- If PBI concern = "Existing", skip story generation (already set up)450- If PBI concern = "No", skip story generation (explicitly opted out)451452---453454## Anti-Patterns to Avoid455456| Anti-Pattern | Problem | Correct Approach |457| ------------------ | ------------------------------------------------- | --------------------------------------------- |458| Horizontal slicing | "Backend story" + "Frontend story" = delays value | Vertical slice: thin end-to-end functionality |459| Single scenario | Missing edge/error cases | Minimum 3 scenarios: happy, edge, error |460| Vague criteria | "Fast", "user-friendly" untestable | Quantify: "< 200ms", "≤ 3 clicks" |461| Solution-speak | "Use Redis cache" constrains team | Outcome: "Results return within 200ms" |462| Effort >8 | Won't fit sprint, hard to estimate | Apply SPIDR, split until ≤8 |463| No error scenario | Missing negative test coverage | Always include invalid input handling |464| Generic persona | "As a user" too vague | Specific: "As a warehouse operator" |465466---467468## Key Rules469470- **Every story set MUST ATTENTION include a Story Dependencies table** — with types: `must-after`, `can-parallel`, `blocked-by`, `independent`. This enables `/prioritize` and `/plan` to respect implementation ordering.471- **SPIDR splits MUST ATTENTION include dependency chains** — When splitting a story, declare which split stories depend on others.472- **No orphan stories** — Every story must appear in the dependency table, even if independent.473474## Quality Checklist475476Before completing user stories:477478- [ ] Each story follows "As a... I want... So that..." format479- [ ] SPIDR splitting applied (effort ≤8, prefer ≤5)480- [ ] At least 3 scenarios per story: happy, edge, error481- [ ] All scenarios use GIVEN/WHEN/THEN format482- [ ] Effort estimated in Fibonacci (1, 2, 3, 5, 8)483- [ ] Stories independent (can develop in any order)484- [ ] Out of scope explicitly listed485- [ ] Story Dependencies table included with all stories listed486- [ ] Dependency types correct (must-after, can-parallel, blocked-by, independent)487- [ ] Parent PBI linked in frontmatter488- [ ] Domain vocabulary used correctly (if the project)489- [ ] Authorization scenario included per story (unauthorized access rejection)490- [ ] Seed data story included if PBI has seed data requirements491- [ ] Data migration story included if PBI has schema changes492- [ ] Validation interview completed493494---495496## Validation Step (MANDATORY)497498After creating user stories, validate with user.499500### Question Categories501502| Category | Example Question |503| ---------------- | --------------------------------------------------- |504| **Slicing** | "Are the story slices independent enough?" |505| **Size** | "Any story >8 effort that needs further splitting?" |506| **Scenarios** | "Any acceptance criteria missing for edge cases?" |507| **Dependencies** | "Are there hidden dependencies between stories?" |508| **Scope** | "Should anything be explicitly excluded?" |509510### Process5115121. Generate 2-4 questions focused on slicing quality, scenarios, and dependencies5132. Use `AskUserQuestion` tool to interview5143. Document in story artifact under `## Validation Summary`5154. Update stories based on answers (split if needed)516517**This step is NOT optional.**518519---520521## Related522523| Type | Reference |524| -------------- | --------------------------------------------------- |525| **Role Skill** | `business-analyst` |526| **Command** | `/story` |527| **Input** | `/refine` output (PBI) |528| **Next Steps** | `/spec [mode=tests]`, `/design-spec`, `/prioritize` |529530---531532## MANDATORY: Systematic Task Breakdown for Stories533534**MANDATORY IMPORTANT MUST ATTENTION** break down ALL stories into small, systematic todo tasks using `TaskCreate` BEFORE starting implementation. Each story MUST ATTENTION have its own set of tasks that cover:5355361. **Read & understand story** — Load story artifact, acceptance criteria, domain context5372. **Identify vertical slice layers** — Backend entity/command/query, frontend component/store/API, integration points5383. **Create implementation subtasks per layer** — One task per file or logical unit (entity, command handler, DTO, component, service, test)5394. **Include spec tasks** — Each story MUST ATTENTION have corresponding test specifications (unit, integration, or E2E as appropriate)5405. **Include validation task** — Verify story against acceptance criteria GIVEN/WHEN/THEN after implementation5416. **Include review task** — Final quality check per story542543### Task Naming Convention544545```546547[Story US-{ID}] {Layer}: {Description}548549```550551Example for a "Create Invoice" story:552553```554555[Story US-001] Entity: Create Invoice entity with validation rules556[Story US-001] Command: CreateInvoiceCommand + Handler557[Story US-001] DTO: InvoiceDto with mapping558[Story US-001] API: POST /api/invoices endpoint559[Story US-001] Component: InvoiceCreateFormComponent560[Story US-001] Store: InvoiceVmStore with create action561[Story US-001] Test: Integration test for CreateInvoiceCommand562[Story US-001] Test: E2E test for invoice creation flow563[Story US-001] Review: Verify against AC scenarios564565```566567**Why:** Without systematic task breakdown, stories become monolithic — missed edge cases, incomplete specs, context loss during implementation.568569---570571## Next Steps572573**MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS** after completing this skill, you MUST ATTENTION use `AskUserQuestion` to present these options. Do NOT skip because the task seems "simple" or "obvious" — the user decides:574575- **"/spec [mode=tests] (Recommended)"** — Generate test specifications from stories576- **"/pbi-mockup"** — Generate HTML mockup report from PBI and stories577- **"/plan-validate"** — If stories need validation against plan578- **"Skip, continue manually"** — user decides579580> **[IMPORTANT]** Use `TaskCreate` to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.581582> **External Memory:** For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in `plans/reports/` — prevents context loss and serves as deliverable.583584> **Evidence Gate:** MANDATORY IMPORTANT MUST ATTENTION — every claim, finding, and recommendation requires `file:line` proof or traced evidence with confidence percentage (>80% to act, <80% must verify first).585586<!-- SYNC:estimation-framework -->587588> **Estimation Framework** — Bottom-up first; SP DERIVED; output min-max range when likely ≥3d. Stack-agnostic. Baseline: 3-5yr dev, 6 productive hrs/day. AI estimate assumes Claude Code + project context.589>590> **Method:**591>592> 1. **Blast Radius pass** (below) — drives code AND test cost593> 2. Decompose phases → hours/phase → `bottom_up_hours = Σ phase_hours`594> 3. `likely_days = ceil(bottom_up_hours / 6) × productivity_factor`595> 4. Sum **Risk Margin** (base + add-ons) → `max_days = likely_days × (1 + margin)`596> 5. `min_days = likely_days × 0.9`597> 6. Output as range when `likely_days ≥3`; single point allowed `<3` (still record margin)598> 7. `man_days_ai` = same range × AI speedup599> 8. `story_points` DERIVED from `likely_days` via SP-Days — NEVER driver. Disagreement >50% → trust bottom-up600>601> **Productivity factor:** 0.8 strong scaffolding+codegen+AI hooks · 1.0 mature default · 1.2 weak patterns · 1.5 greenfield602>603> **Cost Driver Heuristic (apply BEFORE work-type row):**604>605> - **UI dominates** in CRUD/business apps — 1.5-3x backend (states, validation, responsive, a11y, polish)606> - **Backend dominates ONLY:** multi-aggregate invariants, cross-service contracts, schema migrations, heavy query/perf, new event flows607>608> **Reuse-vs-Create axis (PRIMARY lever, per layer):**609>610> | UI tier | Cost |611> | -------------------------------------------- | -------- |612> | Reuse component on existing screen | 0.1-0.3d |613> | Add control/column to existing screen | 0.3-0.8d |614> | Compose components into NEW screen | 1-2d |615> | NEW screen, custom layout/states/validation | 2-4d |616> | NEW shared/common component (themed, tested) | 3-6d+ |617>618> | Backend tier | Cost |619> | ---------------------------------------------------- | --------- |620> | Reuse query/handler from new place | 0.1-0.3d |621> | Small update existing handler/entity | 0.3-0.8d |622> | NEW query on existing repo/model | 0.5-1d |623> | NEW command/handler on existing aggregate (additive) | 1-2d |624> | NEW aggregate/entity (repo, validation, events) | 2-4d |625> | NEW cross-service contract OR schema migration | 2-4d each |626> | Multi-aggregate invariant / heavy domain rule | 3-5d |627>628> **Rule:** Sum tiers across UI+backend+tests, apply productivity factor. Reuse short-circuits tiers — call out.629>630> **Test-Scope drivers (compute test_count EXPLICITLY — "+tests" hand-wave is #1 failure):**631>632> | Driver | Count |633> | --------------------------------- | ------------------------------------------------------ |634> | Happy-path journeys | 1 per story / AC main flow |635> | State-machine transitions | reachable transitions × allowed actors |636> | Multi-entity state combos | state(A) × state(B) — REACHABLE only, not Cartesian |637> | Authorization matrix | (owner, non-owner, elevated, unauth) × each mutation |638> | Validation rules | 1 per required field / boundary / format / cross-field |639> | UI states (per new screen/dialog) | happy, loading, empty, error, partial — present only |640> | Negative paths / invariants | 1 per violatable business rule |641>642> | Test tier (Trad, incl. setup+assert+flake) | Cost |643> | ------------------------------------------ | -------- |644> | 1-5 cases, fixtures reused | 0.3-0.5d |645> | 6-12 cases, 1 new fixture | 0.5-1d |646> | 13-25 cases, multi-entity setup | 1-2d |647> | 26-50 cases OR new state-machine coverage | 2-3d |648> | >50 cases OR full E2E journey | 3-5d |649>650> **Test multipliers:** new fixture/seed harness +0.5d · cross-service/bus assertion +0.3d each · UI E2E ×1.5 · each new role +1-2 cases651>652> **Blast Radius (mandatory pre-pass — affects code AND test):**653>654> 1. Files/components directly modified — count655> 2. Of those, "complex" (>500 LOC, multi-handler, central, frequently-modified) — count656> 3. Downstream consumers (callers, event subscribers, cross-service) — list657> 4. Shared/common code touched (multi-app blast) — yes/no658> 5. Regression scope — areas needing re-test659>660> **Rule:** Complex touch → add `risk_factors`. Each downstream consumer → +1-3 regression cases. Blast >5 areas OR >2 complex → re-evaluate SPLIT before estimating.661>662> **Risk Margin (drives max bound):**663>664> | likely_days | Base margin |665> | ------------------- | ------------------------------- |666> | <1d trivial | +10% |667> | 1-2d small additive | +20% |668> | 3-4d real feature | +35% |669> | 5-7d large | +50% |670> | 8-10d very large | +75% |671> | >10d | +100% AND **flag SHOULD SPLIT** |672>673> **Risk-factor add-ons (additive — enumerate in `risk_factors`):**674>675> | Factor | +margin |676> | --------------------------------------------------------------------- | ------- |677> | `touches-complex-existing-feature` (>500 LOC, multi-handler, central) | +20% |678> | `cross-service-contract` change | +25% |679> | `schema-migration-on-populated-data` | +25% |680> | `new-tech-or-unfamiliar-pattern` | +30% |681> | `regression-fan-out` (≥3 downstream areas re-test) | +20% |682> | `performance-or-latency-critical` | +20% |683> | `concurrency-race-event-ordering` | +25% |684> | `shared-common-code` (multi-consumer/multi-app) | +25% |685> | `unclear-requirements-or-design` | +30% |686>687> **Collapse rule:** total margin >100% → STOP, split (padding past 2x is dishonesty). Margin <15% on `likely_days ≥5` → under-estimated, widen.688>689> **Work-Type Caps (hard ceilings on `likely_days`):**690> | Work type | Max SP | Max likely |691> | --- | --- | --- |692> | Single field / config flag / style fix | 1 | 0.5d |693> | Add property to existing model + bind to existing UI | 2 | 1d |694> | **Additive endpoint + minor UI control** (button/menu/column), reuses fixtures | **3** | **2-3d** |695> | Additive endpoint + **NEW UI surface** OR additive multi-layer + new domain rule + 2+ test files | 5 | 3-5d |696> | NEW model/aggregate OR migration OR cross-module contract OR heavy test (>1.5d) OR NEW UI + non-trivial backend | 8 | 5-7d |697> | NEW UI surface + (NEW aggregate OR migration OR cross-service contract) | 13 | SHOULD split |698> | Cross-service contract + migration combined | 13 | SHOULD split |699> | Beyond | 21 | MUST split |700>701> **SP→Days (validation only):** 1=0.5d/0.25d · 2=1d/0.35d · 3=2d/0.65d · 5=4d/1.0d · 8=6d/1.5d · 13=10d/2.0d (Trad/AI likely)702> **AI speedup:** SP 1≈2x · 2-3≈3x · 5-8≈4x · 13+≈5x. AI cost = `(code_gen × 1.3) + (test_gen × 1.3)` (30% review overhead).703>704> **MANDATORY frontmatter:**705>706> ```yaml707> story_points: <n>708> complexity: low | medium | high | critical709> man_days_traditional: '<min>-<max>d' # range when likely ≥3d; '<N>d' when <3d710> man_days_ai: '<min>-<max>d'711> risk_margin_pct: <n> # base + add-ons712> risk_factors: [touches-complex-existing-feature, regression-fan-out] # closed-list from add-ons; [] if none713> blast_radius:714> touched_areas: <n>715> complex_touched: <n>716> downstream_consumers: [list or count]717> shared_common_code: yes | no718> estimate_scope_included: [code, integration-tests, frontend, i18n, docs]719> estimate_scope_excluded: [unit-tests, e2e, perf, deployment, code-review-rounds]720> estimate_reasoning: |721> 5-7 lines covering:722> (a) UI tier — row applied723> (b) Backend tier — row applied724> (c) Test scope — case breakdown by driver, file count, fixtures, tier row725> (d) Cost driver — dominant tier + why726> (e) Blast radius — touched, complex, regression scope727> (f) Risk factors — list driving margin; why not larger/smaller728> Example: "UI: compose Form/Table/Dialog → NEW screen (~1.5d). Backend: NEW command on existing aggregate,729> reuses validation+repo (~1d). Tests: 4 transitions × 2 actors + 3 validation + 2 UI states = 13 cases,730> 1 new fixture → tier 13-25 ~1.5d. Driver: UI composition + new states. Blast: 4 areas, 1 complex.731> Risk: base 35% + touches-complex +20% = 55% → max 3.9d → range 2.5-4d."732> ```733>734> **Sanity self-check:**735>736> - `likely_days ≥3d` and single-point? → reject, must be range737> - Margin <15% on `likely_days ≥5d`? → under-estimated, widen738> - Margin >100%? → STOP, split instead of buffer739> - Complex existing feature touched, no regression budget in `(c)`? → reject740> - Blast `>5` areas OR `>2` complex, no split discussion? → reject741> - Purely additive on existing model AND existing UI? → cap SP 3 unless tests >1.5d742> - NEW UI surface (page/complex form/dashboard)? → SP 5+ even if backend one endpoint743> - Backend cross-service / migration / multi-aggregate? → SP 8+ regardless of UI744> - `bottom_up_hours / 6` vs SP-Days disagreement >50%? → trust bottom-up, downgrade SP745> - Without tests, SP drops ≥1 bucket? → tests dominate; state explicitly746> - Reasoning called out UI vs backend vs blast vs risk factors? → if missing, add747748<!-- /SYNC:estimation-framework -->749750<!-- SYNC:ui-system-context -->751752> **UI System Context** — For ANY task touching `.ts`, `.html`, `.scss`, or `.css` files:753>754> **MUST ATTENTION READ before implementing:**755>756> 1. `docs/project-reference/frontend-patterns-reference.md` — component base classes, stores, forms757> 2. `docs/project-reference/scss-styling-guide.md` — BEM methodology, SCSS variables, mixins, responsive758> 3. `docs/project-reference/design-system/README.md` — design tokens, component inventory, icons759>760> Reference `docs/project-config.json` for project-specific paths.761762<!-- /SYNC:ui-system-context -->763764<!-- SYNC:ui-wireframe -->765766> **UI Wireframe** — Process visual design input (Figma URLs, screenshots, wireframes) via appropriate tool BEFORE creating wireframes. Use box-drawing ASCII characters for spatial layout. Classify every component into exactly ONE tier: Common (cross-app reusable) / Domain-Shared (cross-domain) / Page (single-page). Duplicate UI code = wrong tier. Search existing component libraries before creating new (>=80% match = reuse). Detail level varies by skill (idea=rough, story=full decomposition).767768<!-- /SYNC:ui-wireframe -->769770<!-- SYNC:critical-thinking-mindset -->771772> **Critical Thinking Mindset** — Apply critical thinking, sequential thinking. Every claim needs traced proof,773774…(truncated)
Run npx skillmds@latest add duc01226/story-3 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
[Project Management] Use when creating user stories from PBIs, slicing features, or breaking down requirements. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: WARNING, Skill Scanner: PASS. Capability flags: reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
duc01226 (@duc01226) published this skill. Their other Agent Skills are listed on their SkillMD profile.