# /create-next-story Task

When this command is used, execute the following task:

---
docOutputLocation: .vcsys/stories/story-[auto-increment].yaml
template: ".vcsys/templates/story-tmpl.yaml"
---

# Create Next Story Task

Create comprehensive user stories following VC-SYS methodology with proper validation and prioritization.

## Purpose

This task creates well-structured user stories that:

- Follow VC-SYS story template structure
- Include comprehensive acceptance criteria
- Define clear implementation guidance
- Establish proper agent permissions and workflows
- Support systematic story validation and completion

## Process

### Step 1: Story Type Classification

Present these numbered options to determine story type:

1. **Feature Story** - New functionality for end users
2. **Technical Story** - Infrastructure, refactoring, or technical debt
3. **Bug Story** - Defect resolution and fixes
4. **Research Story** - Investigation, analysis, or proof of concept
5. **Integration Story** - External system connections or API work
6. **UI/UX Story** - Interface improvements and user experience
7. **Security Story** - Security enhancements or vulnerability fixes
8. **Performance Story** - Optimization and performance improvements
9. **Documentation Story** - Documentation creation or updates

### Step 2: Story Information Gathering

**Core Information (Always Required):**

1. **Story Title**: Clear, concise description (50 characters max)
2. **User Type**: Who benefits from this story?
3. **User Goal**: What does the user want to accomplish?
4. **Business Value**: Why is this important?
5. **Priority**: High/Medium/Low with justification

**Context Questions (Based on Story Type):**

**For Feature Stories:**
- What specific user need does this address?
- How does this fit into the overall user journey?
- Are there any UI/UX requirements?
- What are the key user interactions?

**For Technical Stories:**
- What technical problem does this solve?
- How does this improve the system?
- Are there architectural implications?
- What are the technical constraints?

**For Bug Stories:**
- What is the current incorrect behavior?
- What should the correct behavior be?
- How to reproduce the issue?
- What is the impact on users?

### Step 3: Story Structure Creation

#### A. Story Header Section

```yaml
story-id: "STORY-[YYYY-MM-DD]-[###]"
title: "[Concise story title]"
type: "[Feature|Technical|Bug|Research|Integration|UI/UX|Security|Performance|Documentation]"
priority: "[High|Medium|Low]"
estimate: "[T-shirt size: XS|S|M|L|XL]"
status: "ready-for-development"

agents:
  owner: "scrum-master"
  editors: ["developer", "qa", "product-owner"]
  readonly: []
```

#### B. User Story Statement

**Standard Format:**
```
As a [user type]
I want [goal/desire]
So that [business value/reason]
```

**Technical Story Format:**
```
As a [developer/system/stakeholder]
I need [technical capability]
So that [technical benefit/business value]
```

#### C. Acceptance Criteria

**Scenario-Based Criteria:**
```yaml
acceptance-criteria:
  - scenario: "Happy path scenario"
    given: "Initial conditions"
    when: "User action"
    then: "Expected result"
    
  - scenario: "Edge case scenario"
    given: "Edge case conditions"
    when: "User action"
    then: "Expected handling"
    
  - scenario: "Error handling scenario"
    given: "Error conditions"
    when: "User action"
    then: "Graceful error handling"
```

**Definition of Done Checklist:**
```yaml
definition-of-done:
  functional:
    - [ ] All acceptance criteria met
    - [ ] User can complete intended workflow
    - [ ] Edge cases handled appropriately
    - [ ] Error handling implemented
    
  technical:
    - [ ] Code follows project standards
    - [ ] Unit tests written and passing
    - [ ] Integration tests written and passing
    - [ ] Code reviewed and approved
    
  quality:
    - [ ] No critical security vulnerabilities
    - [ ] Performance meets requirements
    - [ ] Accessibility guidelines followed (if UI)
    - [ ] Documentation updated
```

#### D. Implementation Guidance

```yaml
implementation-notes:
  technical-approach: "[High-level technical approach]"
  key-components: 
    - "[Component 1 and purpose]"
    - "[Component 2 and purpose]"
  dependencies:
    - "[Internal dependency]"
    - "[External dependency]"
  risks-and-mitigations:
    - risk: "[Potential risk]"
      mitigation: "[Mitigation strategy]"
```

#### E. Agent Workflow Sections

