Product
Spec-Driven Development (SDD) Tool

Spec-Driven Development Tool

A step-by-step guide to turning a domain model into working code with your coding agent.

Introduction

Coding agents are good at writing code, but not at knowing what your business needs. Qlerify fills that gap.

You model the process with the people who understand it, validate the model, push it to your repository as a specification file, and let your coding agent build from it. The model lives in version control next to the code, so every later change starts from the same source of truth.

‍

What does the specification contain?

The specification is a machine-readable JSON file, not a picture of a diagram. It covers every bounded context in the workflow and marks the one you push from as the current context. For each context it describes:

  • Aggregates and their aggregate roots
  • Entities and value objects, with every attribute's type, cardinality, required flag and constraints
  • Commands and their input fields
  • Domain events emitted by each command
  • Read models available to the actor before a command is invoked
  • Given-When-Then acceptance criteria

That is enough for an agent to derive a database schema, an API surface, handler logic that enforces the invariants, and test coverage for all acceptance criteria.

‍

Before you start

You need:

  • A workflow with a domain model. If you do not have one yet, start with Event Storming, Event Modeling or Domain-Driven Design, or reverse-engineer one from existing code.
  • At least one bounded context. Push Spec is enabled for a context once it contains an aggregate.
  • A GitHub account. Connect it from Account → Integrations or in Step 3 below.
  • A coding agent. Claude Code, Cursor, Antigravity IDE and Gemini CLI support every step. Claude Web, Claude Desktop, Lovable, VS Code and ChatGPT connect over MCP; see the setup instructions for what each supports.

‍

Step 1: Validate the domain model

Open the Domain Model tab, pick a bounded context, and switch to Push Spec.

Validate Domain Model checks the whole context and groups its findings into Major Issues, Minor Issues and Notices. Click an issue to go to the element that caused it.

Fix the major issues first. They lead to broken code: two domain events with the same name, a command with no parameters, a command field that points to a different entity than the entity field it maps to, or a read model that references an entity that does not exist. Minor issues and notices are worth reading but do not block you.

Screenshot of a software interface's Push Spec tab under Payment Processing showing four steps in order: Validate, Review Spec, Connect GitHub, and Push Spec. The tab displays issues grouped by severity: major, minor, and notices, with a summary of 1 major, 2 minor, and 1 notice. Major issues include a missing entity reference for the field 'order' on the 'Authorize Payment' command. Minor issues relate to unmatched fields 'deliveryStatus' and 'deliveredAt' on the 'Get Delivered Order Payment' model. Notices mention no entity reference for 'Get Payment Provider Limits.' Each issue has an arrow to click to jump to it.
Note: Validation is advisory. You can push a model that still has open issues, and your agent runs its own pre-flight scan and asks about anything it cannot resolve.

‍

Step 2: Review the specification

Review Spec shows the exact file you will push. You can toggle between JSON and YAML.

If the repository already contains an older version of the file, this step shows a diff instead, so you can see what changed since the last push.

Click Approve Changes when the specification is correct. The push button stays disabled until you approve, which keeps an unreviewed model out of your repository.

Screenshot of a software interface titled 'Payment Processing' showing a step-by-step sidebar with 'Review Spec' selected and a code editor displaying a JSON schema for a domain model with roles, domain events, and acceptance criteria, accompanied by green labels highlighting options for JSON or YAML formats and approval before pushing changes.

Step 3: Connect to GitHub

Connect to GitHub links the bounded context to a repository. Pick an account, choose an existing repository or create a new one, and select a branch.

Use the repository that contains your application code, so the model and the code stay together.

User interface screen showing step 3, Connect to GitHub, with four labeled actions: Pick your GitHub account from a dropdown, choose the repository from a list that includes NoteHub and payment-processing versions, select the branch from a dropdown displaying 'main', and link the repository with buttons to create or link it.

Step 4: Push the specification

Push Specification to GitHub asks for a File path in repository. The default is qlerify-domain-model.json. If you plan to push more than one context, name each file after its context, for example orders-domain-model.json.

Click Push Specification. When the file in the repository matches the model in Qlerify, the step shows Up to date.

User interface screen showing the Payment Processing steps with all four steps checked: Validate, Review Spec, Connect GitHub, and Push Spec. The Push Specification to GitHub section displays a file path named payment-processing.json and a confirmation message indicating the specification is up to date and in sync with the repository.

Step 5: Connect your coding agent

