Skip to content
spec-driven-workflow-skill logo

Spec-Driven Workflow Skill

spec-driven-workflow-skill

Follow spec-driven development (constitution → spec → plan → tasks → implement)

SKILL.md

Full skill instructions

Spec-Driven Workflow Skill

Instructions

This skill provides guidance for following the Spec-Driven Development (SDD) workflow used in this project.

SDD Workflow Overview

1. CONSTITUTION    → Define project principles and values
2. SPEC            → Create feature specification
3. PLAN            → Design architecture and tech stack
4. TASKS           → Break down into testable tasks
5. IMPLEMENT       → Code with test-driven approach
   - RED   → Write failing tests
   - GREEN → Write minimal code to pass
   - REFACTOR → Improve code quality
6. POLISH         → Finalize and document

Project Structure

.specify/
├── memory/
│   └── constitution.md    # Project principles
├── templates/
│   ├── spec-template.md
│   ├── plan-template.md
│   ├── tasks-template.md
│   ├── adr-template.md
│   └── phr-template.prompt.md
└── scripts/
    ├── bash/
    └── powershell/

specs/
└── <feature-name>/
    ├── spec.md            # Feature requirements
    ├── plan.md            # Architecture decisions
    ├── tasks.md           # Implementation tasks
    ├── data-model.md      # Entities and relationships
    ├── research.md        # Technical decisions
    ├── quickstart.md      # Integration scenarios
    └── checklists/
        └── requirements.md # Acceptance criteria

history/
├── prompts/
│   ├── constitution/
│   ├── <feature-name>/
│   └── general/
└── adr/
    └── <decision-title>.md

Step 1: Constitution

When: Project initialization or fundamental principle changes

The constitution defines project values. Reference it when:

  • Making architectural decisions
  • Setting code quality standards
  • Defining security requirements
.constitution/​memory/​constitution.md contains:
- Code quality standards
- Testing requirements
- Performance budgets
- Security principles
- Architecture guidelines

Step 2: Create Feature Specification

Command: /​sp.specify or sp.specify

# spec.md template

## Feature Overview
- **Name**: Feature name
- **Description**: Brief description
- **Goals**: What we want to achieve
- **Out of Scope**: What's excluded

## User Stories
As a [role], I want [capability], so that [benefit].

## Requirements
### Functional
1. Must have...
2. Should have...
3. Could have...

### Non-Functional
- Performance: p95 latency < 200ms
- Availability: 99.9% uptime
- Security: OAuth2 + JWT

## Success Criteria
- [ ] Criterion 1
- [ ] Criterion 2

Step 3: Create Architecture Plan

Command: /​sp.plan or sp.plan

# plan.md template

## Tech Stack
- **Frontend**: Next.js 14, TypeScript, Tailwind
- **Backend**: FastAPI, Python 3.11+
- **Database**: Neon PostgreSQL, SQLModel
- **Auth**: Better Auth, JWT
- **AI**: OpenAI, Groq

## Architecture
[Diagrams and component descriptions]

## File Structure

src/ app/ backend/


## API Contracts
### POST /​api/​v1/​tasks
- Input: TaskCreate
- Output: TaskResponse
- Errors: 400, 401, 404

Step 4: Create Tasks

Command: /​sp.tasks or sp.tasks

# tasks.md template

## Phase: Setup
- [ ] Task 1
- [ ] Task 2

## Phase: Tests
- [ ] Task 3
- [ ] Task 4

## Phase: Core
- [ ] Task 5
- [ ] Task 6

## Phase: Integration
- [ ] Task 7

## Phase: Polish
- [ ] Task 8

Step 5: Implement

Command: /​sp.implement or sp.implement

Follow TDD approach:

RED Phase - Write Failing Tests
# tests/​test_tasks.py
import pytest
from datetime import datetime

def test_create_task_requires_title():
    """Task must have a title."""
    with pytest.raises(ValueError):
        Task(title="", description="Test")

def test_task_defaults_to_incomplete():
    """New tasks should be incomplete by default."""
    task = Task(title="Test Task")
    assert task.completed is False
