Create detailed, implementation-ready stories for brownfield projects where traditional sharded PRD/architecture documents may not exist. This task bridges the gap between various documentation formats (document-project output, brownfield PRDs, epics, or user documentation) and executable stories for the Dev agent.
Use this task when:
Use create-next-story when:
Check for available documentation in this order:
Sharded PRD/Architecture (docs/prd/, docs/architecture/)
Brownfield Architecture Document (docs/brownfield-architecture.md or similar)
Brownfield PRD (docs/prd.md)
Epic Files (docs/epics/ or similar)
User-Provided Documentation
Based on available documentation:
CRITICAL: For brownfield stories, you MUST gather enough context for safe implementation. Be prepared to ask the user for missing information.
Required Information Checklist:
If any required information is missing, list the missing information and ask the user to provide it.
If using brownfield-architecture.md from document-project:
If using brownfield PRD:
Ask the user to help identify:
Start with the story template, filling in what's known:
# Story {{Enhancement Title}}
## Status: Draft
## Story
As a {{user_type}},
I want {{enhancement_capability}},
so that {{value_delivered}}.
## Context Source
- Source Document: {{document name/type}}
- Enhancement Type: {{single feature/bug fix/integration/etc}}
- Existing System Impact: {{brief assessment}}
Critical: For brownfield, ALWAYS include criteria about maintaining existing functionality
Standard structure:
Critical: This is where you'll need to be interactive with the user if information is missing
Create Dev Technical Guidance section with available information:
## Dev Technical Guidance
### Existing System Context
[Extract from available documentation]
### Integration Approach
[Based on patterns found or ask user]
### Technical Constraints
[From documentation or user input]
### Missing Information
Critical: List anything you couldn't find that dev will need and ask for the missing information
### 4. Task Generation with Safety Checks
#### 4.1 Generate Implementation Tasks
Based on gathered context, create tasks that:
- Include exploration tasks if system understanding is incomplete
- Add verification tasks for existing functionality
- Include rollback considerations
- Reference specific files/patterns when known
Example task structure for brownfield:
```markdown
## Tasks / Subtasks
- [ ] Task 1: Analyze existing {{component/feature}} implementation
- [ ] Review {{specific files}} for current patterns
- [ ] Document integration points
- [ ] Identify potential impacts
- [ ] Task 2: Implement {{new functionality}}
- [ ] Follow pattern from {{example file}}
- [ ] Integrate with {{existing component}}
- [ ] Maintain compatibility with {{constraint}}
- [ ] Task 3: Verify existing functionality
- [ ] Test {{existing feature 1}} still works
- [ ] Verify {{integration point}} behavior unchanged
- [ ] Check performance impact
- [ ] Task 4: Add tests
- [ ] Unit tests following {{project test pattern}}
- [ ] Integration test for {{integration point}}
- [ ] Update existing tests if needed
```
CRITICAL: for brownfield - always include risk assessment
Add section for brownfield-specific risks:
## Risk Assessment
### Implementation Risks
- **Primary Risk**: {{main risk to existing system}}
- **Mitigation**: {{how to address}}
- **Verification**: {{how to confirm safety}}
### Rollback Plan
- {{Simple steps to undo changes if needed}}
### Safety Checks
- [ ] Existing {{feature}} tested before changes
- [ ] Changes can be feature-flagged or isolated
- [ ] Rollback procedure documented
Before finalizing:
Completeness Check:
Safety Check:
Information Gaps:
Save the story with appropriate naming:
docs/stories/epic-{n}-story-{m}.mddocs/stories/brownfield-{feature-name}.mdInclude header noting documentation context:
# Story: {{Title}}
<!-- Source: {{documentation type used}} -->
<!-- Context: Brownfield enhancement to {{existing system}} -->
## Status: Draft
[Rest of story content...]
Provide clear handoff to the user:
Brownfield story created: {{story title}}
Source Documentation: {{what was used}}
Story Location: {{file path}}
Key Integration Points Identified:
- {{integration point 1}}
- {{integration point 2}}
Risks Noted:
- {{primary risk}}
{{If missing info}}:
Note: Some technical details were unclear. The story includes exploration tasks to gather needed information during implementation.
Next Steps:
1. Review story for accuracy
2. Verify integration approach aligns with your system
3. Approve story or request adjustments
4. Dev agent can then implement with safety checks
The brownfield story creation is successful when: