LambdaWorks
Product InnovationTech ExcellenceAI EnablementOur WorkBlogGet in touch
LambdaWorks
Home
SERVICES
Product Innovation
Tech Excellence
AI Enablement
Music Industry
TypeScript Services
Scala Services
SPRINTS
MVP Sprint
Modernization Pilot
AI Validation Sprint
Ongoing Dev
Software Factory
ABOUT
Company
Our Work
Blog
Careers
Contact
Tech Radar
Privacy Policy
office@lambdaworks.io
+381 63 834 94 29
Miše Dimitrijevića 12
Novi Sad, Serbia
InstagramLinkedInX
2026 © LambdaWorks d.o.o.
We build digital products.
  1. Home
  2. /Blog
  3. /Spec-driven development with Claude Code
AI & AgentsSoftware DesignTutorial

Spec-driven development with Claude Code

Dimitrije Bulaja introduces spec-driven development, compares GitHub Spec Kit, OpenSpec, and GSD, and walks through a feature in Claude Code. Learn how each framework structures requirements, planning, and implementation.

Dimitrije BulajaDimitrije Bulaja·Nov 12, 2026·12 min read

Give Claude Code a short prompt to add custom aliases to a URL shortener, and you’ll probably have working code within minutes. The problem shows up the next day, when you open a new session and continue the work. The agent may pick different validation rules or error codes, because nothing from the first session tells it what was decided.

Spec-driven development fixes this by putting those decisions in a file that you write once, review with your team, and keep next to the code. Below, I cover what belongs in a spec, why it helps developers and QA as much as the agent, and how GitHub Spec Kit, OpenSpec, and GSD approach the idea. At the end, there’s a small feature built step by step in Claude Code.

Where Prompt-Only Workflows Break Down

Prompting an agent directly works well for small, well-understood changes. It gets fragile as soon as the feature still contains decisions nobody has made, for two reasons.

First, a prompt disappears. It lives in a chat session that gets compacted or closed, so nobody can review it, and the next session can’t build on it. The code itself survives, but the reasoning behind it doesn’t.

Second, a short prompt rarely covers everything. When something is missing, the agent decides on its own, and those decisions are easy to miss in review. On a client project, the edge case nobody wrote down is often the one that shows up in production. Finding it after release costs more than a comment on a spec.

What Is Spec-Driven Development?

Spec-driven development (SDD) treats a written specification as the primary artifact of a change, and the code as something derived from it. You describe what the feature must do and why before the agent decides how.

This idea isn’t new. Design docs, RFCs, and acceptance criteria have been around for decades. What changed is who reads them. In a traditional team, a spec gets read once in a review meeting and then often quietly drifts out of date. With an agent, the spec is read at the start of every task, so a stale spec steers every future change.

A useful spec usually has five parts:

  • Goal. The problem this change solves, in one or two sentences.
  • Behaviour. Concrete scenarios, including what happens when the request fails.
  • Constraints. Limits the solution must respect, such as performance, security, and compatibility.
  • Out of scope. What you are deliberately not building, so the agent does not invent extra work.
  • Acceptance criteria. How you will know the change is done, ideally as checks a test can run.

Spec, Code, and Tests: Who Owns the Truth?

Once a spec exists, someone will eventually ask which one is right when the spec and the code disagree. It’s worth deciding this up front:

  • The spec owns behavior. To learn which aliases a user is allowed to pick, you read the spec.
  • The code owns implementation. Renaming a class or optimizing a query shouldn’t require a spec change.
  • The tests keep the two honest. Every scenario in the spec maps to at least one test, so a green build means the code still matches the spec.

Birgitta Böckeler from Thoughtworks splits SDD into three levels. In spec-first development, a spec guides a task and then it’s left behind. In spec-anchored development, the spec stays in the repo and evolves with the feature. In spec-as-source development, humans edit only the spec and the code is generated from it.

Spec-first is a fine way to start, but a spec nobody updates can’t be the source of truth for long. Spec-as-source is still experimental. Spec-anchored sits in the middle, and that’s the level I’d aim for: the spec changes in the same pull request as the code and always describes how the system behaves today.

One Document for Developers, QA, and the Client

The agent isn’t the only one who benefits from a spec. Today, a requirement often lives in three places at once: the ticket, the code, and QA’s test plan. Each is a slightly different interpretation, and bugs can grow in the space between them.

A spec in the repo gives every role the same starting point:

  • The client or product owner defines the goal, the user scenarios, and what’s out of scope.
  • Developers add the constraints, the technical design, and the task breakdown.
  • QA contributes the acceptance criteria, edge cases, and failure scenarios.
  • The agent implements the tasks after the team approves the spec.

QA gains the most. Instead of reverse-engineering a feature from a ticket and a pull request, QA reviews the scenarios before development starts and adds the cases they know tend to break. Later, they verify the result against those same scenarios, so the spec effectively becomes the test plan. Misunderstandings surface during planning, when fixing them takes a comment rather than a rewrite.

Product and client define the goal, scenarios, and scope; developers add constraints, design, and tasks; QA adds acceptance criteria and edge cases. These contributions form a reviewed specification, followed by agent implementation, team verification, and updates to the spec alongside the code.
The team reviews one behavior contract before implementation and keeps it current as the feature changes.

We use the same idea in Pogon, our software factory. In our JVM-to-Rust migration, every implementation run started from a specification the team had already reviewed.

Getting Started with Spec Kit

You don’t need to invent the workflow or the commands. Several open-source frameworks already package it, and the best known one is GitHub Spec Kit.

Spec Kit adds a sequence of commands to your agent, and each one produces a markdown artifact for the next:

Terminal
uv tool install specify-cli
specify init my-project --integration claude
Claude Code · Spec Kit
/speckit-constitution   # project-wide principles
/speckit-specify        # what and why
/speckit-clarify        # optional: resolve open questions
/speckit-plan           # the technical approach
/speckit-checklist      # optional: check requirement quality
/speckit-tasks          # small, ordered steps
/speckit-analyze        # optional: check spec, plan, and tasks for consistency
/speckit-implement      # write the code
/speckit-converge       # compare code to the spec, add tasks for what's missing
# Commands as of Spec Kit v1.3.3 (November 2026).

The steps are clear, and the clarify and analyze commands catch gaps before any code exists. That makes Spec Kit a strong choice for new products and MVPs, where a team benefits from a fixed path.

The trade-offs show up on long-lived projects. Spec Kit creates a new spec for each change, so over time you collect many feature specs rather than one current description of the system. It also produces a lot of files per feature, which is heavy for a medium-sized change in an existing codebase.

OpenSpec and the Living Spec

OpenSpec takes a lighter approach and organizes everything around change proposals:

Terminal
npm install -g @fission-ai/openspec@latest
openspec init
Claude Code · OpenSpec
/opsx:explore   # optional: think through the problem first, no code
/opsx:propose   # proposal, spec changes, design, and tasks
/opsx:apply     # implement the tasks
/opsx:archive   # merge the change into the living spec
# Commands as of OpenSpec v1.17.0 (November 2026).

A change in progress lives in openspec/changes/. When the work is done, archiving it merges its requirements into openspec/specs/, so the specs describe how the system behaves now, but only for the parts that have gone through a change. That single step makes OpenSpec spec-anchored by design.

It also fits existing codebases well, since it adds specs to a repo without asking you to restructure anything. The living spec starts empty, though, so either write baseline specs for the areas you care about or let it fill up one change at a time.

A proposal works like a pull request for behavior: the client, developers, and QA review the change to the contract before anyone writes code.

The lighter structure has a cost. OpenSpec guides you less than Spec Kit, so the quality of your specs depends more on how seriously your team reviews them.

Where GSD Fits

GSD comes up often in the same conversations, but it solves a slightly different problem. Its maintainers position it as a way to keep coding agents consistent from one session to the next. Its main target is context rot, the drop in quality that happens as the agent’s context window fills up.

Its workflow is built around a project roadmap split into phases:

Terminal
npx @opengsd/gsd-core@latest --claude --local
Claude Code · GSD
/gsd-new-project      # questions, requirements, roadmap
/gsd-discuss-phase 1  # lock in implementation decisions
/gsd-plan-phase 1     # research, then small plans checked against requirements
/gsd-execute-phase 1  # run each plan in a fresh subagent context
/gsd-verify-work 1    # human acceptance testing
/gsd-ship 1           # open a pull request (needs GitHub CLI)
# Commands as of GSD Core v1.20.1 (November 2026).

GSD keeps its state in .planning/ files like REQUIREMENTS.md, ROADMAP.md, and STATE.md, runs each plan in a clean context, and makes an atomic commit per task. It also ships quality gates such as /gsd-code-review, which reviews every file a phase changed. For long autonomous sessions, that’s a real strength.

For our kind of work, it’s less of a fit as the main framework. GSD organizes work around a roadmap of phases that the agent drives through, not around a reviewed, living description of system behavior. Its requirements trace to phases, but when a milestone is completed, REQUIREMENTS.md and ROADMAP.md are archived to .planning/milestones/ and REQUIREMENTS.md starts fresh, rather than merging into one current spec. The installer also pre-approves the Claude Code permissions GSD needs, so on client projects, review those settings before you run it.

A Real Feature, Step by Step

Here’s how the URL shortener example from the introduction looks with OpenSpec in Claude Code. The service already creates short links with random codes, and users now want to choose their own alias, like sho.rt/team-offsite.

First, give the agent a few project-wide rules. Claude Code reads CLAUDE.md at the start of every session, so keep it short:

CLAUDE.md
# Project rules
- Scala 3, ZIO 2. Errors are typed; no thrown exceptions in domain code.
- Run `sbt test` before marking any task done.
- openspec/specs is the source of truth for behavior.
- If a spec is ambiguous, stop and ask. Do not guess.

Next, /opsx:propose let users choose a custom alias for a short link. The agent reads the existing links spec and drafts the change:

OpenSpec · Custom aliases
### Requirement: Custom aliases
The system SHALL let users create a short link with an alias they choose.

#### Scenario: Alias is available
- WHEN a user requests an alias of 3 to 30 letters, digits, or hyphens that nobody uses
- THEN the short link is created with that alias

#### Scenario: Alias is already taken
- WHEN a user requests an alias that another link already uses
- THEN respond 409 with error code ALIAS_TAKEN

#### Scenario: Alias has invalid characters
- WHEN a user requests an alias with spaces or other unsupported characters
- THEN respond 400 with error code INVALID_ALIAS

The proposal goes up for review while there’s still no code. QA spots two cases nobody else thought about. What happens if someone picks login or api as an alias, which would shadow the app’s own routes? And are Team-Offsite and team-offsite the same alias or two different ones? The first becomes a new scenario that returns 400 RESERVED_ALIAS, and the client decides that aliases are case-insensitive. Both decisions take a few comments in a markdown diff instead of a bug report after release.

After approval, /opsx:apply implements the tasks, with an integration test for each scenario. QA checks the result against the scenarios they already reviewed, and /opsx:archive merges them into the living spec. Tomorrow’s fresh session, or a new teammate, starts from a spec that matches the code.

Picking a Tool for Your Project

All three tools agree on the core idea. They differ in what they treat as the main artifact:

Spec KitOpenSpecGSD
Main artifactA spec, plan, and tasks per featureOne living spec plus change proposalsA project roadmap split into phases
Strongest atGuided structure for new projectsLong-lived and existing codebasesLong autonomous sessions without context rot
Team fitTeams that want a fixed processTeams that review changes togetherDevelopers who want the agent to drive a roadmap
CeremonyMediumLowMedium

For client work at LambdaWorks, I’d start with OpenSpec. A living spec that changes in the same pull request as the code answers the source-of-truth question, and proposals give developers, QA, and the client one place to agree before implementation. For a new MVP, Spec Kit is a good alternative because its guided path helps a fresh team move quickly. Other tools, like BMAD Method and AWS’s Kiro, take the idea even further with more agents or a dedicated IDE, but they add more processes than most projects need.

Whichever tool you choose, keep it proportional. A two-line bug fix doesn’t need a proposal, and a spec nobody reads is just extra paperwork.

Final Thoughts

With AI-first development, the cost of writing code has dropped a lot, and the cost of a wrong decision hasn’t. An agent can implement a misunderstood requirement just as quickly as a correct one, so the time a team used to spend writing code now goes into making sure everyone agrees on what to build. That’s where a spec earns its place.

For me, the biggest change wasn’t the agent’s output, but where discussions happen. When developers, QA, and the client review a spec together, most of the questions that used to come up in code review come up earlier, while changing the plan still takes minutes. And because the spec lives in the repo, every new session starts from those decisions instead of from scratch.

If you want to try it, pick one non-trivial feature on your current project and write a proposal before any code. It’s a small experiment, and it quickly shows whether the approach fits your team.

For help applying this workflow to your product, see our software engineering services.

References:

  • Understanding spec-driven-development: Kiro, spec-kit, and Tessl
  • OpenSpec
  • Spec Kit
  • Migrating JVM Microservices to a Rust Monolith with a Software Factory
  • GSD Core documentation
Share on:

On this page

  1. Where Prompt-Only Workflows Break Down
  2. What Is Spec-Driven Development?
  3. Spec, Code, and Tests: Who Owns the Truth?
  4. One Document for Developers, QA, and the Client
  5. Getting Started with Spec Kit
  6. OpenSpec and the Living Spec
  7. Where GSD Fits
  8. A Real Feature, Step by Step
  9. Picking a Tool for Your Project
  10. Final Thoughts

More from the LambdaWorks blog

AI & AgentsSoftware DesignCase StudyOct 30, 2026

Migrating JVM Microservices to a Rust Monolith with a Software Factory

How we used Pogon (our software factory), custom migration skills, and configurable workflows to preserve behavior while moving JVM services into a Rust modular monolith.

Stefan RistanovićStefan Ristanović
AI & AgentsOct 15, 2026

Circling Around Harnesses: Why Pi Won Me Over

Harnesses are the new editors. We explain Pi and how a minimal, extensible harness finally ended the search for one tool that bends to your workflow instead of the other way around.

Miloš TepićMiloš Tepić
Software DesignJun 19, 2026

Error Handling in Scala: Navigating Try, Either, and ZIO

A reliable Scala application requires thinking about failure from the start of its development.

Dimitrije BulajaDimitrije Bulaja

Have a project in mind?

Tell us what you're building. We'll tell you how we'd approach it.

Let's talk

An Agentic Software Development Agency

office@lambdaworks.io·+381 63 834 94 29

Miše Dimitrijevića 12, Novi Sad, Serbia

Privacy Policy
2026 © LambdaWorks d.o.o.

An Agentic Software Development Agency

office@lambdaworks.io+381 63 834 94 29

Miše Dimitrijevića 12, Novi Sad, Serbia

SERVICESProduct InnovationTech ExcellenceAI EnablementMusic IndustryTypeScript ServicesScala Services
SPRINTSMVP SprintModernization PilotAI Validation SprintOngoing DevSoftware Factory
ABOUTCompanyOur WorkBlogCareersContactSoftware Factory
Privacy Policy
InstagramLinkedInX
2026 © LambdaWorks d.o.o.