Spec-Driven Development workflow using GitHub spec-kit for building high-quality software with structured specifications and intent-driven development
A structured methodology for building production-ready software by defining specifications before implementation. Based on GitHub spec-kit.
📦 Prerequisites: This skill requires specify CLI installed in your project. Run
specify initto set up spec-kit prompts and agents in your repository.
⚡ Dynamic Prompts: The
/speckit.*commands are provided by the specify CLI at runtime, not by this APM skill package. They become available automatically when spec-kit is initialized in your project.
Specifications drive implementation, not the other way around.
Establish non-negotiable principles that govern all development decisions.
Command: /speckit.constitution
What to define:
Example Constitution Elements:
### Core Principle: API First
Ship as web application with RESTful API backend. API endpoints
designed for composability. Dependencies kept minimal.
**Rationale**: Simplicity enables rapid iteration; API-first design
ensures accessibility for future integrations.
Best Practices:
Define WHAT you want to build without prescribing HOW to build it.
Command: /speckit.specify
Focus on:
Example Spec:
Build an application that helps users organize photos in albums.
- Albums are grouped by date and can be reorganized via drag-and-drop
- Albums are never nested inside other albums
- Within each album, photos display in a tile-like interface
- Users can add photos from local storage
- Photos remain on device (no cloud upload)
Avoid:
Optional: Clarification Phase
Command: /speckit.clarify
Run this after specification to identify underspecified areas:
Translate the specification into a technical implementation plan with concrete technology choices.
Command: /speckit.plan
What to include:
Example Plan:
## Tech Stack
- Frontend: Vite + React + TypeScript
- State: React Context API (no external library)
- Storage: IndexedDB for metadata, File API for images
- Build: Vite with TypeScript strict mode
- Testing: Vitest for unit/integration tests
## Architecture
- Single-page application (SPA)
- Component hierarchy: App → AlbumList → Album → PhotoGrid → Photo
- Local-first: All data persists in browser storage
- No backend required for MVP
## Data Model
Album {
id: string (UUID)
name: string
createdAt: Date
photos: Photo[]
}
Photo {
id: string (UUID)
file: File
albumId: string
addedAt: Date
}
Best Practices:
Command: /speckit.tasks
Generate an actionable, ordered list of implementation tasks.
Task Structure:
1. Setup project scaffolding
- Initialize Vite + React + TypeScript
- Configure Vitest for testing
- Setup ESLint/Prettier
2. Implement Album data model
- Create Album and Photo TypeScript interfaces
- Implement IndexedDB storage layer
- Write unit tests for CRUD operations
3. Build AlbumList component
- Render list of albums with creation dates
- Implement drag-and-drop reordering (react-beautiful-dnd)
- Write component tests with Vitest + Testing Library
Task Characteristics:
Optional: Analysis Phase
Command: /speckit.analyze
Run before implementation to validate:
Optional: Quality Checklists
Command: /speckit.checklist
Generate custom validation checklists:
## Requirements Completeness Checklist
- [ ] All user scenarios from spec have corresponding tasks
- [ ] Error handling defined for each user action
- [ ] Accessibility requirements specified (WCAG 2.1 Level AA)
- [ ] Performance targets quantified (page load < 2s)
- [ ] Security review completed (no XSS/CSRF vulnerabilities)
Command: /speckit.implement
Execute all tasks to build the feature according to the plan.
Implementation Protocol:
During Implementation:
/speckit.analyze if you deviate from planImplementation Patterns:
Feature Flags for Experimentation:
// Enable parallel implementation exploration
const USE_OPTIMISTIC_UI = featureFlags.optimisticUI;
if (USE_OPTIMISTIC_UI) {
// Immediate UI update, background sync
} else {
// Wait for server confirmation
}
Constitution-Driven Error Handling:
// Constitution Principle: "Graceful degradation"
try {
await syncToCloud();
} catch (error) {
logger.warn('Cloud sync failed, using local-only mode', error);
localStorage.setItem('offline-mode', 'true');
// Continue operation, don't block user
}
| Aspect | Traditional Development | Spec-Driven Development |
|---|---|---|
| Starting Point | Write code immediately | Write specification first |
| Refinement | Refactor code | Refine spec → regenerate |
| Documentation | Written after (if at all) | Specification IS documentation |
| Changes | Modify code directly | Update spec, re-implement |
| Testing | Tests written after code | Tests derived from spec |
| AI Role | Code completion | Spec interpretation + code generation |
Starting from scratch with no existing codebase.
Workflow:
/speckit.constitution → Define project principles/speckit.specify → Describe user scenarios/speckit.clarify → Resolve ambiguities/speckit.plan → Choose tech stack/speckit.analyze → Validate consistency/speckit.tasks → Break down work/speckit.implement → Build featureBest Practices:
Adding features to existing projects.
Workflow:
/speckit.specify → Define new feature requirements/speckit.plan → Integrate with existing architecture/speckit.tasks → Account for migration/compatibility/speckit.implement → Execute incrementallyConsiderations:
Exploring multiple implementation approaches simultaneously.
Use Cases:
Workflow:
plan-react.md (React + Vite)plan-vue.md (Vue + Vite)plan-vanilla.md (No framework)impl-react, impl-vue, impl-vanilla)Spec-Driven Development complements TDD perfectly:
| SDD Phase | TDD Integration |
|---|---|
| Constitution | Defines test coverage requirements |
| Specification | Provides acceptance criteria for tests |
| Planning | Specifies testing strategy (unit/integration/e2e) |
| Tasks | Each task includes test-writing subtask |
| Implementation | Follow Red → Green → Refactor cycle |
Example Task with TDD:
### Task: Implement album creation
**Acceptance Criteria**:
- User can create album with name and optional description
- Album appears in album list immediately
- Album persists across page reloads
**TDD Steps**:
1. Write test: `test_create_album_stores_in_indexeddb`
2. Run test (fails - no implementation yet)
3. Implement minimal Album.create() method
4. Run test (passes)
5. Write test: `test_created_album_appears_in_list`
6. Implement UI update logic
7. Refactor for code quality
Purpose: Override feature detection for non-Git repositories.
Usage:
export SPECIFY_FEATURE="001-photo-albums"
When Needed:
Important: Set in your AI agent context BEFORE running /speckit.plan or subsequent commands.
One-time persistent install (recommended):
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git
Usage without install:
uvx --from git+https://github.com/github/spec-kit.git specify init <project>
New project:
specify init my-project --ai copilot
Existing project:
cd existing-project
specify init . --ai claude
# or
specify init --here --ai cursor-agent
specify check
Verifies:
Issue: /speckit.* commands not recognized
specify init in project root.github/agents/ or .claude/ directoryIssue: SPECIFY_FEATURE not working
Issue: Constitution not followed during implementation
/speckit.analyze before implementationIssue: Spec and implementation diverged
/speckit.plan and /speckit.tasks/speckit.clarify to refine requirements/speckit.analyze to catch issues earlyStarting New Feature (Greenfield):
1. /speckit.constitution → Project principles
2. /speckit.specify → Requirements (what/why)
3. /speckit.clarify → [Optional] Resolve ambiguities
4. /speckit.plan → Technical design (how)
5. /speckit.analyze → [Optional] Validate consistency
6. /speckit.tasks → Actionable task list
7. /speckit.implement → Execute with TDD
Adding to Existing Project (Brownfield):
1. Review constitution → Understand constraints
2. /speckit.specify → New feature requirements
3. /speckit.plan → Integration with existing system
4. /speckit.tasks → Include migration tasks
5. /speckit.implement → Execute with regression tests
Exploring Alternatives (Parallel):
1. /speckit.specify → Single specification (shared)
2. /speckit.plan (v1) → Approach A (e.g., React)
3. /speckit.plan (v2) → Approach B (e.g., Vue)
4. /speckit.tasks (each) → Parallel task lists
5. Implement in branches → Compare against constitution metrics
Note: These commands are provided by the specify CLI (installed via
specify init), not by this APM skill package. They become available at runtime when spec-kit is set up in your project.
| Command | Purpose | When to Use | Source |
|---|---|---|---|
/speckit.constitution |
Define project principles | Start of project, major direction changes | specify CLI |
/speckit.specify |
Write requirements | Every new feature | specify CLI |
/speckit.clarify |
Resolve ambiguities | After specification, before planning | specify CLI |
/speckit.plan |
Technical design | After spec, before tasks | specify CLI |
/speckit.analyze |
Validate consistency | Before implementation | specify CLI |
/speckit.checklist |
Generate quality checklists | For custom validation needs | specify CLI |
/speckit.tasks |
Create task list | After planning | specify CLI |
/speckit.implement |
Execute implementation | Final step, with TDD | specify CLI |
| Prompt | Purpose | Usage |
|---|---|---|
create-spec.prompt.md |
Guide specification creation | Alternative to /speckit.specify for manual spec writing |
clarify-spec.prompt.md |
Guide clarification process | Supplement to /speckit.clarify for resolving ambiguities |
Integration: This skill provides instructions and best practices for using spec-kit. The spec-kit prompts themselves are installed by the specify CLI into .github/agents/ or .claude/ directories.
License: MIT (GitHub spec-kit)
Maintained By: GitHub (Den Delimarsky, John Lam)
Skill Version: 1.0.0