Searches for spec-driven development coding agents usually mean one thing: people are tired of prompt-only sessions that “finish” with unreviewed diffs and no shared definition of done. Spec-driven development (SDD) puts a testable behavior contract first; coding agents then implement against that contract instead of inventing product rules mid-edit. This page is a practice note on that workflow. Toolkits such as Spec Kit or OpenSpec appear only as evidence that teams encode specs as files agents can read— not as recommendations to buy or adopt a particular SaaS.

01

Independence note

02

What SDD means when coding agents write the code

Classic SDD says: define observable behavior before implementation becomes the only precise description of the product. With coding agents, that discipline matters more, not less. An agent will happily invent API shapes, error messages, and edge cases unless a shared artifact constrains them. The artifact is the specification—short enough to review, precise enough to test, durable enough to survive a second agent session.

  • Spec: observable rules, non-goals, acceptance checks—the contract.
  • Tasks: small, reviewable units derived from the spec, not from vibes.
  • Verify: repo commands (build, test, lint, smoke) that prove the contract.
  • Human land: PR, commit message, and any spec updates from production feedback.

This fits the wider delivery loop in coding agent workflow (brief → explore → change → verify → land). SDD strengthens the brief and the verify steps so agents do not redefine the product while editing. Series overview: Agent engineering notes.

03

What an executable specification looks like

“Executable” does not mean the spec must be a formal language. It means a human or an agent can derive failing checks from it. Prefer behavior over UI inventories; prefer outcomes over internal class names.

# Feature: public share link for drafts (illustrative)

## Goal
Authenticated owners can create a read-only link for a draft story.

## Observable rules
- Creating a link returns a URL token; unauthenticated GET shows the draft body.
- Revoking the link makes subsequent GETs return 404 (not 403).
- Editors who are not owners cannot create or revoke links.

## Non-goals
- No email invites, no password-protected links, no analytics in v1.

## Acceptance / verify
- pnpm test -- share-link
- Manual: create → open in private window → revoke → refresh shows 404

Kits in the wild often store similar content as Markdown or structured YAML under a specs/ or .specify/ tree so agents can open the file as context. Whatever layout you choose, keep one canonical path per feature and link it from the agent brief. Durable repo contracts that apply to every session still belong in AGENTS.md or tool rules; ticket-level behavior belongs in the feature spec. Prompt craft for the session itself: how to write a good agent prompt.

04

The agent loop: spec → tasks → verify

01SpecBehavior contract
02TasksSmall reviewable units
03ImplementOne theme per session
04VerifyReal repo commands
05UpdateSpec learns from evidence
  1. Lock the spec first. Have a human (or a careful agent pass limited to clarifying questions) write rules and non-goals before any feature code lands.
  2. Derive tasks from the spec. Each task maps to one or two rules plus a verify command. Avoid “also clean up lint across the app” inside the same session.
  3. Point the agent at the file. Paste the path and the done checks into the brief; forbid inventing new product behavior not listed in the spec.
  4. Run verify in the real tree. Agent claims of “tests pass” are worthless until your CI or local harness agrees.
  5. Feed failures back into the spec. If production reveals a missing rule, amend the artifact—do not leave the exception only in code.

Parallel sessions on independent specs benefit from worktree isolation— see git worktree for coding agents and the series note on multi-agent coding workflow.

05

Spec-driven vs prompt-only agent sessions

DimensionPrompt-onlySpec-driven + agents
Source of truthChat history that evaporatesCommitted / shared spec artifact
Done definitionAgent says “done”Named verify commands + rules
Second sessionRe-explains product from scratchReopens the same spec path
Review costReviewer reconstructs intent from diffReviewer diffs against listed rules
Scope creepEasy “while we’re here” editsNon-goals block drive-by features

Prompt-only is fine for tiny chores with no product ambiguity. The moment two people (or two agents) could disagree on behavior, write the rule down first. That is the core of spec-driven development for coding agents—not ceremony for its own sake.

06

Common pitfalls

  • UI inventories as specs: listing buttons without triggers, states, and outcomes teaches the agent nothing testable.
  • Specs that freeze internals: dictating class names or SQL unless those choices are the external contract.
  • Letting the agent rewrite the spec mid-flight: clarify in a dedicated pass; keep implement sessions read-mostly on the contract.
  • No verify command: “looks good” is not acceptance; wire real tests or scripted checks.
  • Treating a toolkit as the methodology: Spec Kit / OpenSpec-style layouts are packaging; the discipline is behavior-first contracts + evidence.
  • One mega-spec for the whole product: prefer feature-scoped files so agents stay within a reviewable surface.
  • Skipping human land: isolation and specs do not replace PR review—see the series coding agent evaluation notes for harness habits.

Related reading: Spec-driven development essay · Agentic vs vibe coding · Agent engineering series · Coding agent workflow · Git worktree · Good agent prompt · How to write AGENTS.md

07

Spec Kit vs OpenSpec (when to pick which packaging)

Searching for spec kit vs openspec usually means you already buy SDD and now wonder which file layout / toolkit to adopt. This page does not open a second methodology URL— both are packaging around the same discipline: behavior-first contracts + verify evidence.

  • Spec Kit–style (greenfield / staged): often shines when you can afford a phased “specify → plan → tasks → implement” path on a new feature or greenfield surface. Strong when the team wants explicit stage gates before agents write code.
  • OpenSpec–style (brownfield / delta): often shines when the product already exists and you need small, reviewable deltas against living specs—change proposals that agents implement without rewriting the whole world.
  • Either / neither: a short Markdown contract your team already reviews can beat adopting a toolkit for its own sake. Toolkits illustrate structure; they are not the methodology.

08

FAQ

What is spec-driven development for coding agents?

It is a workflow where a testable behavior specification is written (or updated) before agents implement code, and acceptance is proven with verify commands—not by the agent’s claim that work is finished.

Do I need Spec Kit or OpenSpec?

No. Those projects illustrate file-based specs agents can load. Any Markdown or structured doc your team reviews can serve the same role. For a greenfield-vs-brownfield packaging cut, see Spec Kit vs OpenSpec. This page does not endorse a vendor; pick packaging that matches your repo.

How is this different from a good agent prompt?

A prompt is session-scoped. A spec is the durable product contract that multiple sessions and reviewers share. Use both: the prompt points at the spec path and today’s task slice; see good agent prompt.

Where should the longer SDD essay live vs this page?

The Chinese/English practice essay at /articles/spec-driven-development/ covers SDD principles in depth. This URL focuses on the coding-agent workflow angle and English long-tail phrasing; it does not replace or rename the older article.

Is this official product documentation?

No. Unofficial engineering notes from 墨码 / codemo.fun. Re-check your agent’s file discovery, CI commands, and any toolkit docs after upgrades.