Your agent can now read the specification from the repository. Connecting Qlerify over MCP also lets the agent read workflows directly and write changes back later.

  1. Go to Account → Integrations and click Generate API Key under MCP API Key.
  2. Open Setup Instructions and pick your coding agent.
    For Claude Code, run this command:
claude mcp add --transport http qlerify https://mcp.qlerify.com \
--header "x-api-key: YOUR_API_KEY"

Then install the companion plugin, which adds the Qlerify skills:

/plugin marketplace add qlerify/qlerify-plugins
/plugin install mcp-companion@qlerify-plugins

The dialog has equivalent instructions for Cursor, Antigravity IDE, Lovable, VS Code, Gemini CLI, Claude Web, Claude Desktop and ChatGPT.

MCP Setup Instructions window showing client options including Claude Code CLI, Cursor, Antigravity IDE, Lovable, VS Code, Gemini CLI, Claude Web, Claude Desktop, ChatGPT, and Qlerify Skills. Instructions detail setting up Claude Desktop with Qlerify as a custom connector via OAuth, including opening Customize Connectors, adding custom connector, naming it Qlerify, and entering URL https://mcp.qlerify.com/mcp, then signing in. Labels highlight to Pick your client, Optional skill packs, and Your MCP server URL with a copy button.

Step 6: Generate the application

Clone the repository, start your agent in that folder, and run:

/code-generation

The agent works through six phases:

  1. Acquire the model. It reads the pushed specification file, or lists your Qlerify workflows over MCP and asks which one to build from.
  2. Pre-flight scan. It reports its findings and asks only about hard blockers, such as an event with no aggregate root or an acceptance criterion that contradicts an invariant.
  3. Choose the platform. It asks once where the app should run and proposes one recommended stack by default. If you name a stack, it uses that instead, including older or unconventional choices.
  4. Map the model to storage. Aggregate boundaries become transaction boundaries. Owned entities and value objects go with their root. Cross-aggregate effects propagate through domain events, keeping each aggregate in its own transaction.
  5. Generate. Project scaffold, persistence schema, aggregate types with invariant guards, command handlers behind pluggable authorization, the API surface, read models, domain event emission, one test per Given-When-Then, and a frontend.
  6. Test and iterate. It runs the test suite, fixes failures, and asks you only if a test still fails after three attempts, since that usually points to a problem in the model.
Screenshot of a terminal interface from Qlerify showing a code generation process that verifies model structure and requests user input on the software stack, recommending Fastify with Prisma/SQLite and listing its runtime, HTTP server, ORM, database, test framework, and event bus details, with annotations labeling 'Pre-flight scan', 'Recommended stack', and 'It asks, then builds'.

How long a run takes depends on the size of the bounded context and the stack you choose. The agent finishes when the test suite passes or when it stops to ask you about a test it could not fix.

The agent leaves two files in .qlerify: a copy of the model it built from, and codegen.json, which records the stack and the persistence decisions it made. Step 7 uses these files as a reference point.

‍

Step 7: Keep the model and the code in agreement

The model is only useful if it stays accurate. Run:

/sync

Sync works in both directions. Change the code, and it reads the new entities, endpoints, schemas and events and applies them to the Qlerify model. Change the model, and it detects the drift and hands off to code generation.

Two habits keep this working over time:

  • Commit the model with the code. Every pull request that changes behavior should include the updated specification file alongside the implementation. Reviewers then see the intent and the code in one place.
  • Re-push after modeling sessions. When the model changes in Qlerify, push it, then run sync to update the repository.
A screenshot of a side-by-side code comparison interface showing differences in a JSON specification related to payment processing. The left pane, labeled 'What's in the repo,' highlights a removed acceptance criteria line, while the right pane, labeled 'Your updated model,' shows the addition of a new acceptance criteria line with an expired payment method. A green box at the top says 'Review and approve before pushing,' indicating the need to approve code changes.
Note: You can import the specification file back into Qlerify at any time to recreate the full workflow and domain model, so the file also serves as a record of the system.
Best practices for spec-driven development
  • ‍
  • Acceptance criteria become tests. Every Given-When-Then scenario becomes a test in the generated code. The more precise the scenarios, the less your coding agent has to guess.
  • One spec per bounded context. Keep contexts loosely coupled and push each one as its own file, so you can generate, review and sync it independently.

Conclusion

Model the process with your team. Validate it. Push it. Let your coding agent build the app and keep the model and the code aligned as the system grows.

Your coding agent is good at writing code. Give it a clear specification to work from. Sign up for a free Qlerify account and build applications in days.