Back/Engineering/Codex/GitHub Copilot
AdvancedEngineering

Implement Features Using Spec-First Development and an AI Coding Agent

Turn a spoken feature idea into a versioned Markdown spec, then let a coding agent implement and verify it. Future changes start in the spec, which records the behavior and its history.

Implement Features Using Spec-First Development and an AI Coding Agent

Ryan shows Notion's agent-specs folder, turns a Whisper brain dump into a Markdown spec, tells Codex to build it, and uses a CLI-backed verification section to test the feature.

Before you start

What you need

  • A repository with examples of accepted specs
  • A coding agent with repository access
  • Tests or a CLI that lets the agent exercise the feature
  • A spoken or written description of the desired behavior

What you’ll make

A committed Markdown spec plus an implementation that the agent can test against the behaviors and verification steps defined in that spec.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

6 steps

Step01

Dictate or Write the Initial Idea

Describe how the feature should behave without polishing the wording. Ryan opened Whisper and talked through Ask Mode, including what users could do and what should be restricted. Include examples, edge cases, and anything you are unsure about in the raw material.

Step02

Generate a Formal Spec Document

Give the transcript to the coding agent with examples from your existing spec library. Ask for the same structure and require behavior, non-goals, code pointers, edge cases, and a Verification section with commands the agent can run.

Example prompt
Read the raw feature transcript below and the example specs in [spec library path]. Write a Markdown spec in the same format. Define user-visible behavior, non-goals, edge cases, relevant code pointers, and a Verification section with exact commands and expected results. Flag unresolved decisions instead of guessing.

[Paste the transcript here]
Step03

Commit the Spec to the Repo

Review the spec for behavior and testability, then commit it to the repository's spec folder. Ryan's team uses /agent-specs/. Use a descriptive filename and include the spec change in normal version control.

Step04

Trigger the Autonomous Build Agent

Point the coding agent to the committed spec and ask it to implement that document. The command can stay short because the requirements and verification loop already live in the repository.

Example prompt
Implement the feature defined in /agent-specs/[feature-name].md. Follow its code pointers and run every command in the Verification section. Update the implementation until the documented checks pass, then summarize the changed files and results.
Step05

Agent Builds and Verifies Autonomously

Let the agent run the build and verification loop. Ryan's team gave Codex a CLI that could start Notion AI, send prompts, toggle Ask Mode, and inspect the response. Review the recorded commands and outputs, not only the final code diff.

Step06

Maintain and Update via the Spec

When behavior changes, edit and commit the Markdown spec first. Ask the agent to bring the implementation and tests back into agreement, then preserve the spec revision and verification results in the same pull request.

Example prompt
The behavior in /agent-specs/[feature-name].md has changed. Update the implementation and tests to match the current spec, run the full Verification section, and report any code behavior that still conflicts with the document.

What good looks like

  • The spec defines behavior, non-goals, code pointers, edge cases, and verification commands.
  • The coding agent can run the verification loop without manual test execution.
  • The implementation passes the checks named in the spec.
  • A later behavior change can be understood from the spec history.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The generated spec restates the idea without defining behavior
Add examples, non-goals, edge cases, and observable outcomes. Point the model to two accepted specs and ask it to match their level of detail.
The agent cannot test the feature itself
Build or expose a CLI, test harness, or browser check that lets the agent run the feature and inspect its output. Add the exact commands to the Verification section.
The code changes but the spec no longer matches
Make the behavior change in the spec first, commit it, and ask the agent to update the implementation and verification results from that revision.
The agent tries to implement too much in one run
Split the spec at a behavior boundary, give each part its own verification section, and implement the smallest independently testable slice first.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready