Skip to main content

Lesson 06.2: Core Workflow

Duration: 60 minutes | Difficulty: Beginner


Learning Objectives

By the end of this lesson, you will understand:

  • The three core phases of SpecWeave development
  • When and how to use each command
  • The complete increment lifecycle
  • Supporting commands for workflow management

The Three Phases

SpecWeave development follows a simple cycle:

PhaseCommandPurpose
Plan/sw:incrementCreate specifications
Build/sw:doImplement tasks
Validate/sw:doneVerify quality

Phase 1: Plan (/sw:increment)

This is where the magic starts. A single description becomes complete specifications.

How It Works

/sw:increment "User authentication with email/password login"

The AI agents create:

  1. spec.md — PM Agent

    • Feature scope definition
    • User stories (As a... I want... So that...)
    • Acceptance criteria (testable conditions)
  2. plan.md — Architect Agent

    • Architecture Decision Records (ADRs)
    • Component design
    • Technology choices
    • Risk assessment
  3. tasks.md — Tech Lead Agent

    • Task breakdown
    • Dependencies
    • BDD test scenarios
    • Estimated complexity

Example Output

/sw:increment "Task tracker CLI with add, list, complete, delete"

Creating increment 0001-task-tracker-cli...

📋 PM Agent creating spec.md...
✓ Feature scope defined
✓ 4 user stories created
✓ 12 acceptance criteria defined

🏗️ Architect Agent creating plan.md...
✓ 2 architecture decisions recorded
✓ Component design complete
✓ Error handling strategy defined

📝 Tech Lead Agent creating tasks.md...
✓ 10 tasks created
✓ Dependencies mapped
✓ BDD scenarios written

Increment 0001-task-tracker-cli ready!

Review specs at:
.specweave/increments/0001-task-tracker-cli/spec.md
.specweave/increments/0001-task-tracker-cli/plan.md
.specweave/increments/0001-task-tracker-cli/tasks.md

Key Principles

  1. One increment = One feature — Don't pack too much into one increment
  2. Review before proceeding — Read the specs, suggest changes
  3. Smaller is better — More increments with fewer tasks each

Phase 2: Build (/sw:do)

With specifications approved, implementation begins.

How It Works

/sw:do

SpecWeave:

  1. Loads the active increment
  2. Identifies pending tasks
  3. Implements each task sequentially
  4. Updates task status
  5. Syncs with specs

During Implementation

/sw:do

Loading increment 0001-task-tracker-cli...

📋 Task Progress: 0/10 complete

Working on T-001: Set up project structure
✓ Created package.json
✓ Created src/ directory
✓ Initialized storage module
→ T-001 complete

Working on T-002: Implement task data model
✓ Created Task interface
✓ Added validation functions
→ T-002 complete

Working on T-003: Implement add task function
...

📊 Progress: 3/10 tasks complete

Key Principles

  1. Tasks are atomic — Each task is a single unit of work
  2. Tests accompany code — BDD scenarios become tests
  3. Progress is tracked — Status updates in real-time
  4. Context is maintained — AI knows the full spec

Pausing and Resuming

Life happens. You can pause and resume:

# Pause current work
/sw:pause 0001

# Resume later
/sw:resume 0001

# Check status
/sw:status

Phase 3: Validate (/sw:done)

Before marking complete, quality gates must pass.

How It Works

/sw:done 0001

SpecWeave validates:

  1. Task Completion

    • All tasks marked complete
    • No pending tasks remain
  2. Acceptance Criteria

    • Each AC has a corresponding task
    • All ACs satisfied by tests
  3. Test Coverage

    • Unit tests exist
    • Coverage meets threshold (default: 70%)
  4. Code Quality

    • No critical linting errors
    • No security vulnerabilities

Example Output

/sw:done 0001

Validating increment 0001-task-tracker-cli...

📋 Task Completion
✓ 10/10 tasks complete

✅ Acceptance Criteria
✓ AC-US1-01: Task can be added (T-003)
✓ AC-US1-02: Task ID is auto-generated (T-003)
✓ AC-US2-01: All tasks can be listed (T-004)
... (12/12 satisfied)

🧪 Test Coverage
✓ Unit tests: 85%
✓ Integration tests: 72%
✓ Meets threshold (70%)

🔒 Code Quality
✓ No linting errors
✓ No security vulnerabilities

═══════════════════════════════════════════════
Increment 0001-task-tracker-cli COMPLETE
═══════════════════════════════════════════════

📄 Completion report:
.specweave/increments/0001-task-tracker-cli/completion-report.md

