OpenSpec is a spec-driven development methodology where:
- Specs (
openspec/specs/) — are the source of truth about what is ALREADY built - Changes (
openspec/changes/) — are proposals about what SHOULD change - Development process goes through three clear stages: Proposal → Implementation → Archive
This ensures:
- ✅ Changes transparency
- ✅ Quality control through review
- ✅ Documentation and code synchronization
- ✅ History of all architectural decisions
✅ Create a proposal if:
- Adding new features or functionality
- Making breaking changes (API, DB schema)
- Changing architecture or patterns
- Optimizing performance (behavior changes)
- Updating security patterns
❌ DON'T create a proposal if:
- Fixing bugs (restoring intended behavior)
- Fixing typos, formatting, comments
- Updating dependencies (non-breaking)
- Changing configuration
- Adding tests for existing behavior
Step 1: Study context
openspec list # What's already in progress?
openspec list --specs # What capabilities exist?Step 2: Choose unique change-id (kebab-case, verb at the start)
- Examples:
add-two-factor-auth,update-card-schema,remove-old-api - Use prefixes:
add-,update-,remove-,refactor-
Step 3: Create structure in openspec/changes/[change-id]/:
openspec/changes/add-card-batch-import/
├── proposal.md # Why and what we're changing
├── tasks.md # Implementation checklist
├── design.md # (optional) Technical solutions
└── specs/ # Specification delta changes
└── cards/
└── spec.md # ADDED/MODIFIED/REMOVED Requirements
Step 4: Write spec deltas (specification changes)
Delta file format:
## ADDED Requirements
### Requirement: Batch Card Import
The system SHALL allow importing multiple cards from CSV.
#### Scenario: Successful import
- **WHEN** user uploads valid CSV file
- **THEN** all cards are created in the course
## MODIFIED Requirements
### Requirement: Card Creation API
[Complete updated requirement content with all scenarios]
## REMOVED Requirements
### Requirement: Old Single Import
**Reason**: Replaced by batch import
**Migration**: Use new batch endpointCritically important:
- Each requirement MUST have at least one
#### Scenario: - Scenarios use 4 hashtags (
####) - In
MODIFIEDwrite COMPLETE requirement content, not just changes
Step 5: Validate
openspec validate [change-id] --strictStep 6: Request approval
🚨 AI agent does NOT start implementation until developer approves the proposal!
After proposal approval:
- ✅ Read
proposal.md— what we're building - ✅ Read
design.md(if exists) — technical solutions - ✅ Read
tasks.md— task checklist - ✅ Implement tasks sequentially (in order)
- ✅ Confirm completion — verify everything is ready
- ✅ Update checklist — mark
- [x]only after complete finish - ✅ After implementation, validate all code (linting, tests)
Workflow command for AI agent:
/openspec-apply [change-id]
After deployment (when changes work in production):
- Move
changes/[name]/→changes/archive/YYYY-MM-DD-[name]/ - Update
specs/— apply deltas to main specifications - Validate archive:
openspec validate --strictWorkflow command:
/openspec-archive [change-id]
- Requests feature — "Add card import from CSV"
- Approves proposal — checks that requirements are understood correctly
- Checks result — tests implementation
- Triggers archiving — when feature is deployed
- Creates proposal with detailed description of changes
- Waits for approval — doesn't code without "OK"
- Implements according to tasks.md — sequentially, updating checklists
- Synchronizes documentation — updates
docs/Changelog.md,docs/Walkthrough.md - Archives changes — after developer's command
# What's currently in progress?
openspec list
# What capabilities already exist?
openspec list --specs
# View proposal details
openspec show [change-id]
# View specific specification
openspec show [spec-id] --type spec
# Validate proposal
openspec validate [change-id] --strict
# Validate all changes
openspec validate --strict# Create new proposal
/openspec-proposal
# Implement approved proposal
/openspec-apply [change-id]
# Archive after deployment
/openspec-archive [change-id]
openspec/
├── project.md # Project conventions
├── AGENTS.md # Detailed instructions for AI
├── specs/ # Source of truth — what is BUILT
│ └── [capability]/
│ ├── spec.md # Requirements and Scenarios
│ └── design.md # Technical patterns
└── changes/ # Proposals — what SHOULD change
├── [change-name]/
│ ├── proposal.md # Why and what
│ ├── tasks.md # Checklist
│ ├── design.md # Technical solutions (optional)
│ └── specs/
│ └── [capability]/spec.md # Deltas
└── archive/ # Completed changes
└── YYYY-MM-DD-[change-name]/
"Need to add card import from CSV file"
"Will create proposal for
add-card-csv-import. Wait, studying existing specs..."
Then creates:
openspec/changes/add-card-csv-import/proposal.mdopenspec/changes/add-card-csv-import/tasks.mdopenspec/changes/add-card-csv-import/specs/cards/spec.md
And says:
"✅ Proposal ready! Check
proposal.mdandtasks.md. If everything is OK — say 'approve', and I'll start implementation."
"approve" (or "approve")
✅ 1.1 Create CSV parser service
✅ 1.2 Add import endpoint to Cards API
✅ 1.3 Create frontend upload component
✅ 1.4 Write tests
And updates docs/Changelog.md, docs/Walkthrough.md
"/openspec-archive add-card-csv-import"
- Moves to
changes/archive/2026-01-06-add-card-csv-import/ - Updates
specs/cards/spec.mdwith new requirements - Validates everything via
--strict
#### Scenario: User imports valid CSV
- **WHEN** user uploads CSV with 10 cards
- **THEN** all 10 cards are created
- **AND** success notification is shown- **Scenario: Import CSV** ❌ (bullet)
**Scenario**: Import CSV ❌ (bold label)
### Scenario: Import CSV ❌ (3 hashtags)Use for new capabilities that can exist independently.
## ADDED Requirements
### Requirement: CSV Batch Import
The system SHALL support importing multiple cards from CSV files.
#### Scenario: Valid CSV upload
- **WHEN** user uploads valid CSV
- **THEN** all cards are createdUse for changing existing behavior.
IMPORTANT: copy COMPLETE requirement content from openspec/specs/[capability]/spec.md,
then edit.
## MODIFIED Requirements
### Requirement: Card Creation
[Complete requirement content + all its scenarios]Use for removing obsolete features.
## REMOVED Requirements
### Requirement: Single Card Import
**Reason**: Replaced by batch import API
**Migration**: Use POST /api/cards/batch endpointUse only for renaming without logic changes.
## RENAMED Requirements
- FROM: `### Requirement: Login`
- TO: `### Requirement: User Authentication`- Specs = Source of Truth — always sync specifications with code
- No implementation without approval — AI doesn't code without proposal approval
- Strict validation — always check via
--strictbefore commit - Sequential tasks — tasks are executed in order, marked after completion
- At least one scenario — each requirement must have at least one scenario
- By default <100 lines of new code
- Implementation in one file until proven need for separation
- Avoid frameworks without clear justification
- Choose proven, boring patterns
Add complexity only when:
- Performance data showing current solution is too slow
- Specific scale requirements (> 1000 users, > 100MB data)
- Multiple proven use cases requiring abstraction
- Use
file.ts:42format for code references - Reference specifications as
specs/auth/spec.md - Link related changes and PRs
- Use verb-noun:
user-auth,payment-capture - One goal per capability
- 10-minute clarity rule
- Split if description requires "AND"
- Use kebab-case, short and descriptive:
add-two-factor-auth - Prefer verb prefixes:
add-,update-,remove-,refactor- - Ensure uniqueness; if taken, add
-2,-3, etc.
- Check that
changes/[name]/specs/exists with .md files - Ensure files have operations (## ADDED Requirements)
- Check that scenarios use
#### Scenario:format (4 hashtags) - Don't use bullet points or bold for scenario headers
- Exact format required:
#### Scenario: Name - For debugging:
openspec show [change] --json --deltas-only
# Always use strict mode for comprehensive checks
openspec validate [change] --strict
# Debug delta parsing
openspec show [change] --json | jq '.deltas'
# Check specific requirement
openspec show [spec] --json -r 1- Detailed instructions: see
openspec/AGENTS.md - Project conventions: see
openspec/project.md - Workflow commands: see
.agent/workflows/openspec-*.md
Remember: Specs are truth. Changes are proposals. Keep them synchronized! 🚀