<!-- SpecPulse Specification Template v4.0 - AI-Optimized -->
<!-- AI Instructions:
    1. Replace all {{variable}} placeholders with actual values
    2. Fill sections based on user input and requirements analysis
    3. Mark ALL uncertainties with [NEEDS CLARIFICATION: specific question]
    4. Keep requirements testable and unambiguous
    5. Focus on WHAT and WHY, not HOW
-->

# Specification: {{ feature_name }}

## Metadata
- **ID**: SPEC-{{ feature_id }}
- **Branch**: {{ branch_name }}
- **Created**: {{ date }}
- **Author**: {{ author }}
- **AI Assistant**: {{ ai_assistant }}
- **Version**: 1.0.0
- **Status**: DRAFT

## Executive Summary
{{ executive_summary | default("Brief description of what this feature does and why it's needed") }}

## User Request
```
{{ user_input }}
```

## Problem Statement

### Current State
{{ current_state | default("Describe the current situation and pain points") }}

### Desired State  
{{ desired_state | default("Describe what should be achieved after implementation") }}

## Clarifications Needed
<!-- List ALL ambiguities from user input -->
{% if clarifications %}
{% for clarification in clarifications %}
- [NEEDS CLARIFICATION: {{ clarification }}]
{% endfor %}
{% else %}
- [NEEDS CLARIFICATION: Add specific questions based on user input]
{% endif %}

## User Stories

### Primary Stories
{% for story in user_stories %}
#### Story {{ loop.index }}: {{ story.title }}
**As a** {{ story.user_type }}
**I want to** {{ story.action }}
**So that** {{ story.benefit }}

**Acceptance Criteria:**
{% for criteria in story.acceptance_criteria %}
- Given {{ criteria.given }}, when {{ criteria.when }}, then {{ criteria.then }}
{% endfor %}
{% endfor %}

## Functional Requirements

### MUST Have Requirements
{% for req in must_requirements %}
**FR-{{ "%03d" | format(loop.index0 + 1) }}**: {{ req.statement }}
- **Rationale**: {{ req.rationale }}
- **Testable**: Yes
{% endfor %}

### SHOULD Have Requirements
{% for req in should_requirements %}
**FR-{{ "%03d" | format(loop.index0 + len(must_requirements) + 1) }}**: {{ req.statement }}
- **Rationale**: {{ req.rationale }}
- **Testable**: Yes
{% endfor %}

## Non-Functional Requirements

### Performance
- Response time < {{ performance.response_time | default("200ms") }}
- Support {{ performance.concurrent_users | default("1000") }} concurrent users

### Security
- All data encrypted in transit
- {{ security.authentication | default("Authentication required for sensitive actions") }}

## Acceptance Scenarios

### Critical Path
1. **Scenario**: {{ primary_scenario.name }}
   - **When**: {{ primary_scenario.action }}
   - **Then**: {{ primary_scenario.result }}

### Error Cases
1. **Scenario**: {{ error_scenario.name }}
   - **When**: {{ error_scenario.action }}
   - **Then**: {{ error_scenario.result }}

## Success Metrics
- Adoption rate: {{ metrics.adoption_rate | default("80% within 30 days") }}
- Success rate: {{ metrics.success_rate | default("95% of attempts") }}
- User satisfaction: {{ metrics.satisfaction | default("8/10 NPS") }}

## Out of Scope
<!-- Explicitly state what this feature will NOT do -->
{% for item in out_of_scope %}
- This feature will NOT {{ item }}
{% endfor %}

## Dependencies
{% for dep in dependencies %}
- {{ dep }}
{% endfor %}

## Validation Checklist
- [ ] All MUST requirements implemented
- [ ] All acceptance criteria pass
- [ ] No [NEEDS CLARIFICATION] markers remain
- [ ] Performance targets met
- [ ] Security requirements validated

---
**Generated by**: {{ ai_assistant }} on {{ date }}
**Next Steps**: Use `/sp-plan generate` to create implementation plan