If Validation Fails

/sw:done 0001

Validating increment 0001-task-tracker-cli...

📋 Task Completion
⚠️ 8/10 tasks complete
Pending: T-009, T-010

❌ Cannot mark complete. Fix issues:
- Complete pending tasks: T-009, T-010

The Flow Command: /sw:next

Pro tip: Instead of running /sw:done then deciding what's next, use /sw:next:

/sw:next

This single command:

  1. Validates current increment — Checks if work is complete
  2. Auto-closes if ready — PM validates and closes automatically
  3. Runs quality assessment — Post-closure quality check
  4. Suggests next work — Intelligent recommendations

Example: Happy Path

/sw:next

📊 Checking current increment...

Active: 0001-task-tracker-cli

🔍 PM Validation:
✅ Gate 1: All tasks complete (10/10)
✅ Gate 2: All tests passing (85% coverage)
✅ Gate 3: Documentation updated

🎯 Auto-closing increment 0001...
✓ Status: completed
✓ Quality score: 87/100 (GOOD)

🎉 Increment 0001 closed successfully!

🎯 Next Work Suggestions:

No planned increments found.
Time to plan your next feature!

Run: /sw:increment "feature description"

Example: Not Ready Yet

/sw:next

📊 Checking current increment...

❌ Gate 1: 2 P1 tasks incomplete (8/10)

Options:
A. Complete remaining work (recommended)
B. Force close and defer tasks
C. Stay on current increment

What would you like to do? [A/B/C]

Why /sw:next is special:

  • ✅ One command for the entire completion flow
  • ✅ No need to remember /done/qa/increment sequence
  • ✅ Intelligent suggestions from backlog
  • ✅ Never forces actions — you stay in control

Supporting Commands

/sw:status

View current state:

/sw:status

SpecWeave Status
════════════════════

Active Increment: 0001-task-tracker-cli
Status: in_progress
Tasks: 6/10 complete (60%)
ACs: 8/12 satisfied (67%)

WIP Limit: 1 (current: 1)

/sw:progress

Detailed progress view:

/sw:progress 0001

Increment: 0001-task-tracker-cli
═══════════════════════════════

User Stories & Tasks:
─────────────────────
US-001: Add Task
[x] T-001: Project setup
[x] T-002: Task data model
[x] T-003: Add task function
[ ] T-004: Add task tests

US-002: List Tasks
[x] T-005: List function
[ ] T-006: List tests

/sw:validate

Run validation without completing:

/sw:validate 0001

Validation Results:
Tasks: 6/10 complete
ACs: 8/12 satisfied
Coverage: 72%
Issues: 2 pending tasks

/sw:sync-docs

Sync living documentation:

/sw:sync-docs

Syncing documentation...
✓ Updated API reference
✓ Updated feature docs
✓ Updated changelog

The Complete Lifecycle

State Transitions

FromToTrigger
NonePlanning/sw:increment
PlanningReviewSpecs generated
ReviewBuildingSpecs approved
BuildingPaused/sw:pause
PausedBuilding/sw:resume
BuildingValidating/sw:done
ValidatingCompleteAll gates pass

Best Practices

1. Small Increments

# ❌ Too big
/sw:increment "Complete e-commerce platform"

# ✓ Right size
/sw:increment "User registration with email verification"
/sw:increment "Product catalog display"
/sw:increment "Shopping cart functionality"

2. Review Specs Before Building

/sw:increment "Feature X"

# STOP! Review before proceeding:
cat .specweave/increments/0001-feature-x/spec.md
cat .specweave/increments/0001-feature-x/plan.md
cat .specweave/increments/0001-feature-x/tasks.md

# Make adjustments if needed, then:
/sw:do

3. Complete Before Starting New

# ❌ Don't jump between increments
/sw:increment "Feature A"
/sw:do # Partially done
/sw:increment "Feature B" # Starting new!

# ✓ Complete one at a time
/sw:increment "Feature A"
/sw:do
/sw:done 0001
/sw:increment "Feature B"

4. Use Status Commands

# Regular check-ins
/sw:status # Quick status
/sw:progress 0001 # Detailed progress
/sw:validate 0001 # Pre-validate

Key Takeaways

  1. Three phases: Plan → Build → Validate — never skip
  2. /sw:increment creates specifications — the foundation
  3. /sw:do implements with context — not just code generation
  4. /sw:done validates quality — gates ensure completeness
  5. Supporting commands help manage — status, progress, validate

Next Lesson

Now let's create your first real increment and see this workflow in action.

Continue to Lesson 06.3: Your First Increment