GREEN Phase - Write Minimal Code
# backend/​models/​task.py
class Task(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    title: str = Field(min_length=1)
    completed: bool = Field(default=False)
REFACTOR Phase - Improve Code
  • Extract constants
  • Add type hints
  • Optimize performance
  • Improve readability

Step 6: Polish

  • Run full test suite
  • Check linting and formatting
  • Update documentation
  • Create quickstart guide
  • Verify against requirements

Using SDD Commands

Available Commands

CommandPurposeStage
/​sp.specifyCreate feature specspec
/​sp.planDesign architectureplan
/​sp.tasksBreak into taskstasks
/​sp.implementExecute tasksimplement
/​sp.analyzeCheck consistencyany
/​sp.checklistGenerate checklistany
/​sp.clarifyAsk clarifying questionsspec
/​sp.adrDocument architecture decisionplan
/​sp.phrCreate prompt history recordany
/​sp.git.commit_prCommit and create PRpolish

Quick Start for New Feature

# 1. Create specification
/​sp.specify

# 2. Design plan
/​sp.plan

# 3. Generate tasks
/​sp.tasks

# 4. Implement
/​sp.implement

# 5. Document decision if significant
/​sp.adr "decision-title"

Examples

Example: Adding a New Feature

  1. Define the feature (conversation with product owner)

  2. Create specification

# Feature: Task Labels
## Goal
Allow users to organize tasks with color-coded labels

## Requirements
- Create, edit, delete labels
- Assign multiple labels to tasks
- Filter tasks by label

## API
POST /​api/​v1/​labels
GET /​api/​v1/​labels
POST /​api/​v1/​tasks/​{id}/​labels
  1. Plan architecture
## Label Model
- id, name, color, user_id
- Many-to-many with tasks

## API Design
- RESTful endpoints
- Validation with Pydantic
- Auth required
  1. Create tasks
## Phase: Core
- [ ] Create Label SQLModel
- [ ] Create Label CRUD routes
- [ ] Create label-task association

## Phase: Tests
- [ ] Test label CRUD
- [ ] Test task-label relationship

## Phase: Integration
- [ ] Add to frontend task view
  1. Implement
# backend/​models/​label.py
class Label(SQLModel, table=True):
    id: int = Field(default=None, primary_key=True)
    name: str
    color: str
    user_id: int = Field(foreign_key="users.id")
  1. Validate
pytest tests/
npm run lint

Decision Recording (ADR)

When making significant decisions:

# ADR: Label Color Storage Format

## Status
Accepted

## Context
Need to store label colors for the new labels feature.

## Decision
Use hex color string (e.g., "#FF5733") with validation.

## Consequences
### Positive
- Simple storage (string)
- Flexible color selection
- Easy to serialize/​display

### Negative
- No color picker constraints
- Users can enter invalid colors (validated)

## Alternatives Considered
- PostgreSQL citext: More complex, no benefit
- ENUM: Inflexible, requires migration

Quality Gates

Before moving to next phase:

  • All tests pass
  • Code follows constitution
  • Documentation updated
  • No security vulnerabilities
  • Performance within budget

Prompt History Records (PHRs)

Every significant interaction is recorded:

history/​prompts/
├── constitution/
│   └── 001-create-constitution.constitution.prompt.md
├── todo-app/
│   └── 001-create-spec.spec.prompt.md
└── general/
    └── 001-question.general.prompt.md

PHRs capture:

  • Full user prompt
  • Assistant response
  • Files created/​modified
  • Tests run
  • Model used
  • Links to specs/​ADRs

More skills from WajahatAli3218664

nextjs-frontend-skill logo
WajahatAli3218664/Hackathon-02-mytodo

nextjs-frontend-skill

Build Next.js App Router pages, components with TypeScript and Tailwind

0 0
View
better-auth-skill logo
WajahatAli3218664/Hackathon-02-mytodo

better-auth-skill

Configure Better Auth with JWT for secure authentication

0 0
View
openai-chatkit-skill logo
WajahatAli3218664/Hackathon-02-mytodo

openai-chatkit-skill

Integrate OpenAI ChatKit for conversational AI interface

0 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View