Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Workflow recipe

Spec-driven feature build: plan, approve, implement, verify

Written spec, approved plan, small tested tasks and a final check against the spec, not vibes.

By Checked Intermediate3 h6 steps
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

Spec-driven development with an AI agent runs through four gates: a written spec with acceptance criteria that a person approves, a plan made in plan mode that a person approves, implementation in small test-first tasks, and verification against each criterion. The pull request carries the spec, and the spec is updated with whatever the build taught you.

Coding agents are good at writing code and poor at guessing what you meant. Ask for “an export button” and you get one, along with three decisions you did not know you were making: which format, which rows, what happens with ten thousand of them. Spec-driven development moves those decisions to the start, where they are cheap to change, and gives you something to check the result against at the end.

This recipe uses Claude Code’s plan mode with two Agent Skills, and shows how the same loop looks in GitHub’s Spec Kit and in Kiro.

EditorAbout 30 min

1. Write the spec: behaviour, limits and acceptance criteria

Start with a short spec in the repository, for example specs/csv-export.md. You can write it yourself, or ask the agent to interview you and draft it. The spec-driven-development skill gives the agent a structure: objective, scope, commands, boundaries and success criteria.

Spec interview · Claude Code
I want to build: [ONE-SENTENCE FEATURE DESCRIPTION]. Before writing anything, ask me up to eight questions about behaviour, edge cases, limits and what is out of scope. Ask them one at a time. Then write specs/[FEATURE].md with these sections: Goal, Users, Behaviour, Out of scope, Acceptance criteria (numbered, each one testable), Open questions. Do not write code and do not plan the implementation yet.

Good acceptance criteria are observable: “Exporting 10,000 rows completes in under 5 seconds and the file opens in Excel with UTF-8 names intact” rather than “export is fast”. Read the spec with the person who asked for the feature and get a yes. That approval is the first gate.

Claude CodeAbout 30 min

2. Plan in plan mode, without touching code

Start Claude Code in plan mode so it can read the codebase but cannot edit files until you approve:

claude --permission-mode plan

In a running session, Shift+Tab cycles modes until the status bar shows plan mode. Then ask for a plan against the spec. The writing-plans skill pushes the agent towards small tasks with exact files and test steps.

Plan prompt · Claude Code (plan mode)
Read specs/[FEATURE].md and the code it touches. Write an implementation plan. - Break the work into tasks of under an hour each, in order. - For each task: the files to change, the test to write first, and which acceptance criteria it covers. - List assumptions and anything in the spec you think is wrong or missing. - Every acceptance criterion must be covered by at least one task. Save nothing yet. Show me the plan.

Read the plan as you would a design review. Push back on tasks that are too big, files you did not expect to change, and any criterion that has no test. When it is right, approve it and ask the agent to save it as specs/[feature]-plan.md. That is the second gate.

Claude CodeAbout 60 min

3. Implement one task at a time, test first

Leave plan mode (Shift+Tab again) and work through the plan task by task. One task per prompt keeps each diff reviewable. The test-driven-development skill keeps the agent writing a failing test before the code.

Task prompt · Claude Code
Implement task [N] from specs/[FEATURE]-plan.md. 1. Write the test for this task first and run it. Show me that it fails for the right reason. 2. Write the smallest change that makes it pass. 3. Run the full test suite and the linter. 4. Stop and summarise: files changed, tests added, and anything you had to do that the plan did not say. Do not start the next task.

Review the diff after each task and commit it. If the agent reports a deviation from the plan, decide whether to update the plan or reject the change. Silent drift between plan and code is what this process exists to stop.

Claude CodeAbout 20 min

4. Verify against the spec, criterion by criterion

When the tasks are done, ask for evidence rather than a summary. The verification-before-completion skill exists for this: no “done” without having run the checks and read the output.

Verification prompt · Claude Code
Verify the feature against specs/[FEATURE].md. For each acceptance criterion, give: the criterion, the test or command that proves it, the actual output you saw when you ran it now, and PASS or FAIL. Run every command fresh; do not rely on earlier runs. Then list anything in the spec's Out of scope section that the code does anyway, and any criterion you could only check by reading code rather than running something.

