Spec-driven development

By · Updated

Short answer

Spec-driven development means agreeing on goals, constraints, acceptance commands, and out-of-scope paths before an AI agent or contractor edits your repository. The spec is the merge contract: reviewers pass or fail against it, not against whatever the model sounded confident about. Pair specs with verify commands in AGENTS.md and human sign-off on regulated paths.

Spec-driven development is the habit of writing a short, testable contract before autonomous coding agents (or offshore contractors) touch your repository. The spec names the user-visible outcome, the verify commands that must pass, and what must remain untouched. PunkSolid treats specs as merge law—not as optional preamble in a chat window. This guide sits in the learn cluster beside AI agents explained and Claude Code vs Cursor.

Why specs matter more with agents

Language models excel at plausible code. They do not automatically inherit your roadmap, compliance boundaries, or canonical URL policy. Without a spec, reviewers debate whether a refactor “felt helpful” instead of checking a checklist. That ambiguity shows up in rescue work: silent redirect edits, duplicate sitemaps, and lockfile churn.

A written spec turns review into pass/fail. Did pnpm test pass? Did redirects match the signed inventory? Did the agent stay out of infra/? Those questions do not depend on which vendor produced the diff.

Minimum sections in every agent spec

PunkSolid uses the same skeleton on migrations, CMS seeds, and feature slices:

  1. Problem — What a user or operator can do after the change that they could not do before. One paragraph maximum.
  2. Constraints — Stack, style, performance, regulatory copy, branding, and deployment model. Link to ADRs instead of pasting architecture essays.
  3. Acceptance — Exact commands: unit tests, typecheck, content validate, link scan, build. Mirror what CI already runs.
  4. Out of scope — Directories and concerns the agent must not touch: payments, DNS, unrelated packages, dependency major bumps.
  5. Review — Who signs off, whether a second human must read regulated HTML, and whether merge waits on staging.

Optional but valuable: Rollback — how to revert if acceptance passes locally but staging fails (feature flag, revert commit, DNS hold).

Spec vs ticket vs AGENTS.md

Artifact Audience Lifetime
Ticket / issue Humans prioritizing work Closes when shipped
Spec (this guide) Agent + reviewers for one slice Archived with the PR
AGENTS.md Every future agent session Living repo doc

AGENTS.md belongs at repository root: install steps, verify commands, forbidden paths. A spec is task-specific. Do not paste a multi-day feature spec into AGENTS.md; link the ticket instead.

Cursor rules encode habits (git remotes, no force-push). Rules steer style; specs bound intent for a single branch.

Acceptance commands must be real

“If tests pass” is not acceptance. Name filters: pnpm --filter @scope/web test, pnpm validate, site build <id> --pull. The command should be the same one you would run before asking a human reviewer for a LGTM.

On PunkSolid monorepos, content agents run package validators before claiming a page is ready for reviewed. Client apps mirror that pattern so Claude Code and Cursor sessions cannot shortcut with a verbal “all good.”

Scoping paths and privileges

Agents with shell access can touch more than you intended. The spec should list allowed path globs when the task is narrow: apps/ai-network/src/content/pages/punksolid/** only, for example. Pair that list with deny rules in AGENTS.md for infra/, commerce webhooks, and secret stores.

Least privilege beats heroic prompting. If the task is “rewrite five guides,” the spec should not invite dependency updates or deploy script edits.

Spec-driven agentic coding workflow

A practical loop for mixed Cursor and Claude Code teams:

  1. Human drafts or tightens the spec in the ticket.
  2. Implementer opens a branch; Cursor handles multi-file template work with visual diffs.
  3. Optional: Claude Code runs a bounded terminal batch (rename across tree) when the spec lists exact globs.
  4. Implementer runs acceptance commands locally; pastes output or CI link—not paraphrase.
  5. Reviewer checks diff against out of scope and regulated copy; merges only on green CI.

Neither tool replaces step five on production paths. See methodology for how PunkSolid gates client delivery.

When specs fail (and how to recover)

Common failures: the spec was vague, acceptance commands were missing from CI, or the agent “fixed” unrelated lint. Recovery is revert or narrow—not an argument in chat.

If you hire PunkSolid for AI code review after a vibe-coded sprint, the first deliverable is often retroactive specs for the slices you still want to keep. That documents intent before the next agent session.

Specs on migrations and SEO work

Website migrations need specs with URL inventory attachment: old path, new path, redirect code, canonical owner. Agents should not invent redirects from sitemap guesses. The website migration SEO checklist lists structural checks that belong in acceptance.

For large content moves, acceptance includes validator output (duplicate keywords, orphan links) not just HTML build green.

Specs for non-engineers

Product and content leads can write the problem and review sections; engineering fills constraints and acceptance. Plain-language problem statements reduce agents hallucinating features you did not request.

Regulated industries: the spec should flag which pages need medical, legal, or financial sign-off. Agents may draft; humans publish.

Anti-patterns we decline

Working with PunkSolid

Website development and Claude Code development engagements start from a spec-shaped statement of work: deliverables, verify commands, and ownership of hosting. If you already use agents internally, we can tighten your AGENTS.md and rules so specs stay short.

Continue with What is agentic AI? for vocabulary, or AI coding agents compared if you are still choosing tooling.

Sources

FAQ

How long should a spec be?

One page for most agent tasks: problem, constraints, acceptance commands, out of scope, and reviewer. Long features get an ADR or ticket link instead of pasting requirements into chat. See [AGENTS.md guide](/guides/agents-md-guide/).

Does spec-driven development slow teams down?

It slows the first hour and saves the second day—fewer surprise refactors and fewer “helpful” dependency upgrades. [Methodology](/methodology/) treats specs as cheaper than production rollback.

Can the agent write the spec?

It can draft bullets; a human still signs scope before edits. Letting the same session invent and implement invites scope creep—see [AI agents explained](/guides/ai-agents-explained/).

What if the spec and the diff disagree?

The spec wins until you consciously revise it. Merge against acceptance commands, not the agent’s closing summary.

Cursor is a trademark of Anysphere, Inc. Claude Code is a product of Anthropic. PunkSolid is not affiliated with either company.

Plan your build or migration

Send the site, the stack, and the deadline. We reply with questions, risks, and a proposed first step.

Start a project

Related

AGENTS.md guide

How to write AGENTS.md so coding agents respect repo boundaries, tests, and review norms.

Guide

Claude Code vs Cursor

Compare agentic coding workflows—terminal-first vs IDE-first—without picking a universal winner.

Guide

AI agents explained

Agents as loops of observe, act, and verify—plus where they fail without engineering discipline.

Guide

Cursor rules guide

Project rules and skills that steer IDE agents—scope, tone, and test discipline.

Guide
Start a project