Spec-driven development
Spec-driven development

Turn a request into a contract, then into verified code.

CafeKit keeps the important truth outside chat. The assistant first writes the contract, then implements one approved task packet, then proves and syncs the result.

01
Request

A human asks for a change.

02
Spec

Scope, requirements, design, and tasks become durable files.

03
Develop

The assistant implements one approved task packet.

04
Verify

Real commands and runtime proof check the result.

05
Review

A separate pass checks compliance and risk.

06
Sync

State moves only after evidence exists.

The simple version#

Spec-driven development means the spec is the boss, not the chat.

In normal AI coding, the assistant often works from conversation memory. That is fragile. The request may be summarized incorrectly, scope may shift, and the next session may not know why a decision was made.

CafeKit changes the center of gravity. Before code changes, the work is written into specs/<feature>/. That folder becomes the shared contract for the human, assistant, reviewer, and future sessions.

The loop CafeKit wants every feature to follow
1. Specify

Write down what should happen before code changes.

2. Build narrowly

Implement only the approved task boundary.

3. Prove it

Run commands and record exact evidence.

4. Sync state

Update spec.json and task markdown after proof.

What the assistant is allowed to trust#

The assistant should trust durable repo artifacts first:

What lives inside specs/<feature>/
spec.json

Machine state: phase, scope lock, task registry, approvals.

requirements.md

User-visible behavior and acceptance criteria.

research.md

Source-backed findings and decisions.

design.md

Architecture, contracts, data flow, invariants.

tasks/task-R*.md

One implementation packet with files, steps, criteria, evidence.

The important point is not that CafeKit creates more files. The point is that each file answers a different question:

ArtifactQuestion it answers
requirements.mdWhat should the product do?
research.mdWhat source-backed facts or decisions matter?
design.mdHow should the system be shaped?
tasks/task-R*.mdWhat exact implementation unit is approved now?
spec.jsonWhat is the machine-readable state of the feature?

Daily working rule#

When a feature is meaningful, use this rule:

Use /hapo:brainstorm first only when the request is not ready for specs. The delivery path itself starts here:

  1. Run /hapo:specs when the goal is clear enough to become a contract.
  2. Do not develop until the spec has approved task packets.
  3. Run /hapo:develop for one task packet at a time.
  4. Verify with /hapo:test and review with /hapo:code-review.
  5. Run /hapo:sync only after proof exists, or use /hapo:sync audit <feature> to repair drift.
Why this is different from normal prompting
Ad-hoc prompting
Chat is the source of truth
Scope changes silently
The assistant guesses missing details
Review checks only the final diff
CafeKit SDD
Repo files are the source of truth
Scope lock makes changes explicit
Missing details route back to the spec
Review compares code against the contract

When to use the full SDD path#

Use the full path when the work changes product behavior, touches multiple files, crosses runtime boundaries, changes data/auth/package contracts, affects users, needs review evidence, or may be handed to another assistant or teammate.

For tiny copy edits or clearly isolated one-line fixes, the full spec flow may be too heavy. But even then, the same habit still applies: state the boundary, change only that boundary, verify the result, and avoid hidden scope growth.

Where to go next#

Read Core workflow to see the full command path. Read Spec lifecycle when you need the deeper rules for spec.json, task packets, validation, and readiness.