```yaml
# Tasks/Subtasks (Developer updates checkboxes only)
tasks:
  - [ ] Analyze requirements and technical approach
  - [ ] Create/update data models if needed
  - [ ] Implement core functionality
  - [ ] Create comprehensive tests
  - [ ] Handle edge cases and error scenarios
  - [ ] Update documentation
  - [ ] Perform self-review and validation

# Dev Agent Record (Developer updates only)
dev-agent-record:
  implementation-approach: ""
  key-decisions: ""
  challenges-encountered: ""
  testing-strategy: ""

# File List (Developer updates only)
files-created: []
files-modified: []

# Change Log (Developer updates only)
change-log: []

# QA Results (QA Agent updates only)
qa-results:
  review-completed: false
  code-quality-score: ""
  test-coverage: ""
  issues-found: []
  recommendations: []

# Status (Multiple agents can update)
status: "ready-for-development"
```

### Step 4: Story Validation

Apply the Story Draft Validation Checklist:

1. **Clarity Check**
   - User story statement is clear and complete
   - Acceptance criteria are specific and testable
   - Implementation guidance provides sufficient direction

2. **Completeness Check**
   - All required sections populated
   - Agent permissions properly defined
   - Dependencies identified

3. **Quality Check**
   - Story size is appropriate (not too large/small)
   - Business value is clearly articulated
   - Technical feasibility considered

4. **Consistency Check**
   - Follows VC-SYS story template structure
   - Aligns with project standards and conventions
   - Priority justified and appropriate

### Step 5: Story File Generation

**File Naming Convention:**
- `story-[YYYY-MM-DD]-[###].yaml`
- Auto-increment number based on existing stories
- Store in `.vcsys/stories/` directory

**Template Application:**
- Use story-tmpl.yaml as base structure
- Populate with gathered information
- Ensure all required sections included
- Validate YAML syntax

### Step 6: Integration Points

**Backlog Integration:**
- Add story ID to project backlog
- Update story status tracking
- Link to related stories or epics

**Agent Workflow Setup:**
- Verify agent permissions are correct
- Ensure developer can access appropriate sections
- Confirm QA agent has review permissions

## Advanced Story Creation Options

### Epic Breakdown

When creating stories from epics:

1. **Epic Analysis**
   - Review epic scope and objectives
   - Identify natural story boundaries
   - Consider user workflow progression
   - Plan story dependencies

2. **Story Sequencing**
   - Order stories logically
   - Identify prerequisite stories
   - Plan incremental value delivery
   - Consider testing and integration needs

### Story Splitting Techniques

When stories are too large:

1. **Workflow Splitting**
   - Separate different user workflows
   - Create stories for each major step
   - Maintain end-to-end functionality

2. **CRUD Splitting**
   - Create separate stories for Create, Read, Update, Delete
   - Prioritize based on user needs
   - Ensure consistent data handling

3. **Happy Path vs Edge Cases**
   - Start with core happy path functionality
   - Add stories for edge cases and error handling
   - Maintain user value in each story

### Cross-Functional Considerations

**UI/UX Stories:**
- Include wireframes or design references
- Specify accessibility requirements
- Define responsive behavior
- Consider user testing needs

**Security Stories:**
- Include threat modeling results
- Specify security testing requirements
- Document compliance needs
- Consider privacy implications

**Performance Stories:**
- Define performance benchmarks
- Specify load testing requirements
- Consider scalability implications
- Document monitoring needs

## Quality Gates

Before story creation completion:

- [ ] Story follows template structure exactly
- [ ] All required information gathered and documented
- [ ] Acceptance criteria are testable and complete
- [ ] Implementation guidance provides clear direction
- [ ] Agent permissions and workflows configured
- [ ] Story validation checklist completed
- [ ] File naming and location follows conventions
- [ ] YAML syntax is valid

## Integration with Other Tasks

**From Brainstorming:**
- Use brainstorming results to identify story themes
- Convert creative ideas into implementable stories
- Ensure innovative approaches captured

**From Research:**
- Incorporate research findings into story requirements
- Use validation insights for acceptance criteria
- Apply market insights to prioritization

**To Development:**
- Stories ready for developer agent consumption
- Clear implementation guidance provided
- Proper workflow permissions established

**To QA:**
- Testable acceptance criteria defined
- Quality gates and DoD established
- Review workflow permissions configured