Run one or two of the checks yourself. If a criterion can only be “verified” by reading code, write a test for it or check it by hand.

GitHubAbout 20 min

5. Open the pull request with the spec attached

Put the spec, plan and verification table in the pull request description, or link to them. Reviewers then check the code against agreed behaviour instead of reverse-engineering intent from the diff. Ask reviewers to read the spec first. The reviewing AI-written code article covers what to look for in the code itself.

EditorAbout 20 min

6. Close the loop: update the spec with what you learned

Before merging, update the spec with any decision made during implementation, and mark open questions as answered. Keep specs in the repository next to the code. The next change to this feature starts from an accurate description of what it does, which is worth more to the next agent session than any amount of chat history.

Check it worked

Verification checklist

0 of 7 done

When it goes wrong

If the agent starts coding during the spec step, tell it to stop and only ask questions, or switch to plan mode early. Specs written after the code describe what was built, not what was wanted.

If the plan is one giant task, ask for tasks under an hour each with one test each. Large tasks produce large diffs nobody reviews properly.

If implementation drifts (“I also refactored the auth module”), revert the unrelated part and add a rule to your instruction file: changes outside the plan need approval first.

If verification says PASS but you can break the feature by hand, the test checks the wrong thing. Add your manual case as a test and re-run the verification.

Variations

With GitHub’s Spec Kit, install the CLI with uv tool install specify-cli and run specify init my-project --integration claude (or copilot, codex, cursor-agent and others). Inside the agent you then run /speckit-constitution once per project, followed by /speckit-specify, /speckit-plan, /speckit-tasks and /speckit-implement for each feature, reviewing each result before the next. The command syntax differs per agent, so check Spec Kit’s integration page for yours.

In Kiro, create a feature spec and Kiro generates requirements.md, design.md and tasks.md for you to review in turn, then runs tasks from the task list. Bugfix specs use bugfix.md instead of requirements. The approval gates are built in; your job is still to read each file before moving on.

For teams, store specs in a specs/ folder and add a line to AGENTS.md: “For features, follow specs/README.md: spec, plan, tasks, verify.” The write a useful AGENTS.md workflow shows how.

The spec-driven development and plan mode entries give short definitions. If you are new to the agent itself, start with your first Claude Code session. A written plan also lets you run two agents in parallel with git worktrees and compare them. The AI-assisted software engineering path covers the wider practice, and more recipes are in the AI workflow examples hub.

Outcome and tools

Outcome
A merged feature with a written spec, an approved plan, passing tests for each acceptance criterion and a verification note that maps criteria to evidence.
For
Developers, Team leads
Variants for
Claude Code, Kiro, Codex, GitHub Copilot

Check your understanding

Spec-driven feature build quiz

The four gates of spec-driven development with an agent: an approved spec, a plan made in plan mode, test-first tasks, criterion-by-criterion verification, and keeping the spec current.

8 questions · pass mark 70%

Question 1 of 80 answered
  1. Which is a good acceptance criterion for a CSV export feature?
  • Spec-driven development

    Writing a specification and implementation plan before letting an agent implement, then checking the result against the spec.

    Glossary

  • Plan mode

    An agent mode in which it reads and researches the code and proposes a plan, without editing any files until you approve the plan.

    Glossary

  • Write a useful AGENTS.md: example, template and test

    An AGENTS.md example and template with build and test commands, conventions and traps, plus a before-and-after task that shows whether the file actually helps.

    WorkflowBeginner30 min6 steps

  • Reviewing AI-written code: what to look for

    The ways agent-written diffs fail, a practical review checklist, and how to set up the work so review stays manageable.

    Article

  • Rolling out coding agents to a team

    Roll out coding agents to a team: shared instruction files, permissions and hooks, spec-first work, agent review in CI and vetted Agent Skills for everyone.

    Learning pathIntermediate14 h16 steps

Back to top