OpenSpec and Spec-Driven Development: A Practical Guide
Introduction: The Problem with âVibe Codingâ
Weâve all been there. You open your AI coding assistant with a brilliant idea, type âbuild me a user authentication system,â and watch as it generates hundreds of lines of code. It looks impressive. It compiles. But when you start testing, you realize it doesnât quite match what you had in mind. The session context is polluted, the AI has made assumptions you didnât agree to, and youâre left refactoring code that was written without a clear plan.
This is the trap of what some call âvibe codingââletting the AI drive without a shared understanding of the destination. The result? Unpredictable outcomes, misaligned expectations, and technical debt that accumulates faster than you can address it.
Enter Spec-Driven Development (SDD)âa methodology that brings structure and intentionality to AI-assisted coding by establishing clear specifications before a single line of code is written.
Part 1: Understanding Spec-Driven Development
What is Spec-Driven Development?
Spec-Driven Development (SDD) is an approach where you write structured specifications before writing code with AI assistance. Think of it as âdocumentation-firstâ development. The specification becomes a contract between you and the AIâa shared source of truth that describes what needs to be built, why it matters, and how it should behave.
At its core, SDD addresses a fundamental challenge in AI-assisted coding: alignment. Without a spec, youâre asking an AI to read your mind. With a spec, youâre providing a blueprint that both you and the AI can reference, refine, and validate against.
As the SDD philosophy states:
âIn this new world, maintaining software means evolving specifications. The lingua franca of development moves to a higher level, and code is the last-mile approach.â
What Makes a Good Spec?
A spec in SDD is not just a lengthy documentâitâs a structured, behavior-oriented artifact written in natural language. Good specs:
- Describe intent, not implementation: They focus on what the system should do and why, not how it should be coded
- Use structured formats: Gherkin-style scenarios (GIVEN/WHEN/THEN), user stories (As a⊠I want⊠So thatâŠ), and acceptance criteria
- Are reviewable: They can be read, understood, and approved before code generation begins
- Capture requirements: They document the problem space clearly enough that multiple developers (or AI agents) could implement them consistently
Example spec format:
### Feature: User Authentication
**User Story:**As a registered user, I want to log in with my email and passwordso that I can access my personalized dashboard.
**Acceptance Criteria:**- GIVEN a user with valid credentials WHEN they submit the login form THEN they receive an authentication token AND are redirected to the dashboard
- GIVEN a user with invalid credentials WHEN they submit the login form THEN they see an error message AND the login attempt is logged for security reviewThe Three Levels of SDD
SDD exists on a spectrum of implementation maturity:
Level 1: Spec-First
At this level, you write a well-thought-out spec for a specific task or user story, use it during the AI-assisted development workflow, and then discard it once the task is complete.
Use case: Small features, bug fixes, one-off changes where the spec doesnât need long-term maintenance.
Level 2: Spec-Anchored
Here, the spec is preserved after the task is complete and continues to be used for the evolution and maintenance of that feature. The spec becomes a living document that you update as the code changes.
Use case: Core features that will be iteratively improved, team projects where specs serve as documentation, brownfield development.
Level 3: Spec-as-Source
At this level, the spec is the primary artifact that humans maintain and edit. The code is generated from the spec and marked as âdo not editââhumans never touch the code directly, only the spec.
Use case: Highly structured domains, API contracts, configuration files, scenarios where consistency across implementations is critical.
Most SDD implementations today operate at Level 1 or Level 2. Level 3 is still experimental and resembles earlier attempts at model-driven development, though modern LLMs make it more flexible.
SDD vs Traditional Approaches
| Approach | Primary Artifact | When to Use | AI Suitability |
|---|---|---|---|
| Traditional | Code | Well-understood domains, solo developers | LowâAI must infer intent from existing code |
| TDD | Tests | Logic-heavy features, regression prevention | MediumâAI can generate tests, but intent still unclear |
| BDD | Feature specs | Team collaboration, stakeholder alignment | Highânatural language specs align well with LLMs |
| SDD | Comprehensive specs | Complex features, long-term maintenance, AI collaboration | Very Highâspecs provide the context AI needs |
SDD isnât waterfall rebornâitâs an iterative, fluid approach. You donât write a complete specification for an entire application upfront. Instead, you write specs for individual features or changes, implement them, and then move to the next spec.
Why SDD Matters in the AI Coding Era
AI coding assistants are powerful but unpredictable when requirements live only in chat history or the developerâs head. SDD adds a lightweight spec layer that ensures:
- Agreement before building: Human and AI align on specs before code gets written
- Reduced hallucinations: Clear constraints and acceptance criteria guide the AI
- Reviewable intent: Code reviewers can understand what was supposed to happen, not just what was coded
- Maintainable knowledge: Specs capture the âwhyâ behind decisions, persisting beyond the current chat session
Part 2: Meet OpenSpec
What is OpenSpec?
OpenSpec is a lightweight, open-source framework that implements Spec-Driven Development principles. Created by Fission AI, itâs designed to bring structure to AI-assisted coding without the ceremony of heavyweight tools.
Key characteristics:
- Universal: Works with 20+ AI coding assistants (Claude Code, Cursor, Codex, GitHub Copilot, Opencode, and more)
- Open source: MIT licensed, community-driven
- No lock-in: No API keys required, no proprietary formats, no MCP dependencies
- Lightweight: Minimal setup, intuitive commands, organized folder structure
OpenSpecâs philosophy:
â fluid not rigidâ iterative not waterfallâ easy not complexâ built for brownfield not just greenfieldâ scalable from personal projects to enterprisesHow OpenSpec Implements SDD
OpenSpec organizes each change into a dedicated folder with structured artifacts:
openspec/âââ changes/ âââ your-feature-name/ âââ proposal.md # Why we're doing this, what's changing âââ specs/ # Requirements and scenarios âââ design.md # Technical approach âââ tasks.md # Implementation checklistThe OpenSpec workflow mirrors SDD principles:
- Propose (
/opsx:propose): Create a proposal and spec for a change - Apply (
/opsx:apply): Implement the tasks defined in the spec - Archive (
/opsx:archive): Preserve the spec when complete
Spec deltas: OpenSpec captures changes to requirements as âspec deltasââdiffs that show how intent has evolved. This makes it easy for developers to understand how theyâre modifying the system at a high level, without diving into implementation details.
OpenSpec vs Alternatives
vs GitHub Spec-kit:
- Spec-kit is thorough but heavyweight, with rigid phase gates and extensive markdown files
- OpenSpec is lighter and lets you iterate freely between phases
- Spec-kit requires Python setup; OpenSpec is Node.js-based and simpler to install
vs Kiro:
- Kiro is powerful but locks you into their VS Code distribution and Claude models
- OpenSpec works with the tools you already use and supports multiple AI assistants
- Kiro has a prescribed workflow; OpenSpec offers both simple and expanded workflows
vs Nothing (raw AI coding):
- Without specs, youâre relying on chat history and vague prompts
- OpenSpec brings predictability and structure without adding bureaucracy
While OpenSpec works with many tools, I personally prefer using it with Opencode because of its terminal-based approach, which aligns well with OpenSpecâs lightweight philosophy. The combination gives you speed, flexibility, and structure without IDE lock-in.
Part 3: Quick Start Guide
Installation & Setup
Requirements:
- Node.js 20.19.0 or higher
- npm, pnpm, yarn, or bun
Installation:
# Install OpenSpec globallynpm install -g @fission-ai/openspec@latest
# Verify installationopenspec --versionInitialize in your project:
cd your-project-directoryopenspec initThis creates the .openspec/ directory structure and configures your AI assistant with the necessary slash commands.
Your First Spec: The Propose Workflow
The simplest way to use OpenSpec is the three-step propose workflow:
Step 1: Create a proposal
Tell your AI assistant:
/opsx:propose "add dark mode support to the application"OpenSpec will create a folder at openspec/changes/add-dark-mode/ containing:
- proposal.md: Explains why dark mode is needed, the scope, and success criteria
- specs/: Directory with requirement files
- Functional requirements (what dark mode should do)
- Scenarios (GIVEN/WHEN/THEN acceptance criteria)
- Edge cases and constraints
- design.md: Technical approach, component changes, state management strategy
- tasks.md: Checklist of implementation steps with tracking
Step 2: Review the artifacts
Read through the generated files. Do they capture your intent? Are the requirements clear? This is your chance to refine the spec before implementation begins.
You can edit any of these files directlyâthe spec is yours to shape.
Step 3: Apply the spec
Once youâre satisfied with the proposal:
/opsx:applyYour AI assistant will:
- Read the tasks.md checklist
- Implement each task in order
- Mark tasks as complete
- Report progress
You can review each change as itâs made, request adjustments, or refine the spec mid-implementation.
Step 4: Archive when complete
When all tasks are done:
/opsx:archiveThis moves the spec to openspec/changes/archive/ with a timestamp, preserving it for future reference while keeping your workspace clean for the next feature.
Part 4: OpenSpec Workflows Explained
Simple Workflow: Propose â Apply â Archive
Best for: Bug fixes, small features, tweaks, experiments
This is the workflow described above. Itâs lightweight and fastâperfect when you donât need extensive planning.
Example:
You: /opsx:propose "fix the login error message"AI: Created openspec/changes/fix-login-error/ â proposal.md â clarify error message requirements â specs/ â scenarios for different error cases â tasks.md â 2 implementation tasks
You: /opsx:applyAI: â Task 1.1: Update error message in auth middleware â Task 1.2: Add client-side error display All tasks complete!
You: /opsx:archiveAI: Archived to openspec/changes/archive/2026-04-04-fix-login-error/Expanded Workflow: Full SDD Lifecycle
Best for: Large features, architectural changes, team collaboration
For more complex work, OpenSpec offers an expanded workflow with additional phases:
Commands:
/opsx:new "feature-name"â Create a new spec with full artifacts/opsx:continueâ Resume work on an existing spec/opsx:ffâ Fast-forward through phases (skip to implementation)/opsx:verifyâ Check current implementation against the spec/opsx:syncâ Sync specs with current code state (for brownfield)/opsx:bulk-archiveâ Archive multiple completed specs/opsx:onboardâ Analyze existing codebase to create initial specs
Example expanded workflow:
You: /opsx:new "implement user dashboard"AI: Created openspec/changes/implement-user-dashboard/ â proposal.md â Dashboard overview and goals â specs/ - functional-requirements.md - user-scenarios.md - data-requirements.md â design.md â Component architecture, API contracts â tasks.md â 15 implementation tasks organized by phase
You: [Review and refine artifacts]
You: /opsx:continueAI: Resuming from design phase. Would you like to refine design or proceed to implementation?
You: proceed to implementationAI: Beginning implementation phase...
You: /opsx:verifyAI: Verification complete: â 12 of 15 tasks complete â Task 3.2: Chart component missing accessibility labels â Task 4.1: API pagination not implemented Would you like to address these gaps?
You: /opsx:applyAI: â Task 3.2: Added ARIA labels to chart â Task 4.1: Implemented cursor-based pagination All tasks complete!
You: /opsx:archiveAI: Archived to openspec/changes/archive/...Workflow Selection Guide
Use Simple Workflow when:
- The change is small (1-3 files modified)
- Youâre working alone
- The requirement is straightforward
- You need to move fast
Use Expanded Workflow when:
- The change affects multiple components or systems
- Youâre working with a team
- The requirement needs clarification or has dependencies
- You want detailed tracking and verification
The key principle: Start simple. If you find yourself wishing you had more structure, switch to the expanded workflow. OpenSpec is fluidâ youâre never locked into a rigid process.
Part 5: Using OpenSpec with Opencode
Why They Work Well Together
While OpenSpec supports 20+ AI assistants, I find that OpenSpec + Opencode is a particularly powerful combination:
Terminal-native workflow:
- Opencode runs in your terminal, which aligns with OpenSpecâs file-based approach
- You can navigate
openspec/folders using standard shell commands - No IDE lock-in or context switching
Context hygiene:
- Opencode benefits from clean, structured contextâand thatâs exactly what OpenSpec provides
- Each spec is self-contained in its folder, making it easy to load relevant context
- Spec deltas help you understand changes without polluting the conversation
Speed and flexibility:
- Both tools prioritize speed over ceremony
- Quick iteration on specs, then quick implementation
- Easy to switch between âplanning modeâ (editing specs) and âcoding modeâ (implementation)
Brownfield-friendly:
- Opencode excels at exploring existing codebases
- OpenSpecâs
/opsx:onboardand/opsx:syncwork well with Opencodeâs codebase analysis - Together, they help you bring structure to legacy projects gradually
Practical Integration Patterns
Pattern 1: Clean Context Approach
Before starting a new feature, clear your Opencode context and start fresh:
/clear # Clear Opencode context/opsx:propose "add user profile page"[Review spec]/opsx:apply # Implementation with clean contextBenefit: The AI isnât influenced by previous conversations or unrelated code.
Pattern 2: Spec-First Exploration
Use Opencode to explore the codebase, then create a spec based on what you learn:
Show me how authentication works in this project[Opencode explains the auth system]
/opsx:propose "extend auth system to support OAuth"[Spec incorporates Opencode's findings]Pattern 3: Iterative Refinement
Refine specs with Opencode before implementation:
/opsx:propose "optimize database queries"
[Opencode reviews proposal.md]"The spec suggests indexing the users table, but we already have a composite index.Let's refine the spec to focus on the orders table instead."
[Edit spec with Opencode's input]
/opsx:applyPattern 4: Parallel Workflows
Work on multiple specs simultaneously:
Terminal 1: /opsx:propose "feature-a" â review phaseTerminal 2: /opsx:apply "feature-b" â implementation phaseTerminal 3: /opsx:archive "feature-c" â completion phaseBenefit: While one feature is being reviewed, another can be implemented.
Example: Building a Feature with OpenSpec + Opencode
Hereâs a high-level walkthrough of a real workflow:
The Goal: Add a âremember meâ feature to the authentication system
Step 1: Explore with Opencode
How is session management currently implemented?[Opencode shows current session middleware and cookie handling]Step 2: Create the spec
/opsx:propose "add remember me functionality to login"Opencode generates:
- proposal.md: Overview of âremember meâ functionality
- specs/session-extension.md: Requirements for extended sessions
- design.md: Changes to auth middleware and cookie configuration
- tasks.md: 6 implementation tasks
Step 3: Review and refine You read through the spec and realize it doesnât address security concerns:
The spec looks good, but we need to add a requirement:"Extended sessions should only work on the same device/browser"Opencode updates the spec.
Step 4: Implement
/opsx:applyOpencode works through the tasks:
- Adds âremember meâ checkbox to login form
- Modifies session middleware to support extended duration
- Updates cookie settings for persistent storage
- Adds device fingerprinting for security
Step 5: Verify
/opsx:verifyOpencode confirms all acceptance criteria are met and security requirements are satisfied.
Step 6: Archive
/opsx:archiveThe spec is preserved for future referenceâif someone asks âwhy do we fingerprint devices?â the answer is in the archived spec.
Part 6: Best Practices and Conclusion
When to Use SDD/OpenSpec
â Good fit for SDD:
- Medium-to-large features (affects multiple files or components)
- Features with complex business logic or edge cases
- Team projects where specs serve as documentation
- Brownfield development (extending existing systems)
- API contracts and integrations
- Security-sensitive features (authentication, authorization, payments)
â Overkill for SDD:
- One-line fixes (typos, config tweaks)
- Trivial changes (renaming a variable)
- Rapid prototyping and experimentation (âvibe codingâ)
- Spikes and proofs-of-concept
- Changes youâre going to throw away
Decision framework:
- Will this feature need maintenance or iteration? â Use SDD
- Are there multiple ways to implement this? â Use SDD
- Will someone else need to understand this later? â Use SDD
- Is this a one-time, throwaway experiment? â Skip SDD
Writing Good Specs
Do:
- Start with the âwhyââwhat problem are you solving?
- Use specific acceptance criteria (GIVEN/WHEN/THEN)
- Include edge cases and error scenarios
- Keep specs focused (one feature per spec)
- Iterate on specs before implementation
- Write for a human reader, not just the AI
Donât:
- Over-specify implementation details (let the AI figure out the âhowâ)
- Write specs for trivial changes
- Make specs so long theyâre tedious to review
- Treat specs as staticâupdate them as requirements evolve
- Confuse functional requirements with technical constraints
Example of good vs. bad spec writing:
â Bad: âImplement a good login systemâ
â Good:
Feature: Secure User Login
User Story:As a registered user, I want to log in securelyso that only I can access my account.
Acceptance Criteria:- GIVEN valid credentials WHEN submitted THEN user is authenticated and receives a JWT AND a secure HTTP-only cookie is set
- GIVEN invalid credentials WHEN submitted THEN user sees a generic error message AND the failed attempt is logged
- GIVEN 5 consecutive failed attempts WHEN the 6th attempt is made THEN the account is temporarily locked AND the user receives an email notificationCommon Pitfalls to Avoid
1. The Sledgehammer Problem
Donât use SDD for trivial changes. If youâre fixing a typo or changing a color, writing a full spec is overkill. Use your judgmentâSDD should save time, not create bureaucracy.
2. Skipping Review
The power of SDD is in reviewing specs before implementation. Donât rush to /opsx:apply without reading the generated artifacts. The spec is your chance to catch misalignment early.
3. Static Spec Syndrome
Specs should evolve. If you discover a new requirement during implementation, update the spec. The spec should always reflect the current understanding of what needs to be built.
4. Confusing Functional and Technical Specs
- Functional specs describe what the system should do (requirements, behavior)
- Technical specs describe how it should be implemented (architecture, libraries)
SDD works best when specs are primarily functional. Technical details can be in the design.md, but the core requirements should be implementation-agnostic.
5. Perfectionism
Specs donât need to be perfectâ they need to be good enough to guide implementation. If you find yourself endlessly refining a spec, you might be in analysis paralysis. Iterate during implementation instead.
Context Hygiene Tips
When using OpenSpec with AI assistants like Opencode:
- Clear context before major specs: Start with a clean slate for complex features
- Reference specs explicitly: Point the AI to specific files: âSee openspec/changes/auth/specs/security.mdâ
- Use spec deltas for changes: When updating requirements, show the diff: âWeâre changing the session timeout from 24h to 7d for âremember meâ usersâ
- Archive promptly: Donât leave completed specs in the changes/ folderâarchive them to maintain clarity
Conclusion
Spec-Driven Development isnât a return to waterfallâitâs an evolution of agile practices for the AI coding era. By establishing clear specifications before implementation, you:
- Align human and AI intent before code is written
- Review requirements rather than just code
- Capture knowledge that persists beyond chat sessions
- Build predictability into AI-assisted development
OpenSpec makes SDD accessible. Itâs lightweight enough for personal projects, structured enough for team collaboration, and flexible enough to adapt to your workflow. Whether youâre using Claude Code, Cursor, GitHub Copilot, or my personal favorite, Opencode, OpenSpec provides the scaffolding for better AI-assisted development.
Your next step: Try /opsx:propose on your next feature. Start simpleâdonât overthink it. Write a spec, review it, implement it, and see how it feels. SDD is a skill that improves with practice, and OpenSpec lowers the barrier to getting started.
The future of AI-assisted coding isnât about replacing human judgmentâitâs about augmenting it. Specs are how we communicate our judgment to AI systems. Start writing specs, and start building better software.
Resources
- OpenSpec GitHub: https://github.com/Fission-AI/OpenSpec
- Documentation: https://openspec.dev
- Discord Community: https://discord.gg/YctCnvvshC
- Martin Fowler on SDD: https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html
Recommended models for SDD:
- Opus 4.5 or GPT 5.2 for both planning and implementation
- High-reasoning models work best for understanding and executing specs
Remember: The best spec is one that gets written. Donât let the perfect be the enemy of the good. Start with /opsx:propose and iterate. or start with â/opsx