/auto
Automatically generate user stories from product artifacts like PRDs, mockups, API specs, or design documents. Saves time breaking down requirements into actionable stories.
Quick Start
/agileflow:auto SOURCE=<file-or-url> [EPIC=<EP-ID>] [AUTO_CREATE=no]Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
SOURCE | Yes | - | Path to file or URL (PRD, mockup, API spec, flow diagram) |
EPIC | No | Auto-generated | Associate stories with existing epic (e.g., EP-0010) |
OWNER | No | Auto-detected | Default owner for generated stories (e.g., AG-API) |
AUTO_CREATE | No | no | yes to create immediately, no for preview first |
Examples
Preview Stories from PRD
/agileflow:auto SOURCE=docs/requirements/auth-prd.mdReads the authentication requirements document and generates story preview without creating files.
Generate from API Specification
/agileflow:auto SOURCE=docs/api/openapi.json OWNER=AG-APIExtracts endpoints from OpenAPI/Swagger spec and generates one story per endpoint.
Generate from Figma Mockup
/agileflow:auto SOURCE=https://figma.com/file/abc123 AUTO_CREATE=noOCR's the mockup design to identify screens, forms, and interactions, then generates UI stories.
Generate and Create Immediately
/agileflow:auto SOURCE=docs/requirements/payment-prd.md EPIC=EP-0011 AUTO_CREATE=yesGenerates stories and creates all files immediately (skip preview step).
Supported Source Types
Product Requirements Document (PRD)
Formats: .md, .docx, .pdf, .txt
Extracts:
- Feature descriptions
- User personas and use cases
- Success criteria and metrics
- Edge cases and error scenarios
- Non-functional requirements
Example:
# User Authentication Feature
Users should be able to:
- Register with email and password
- Reset forgotten password via email
- Login with OAuth (Google, GitHub)
- Manage account settings
Requirements:
- Email verification required
- Password minimum 8 characters
- Session expires after 24 hoursGenerated Stories: 4-6 stories covering registration, login, password reset, OAuth, and session management.
API Documentation
Formats: OpenAPI/Swagger JSON, API docs .md
Extracts:
- Endpoints (HTTP method + path)
- Request/response schemas
- Authentication requirements
- Error codes and edge cases
- Rate limiting and quotas
Example OpenAPI:
paths:
/api/users:
post:
summary: Create user
requestBody:
schema:
properties:
name: string
email: stringGenerated Stories: One per endpoint with acceptance criteria from schema.
UI Mockups & Designs
Formats: Figma URL, .png/.jpg (with OCR), design spec .md
Extracts:
- Screen layouts and components
- User interactions and flows
- Form fields and validation
- Navigation and links
- Design system usage
Example: Screenshot of login form generates stories for form component, validation, error messages, and password reset link.
User Flow Diagrams
Formats: Mermaid .mmd, PlantUML, flow diagrams (.png with OCR)
Extracts:
- Steps in user journey
- Decision points and branches
- Alternative paths
- Success and failure scenarios
Example: Authentication flow diagram generates stories for each step.
Story Generation Process
Step 1: Analyze Source
- Identify document type
- Extract requirements and features
- Group related requirements
- Parse technical specifications
Step 2: Group Features
- Related requirements become one story
- Avoid story duplication
- Ensure stories are independent
- Check INVEST criteria
Step 3: Generate Stories
- Create title from feature description
- Write acceptance criteria in Given/When/Then format
- Estimate effort (0.5d, 1d, 1.5d, 2d)
- Assign appropriate owner
- Identify dependencies
Step 4: Show Preview
- Display all generated stories
- Show estimates and owners
- Show story count and total effort
- Ask for approval before creating
Step 5: Create Files (if approved)
- Create epic (if not provided)
- Create story files with templates
- Create test stubs
- Update status.json
- Append to bus/log.jsonl
Story Generation Rules (INVEST)
Generated stories follow INVEST criteria:
| Criterion | Description |
|---|---|
| Independent | Can be completed without other stories |
| Negotiable | Details can be adjusted after creation |
| Valuable | Delivers user-facing or team value |
| Estimable | Can be sized (0.5d-2d) |
| Small | Completable in one sprint |
| Testable | Has clear acceptance criteria |
Stories >2d are broken into smaller ones.
Estimation Guidelines
| Estimate | When to Use |
|---|---|
0.5d | Simple CRUD, form field, basic component |
1d | Standard feature, moderate complexity |
1.5d | Complex logic, multiple validations, integration |
2d | Significant refactor or major component |
>2d | Story will be broken into smaller ones |
Example: PRD to Stories
Input PRD
# User Authentication Feature
## Overview
Allow users to register, log in, and manage accounts.
## Requirements
- Users register with email and password
- Email verification required
- Password reset via email
- Login with OAuth (Google, GitHub)
- Session management and expiryGenerated Stories Preview
Story Generation Preview
Source: docs/requirements/auth-prd.md
Epic: EP-0010 (User Authentication) - CREATED
Stories: 5
1. US-0050: User registration (1.5d, AG-API)
"Users can register with email and password"
2. US-0051: Email verification (1d, AG-API)
"Verify email before allowing login"
3. US-0052: Password reset flow (1d, AG-API)
"Users can reset forgotten password"
4. US-0053: OAuth login - Google (1.5d, AG-API)
"Users can log in with Google account"
5. US-0054: OAuth login - GitHub (1.5d, AG-API)
"Users can log in with GitHub account"
Total Estimate: 6.5 days
Recommended Owner: AG-API
Create these stories? (YES/NO)Acceptance Criteria Generation
Stories are generated with Given/When/Then format:
## Acceptance Criteria
- Given a user on registration page
When they enter valid email and 8+ character password
Then account is created and verification email sent
- Given invalid password (< 8 characters)
When they try to submit
Then form shows "Password must be at least 8 characters"
- Given user opens verification email
When they click verification link
Then email is marked verified and login worksOutput Files
The command creates:
-
Epic file (
docs/05-epics/EP-XXXX.md)- Epic title and goal
- Source document reference
- Child stories list
-
Story files (
docs/06-stories/EP-XXXX/US-XXXX.md)- Generated content from source
- Acceptance criteria
- Technical notes
- Testing strategy
-
Test stubs (
docs/07-testing/test-cases/US-XXXX.md)- Test structure aligned with AC
- Placeholders for test implementation
-
Status tracking (
docs/09-agents/status.json)- All stories added with status:
ready
- All stories added with status:
-
Communication (
docs/09-agents/bus/log.jsonl)- Story generation event logged
Workflow
- Prepare source document - Ensure PRD/spec is complete
- Generate preview - Run
/autowithAUTO_CREATE=no - Review generated stories - Check accuracy and completeness
- Adjust if needed - Edit preview or regenerate with different parameters
- Create stories - Run with
AUTO_CREATE=yesor approve preview - Validate stories - Use
/story-validateon generated stories - Plan sprint - Include validated stories in
/sprint
Common Scenarios
Scenario: API has 15 endpoints
Problem: Too many stories (violates 0.5d-2d estimate rule)
Solution: Command automatically groups related endpoints:
- Endpoints for same resource (GET, POST, PATCH, DELETE) → One story
- List and detail endpoints → One story
- Authentication endpoints → One story
Result: 15 endpoints → 5-6 stories
Scenario: PRD has unclear requirements
Problem: Generated stories seem vague
Solution:
- Clarify PRD with stakeholders first
- Re-run
/autowith updated source - Or manually edit generated stories with
/story
Scenario: Generated stories don't match team velocity
Problem: Estimates seem too optimistic/pessimistic
Solution:
- Review stories and adjust estimates
- Consider team's historical velocity
- Run
/velocityto understand team capacity - Break large stories into smaller ones
Quality Checklist
Before approving generated stories:
- All stories have clear acceptance criteria
- Stories are independent (no hidden dependencies)
- Estimates are realistic (0.5d-2d range)
- Acceptance criteria uses Given/When/Then format
- Technical notes are accurate
- Stories cover main scenarios (happy path + edge cases)
- No stories are duplicated
- Epic goal is clear and specific
- Owner assignments are appropriate
Integration with Other Commands
- After generation: Use
/story-validateto ensure quality - Before sprint: Use
/sprintto select stories - For dependencies: Use
/depsif stories have relationships - During development: Use
/babysitfor implementation help - For testing: Use
/verifyto run tests
Best Practices
- Start with requirements - Invest time in clear PRD or spec
- Review generated stories - Don't blindly accept AI generation
- Validate before sprint - Use
/story-validateon all generated stories - Group related requirements - More focused epic = better stories
- Be specific in source - Vague requirements → vague stories
- Consider dependencies - Manual review for hidden dependencies
- Estimate conservatively - Add buffer for unknowns
Limitations & Considerations
- AI may misinterpret - Review generated stories for accuracy
- Context matters - Generated stories may lack domain knowledge
- Dependencies are manual - Add cross-story dependencies manually
- Estimates vary by team - Adjust based on your velocity
- Technical details - May need manual additions to Architecture Context
Related Commands
/epic- Create epics manually if needed/story- Create or edit individual stories/story-validate- Validate generated quality/sprint- Plan sprints with generated stories/deps- Visualize dependencies after generation
On This Page
/autoQuick StartParametersExamplesPreview Stories from PRDGenerate from API SpecificationGenerate from Figma MockupGenerate and Create ImmediatelySupported Source TypesProduct Requirements Document (PRD)API DocumentationUI Mockups & DesignsUser Flow DiagramsStory Generation ProcessStep 1: Analyze SourceStep 2: Group FeaturesStep 3: Generate StoriesStep 4: Show PreviewStep 5: Create Files (if approved)Story Generation Rules (INVEST)Estimation GuidelinesExample: PRD to StoriesInput PRDGenerated Stories PreviewAcceptance Criteria GenerationOutput FilesWorkflowCommon ScenariosScenario: API has 15 endpointsScenario: PRD has unclear requirementsScenario: Generated stories don't match team velocityQuality ChecklistIntegration with Other CommandsBest PracticesLimitations & ConsiderationsRelated Commands