
How to build software with Spec-Driven Development and intelligent agents
The way software is built is undergoing a fundamental shift. For years, the traditional workflow has involved interpreting isolated requirements from a board, manually transcribing that logic into code, and, if time allowed, documenting the system afterward. However, with the maturation of artificial intelligence, this paradigm has been inverted. The most efficient approach today consists of designing a rigorous technical specification first and delegating the construction of the codebase to intelligent agents.
This methodology is known as AI-powered Spec-Driven Development (SDD). In this article, we will analyze how this approach works, which tools make up its ecosystem, and how to use structured specification files to orchestrate software generation at the architecture and business logic level.
The problem: The gap between design and implementation
In the standard development cycle, technical information is often scattered. Architecture decisions reside in static diagrams, acceptance criteria in agile management tools, and the actual implementation in the code repository. When a developer takes on a task, they must mentally consolidate these pieces before writing the first line of code.
This traditional approach presents systemic issues:
Chronic desynchronization: As code evolves to fix bugs or add patches, architectural documentation and original requirements become obsolete almost immediately.
Ambiguity in execution: User stories rarely contain the necessary technical depth, forcing the developer to make architectural decisions on the fly during implementation.
Repetitive workload: Engineers invest a significant number of hours writing configurations, defining data models, and structuring boilerplate code instead of focusing on complex business logic.
What is Spec-Driven Development (SDD) in the AI era?
Spec-Driven Development is based on a clear principle: the contract or system definition is the single source of truth. All subsequent development must be strictly derived from this central document.
Historically, SDD was applied in a limited way to API contracts using standards like OpenAPI. However, with the integration of artificial intelligence agents, the concept now covers the entire application lifecycle. The specification is managed through plain text files, primarily using Markdown format (.md), which coexist in the same repository as the source code.
In this workflow, .md files contain all SDD information: from architectural design and network integrations, to the technology stack and detailed backlog. The AI agent consumes these files, assimilates the global system context, and generates the corresponding code while respecting the established constraints.
Tools for implementing SDD with agents
For this model to be operational, it requires integrating tools that connect human definition with the AI generation engine.
1. Specification files as code
The primary means of specification is Markdown files. Being versioned alongside the project, they allow for auditing and traceability. Typically, they are divided by knowledge domains:
architecture.md: Establishes design patterns, communication protocols, security strategy, and infrastructure topology.
stack.md: Defines the programming language, frameworks, libraries, and allowed testing tools.
features.md / backlog.md: Details use cases, validation rules, and acceptance criteria at a technical level.
2. Local implementation environment
Visual Studio Code (VS Code) is currently the go-to environment for this methodology. Through integrated AI extensions, the editor acts as a bridge between text files and the operating system. The intelligent agent lives inside the editor, granting it permissions to read project context, create directory structures, refactor code, and run scripts in the terminal.

3. AI agents and models
The SDD architecture is agnostic to the underlying model. From the development environment, you can configure models such as Claude 3.5 Sonnet, GPT-4o, or open-source alternatives. The agent injects the content of the .md files into its system prompt, ensuring that the generated code meets the team's architectural standards.
Practical example: transforming SDD into generated code
To illustrate the process, let's assume we need to build a distributed system. When designing under this approach, it's common to work with distributed architectures where functionalities are split into smaller applications. For example, a user microservice would exclusively manage this entity, having its own database communication and independent business logic.
Instead of creating a single lengthy document, we divide the specifications into multiple files to ensure the single responsibility principle in documentation.
Important note: The following is a simplified example for demonstration purposes. In a production environment, SDD files are considerably longer and more exhaustive. In agent-driven development, the fundamental rule is: any technical decision, validation, or flow that is not explicitly specified in the Markdown file will be left open to the AI's free interpretation (and possible hallucination).
File 1: architecture.md
Defines how the microservice interacts with its ecosystem.
Markdown
# Architecture: User Microservice
- **Architectural Pattern:** Hexagonal Architecture (Ports and Adapters). The domain must be completely isolated from infrastructure.
- **Network communication:** This microservice does not expose public HTTP endpoints. It is invoked exclusively by an internal API Gateway using gRPC.
- **Security and Authentication:** Zero-Trust security is used between services. The microservice receives a JWT token issued by the Gateway and validates its asymmetric signature (RS256) using the public key obtained from our Identity Provider (Keycloak).
- **Persistence:** PostgreSQL database. Connections must be limited by a connection pooler (e.g., PgBouncer).
- **Fault tolerance:** The service must implement the Circuit Breaker pattern for calls to external systems.
- **Domain Events:** When persisting a user, the system must publish an asynchronous `UserCreatedEvent` to the corporate message bus (Apache Kafka) so other services can update their projections.
###
File 2: stack.md
Limits the agent's scope of action regarding the tools to be used.
Markdown
# Technology Stack and Standards
- **Platform:** Node.js (v20 LTS).
- **Language:** TypeScript with strict configuration (`strict: true`).
- **Transport framework:** @grpc/grpc-js.
- **ORM:** Prisma ORM for the database adapter.
- **Validations:** Zod for validating input schemas in adapters.
- **Testing:** Vitest for unit testing of use cases.
###
File 3: features.md
Defines the specific tasks to implement.
Markdown
# Feature: New user registration
- **Use case:** `RegisterUserUseCase`
- **Input payload (gRPC):**
- `email`: String. Must be validated against a regex for a valid corporate email.
- `password`: String. Minimum 12 characters, must contain at least one number and one symbol.
- **Business rules:**
1. The service must query the database to check if the `email` already exists. If so, return a gRPC `ALREADY_EXISTS` error.
2. Apply a key derivation function (Argon2id) to the `password` before instantiating the domain entity.
3. Save the record in PostgreSQL.
4. Emit the `UserCreatedEvent` to Kafka ensuring delivery (At-Least-Once).
- **Expected output:** Return the internal user ID generated (UUID v4). Strictly exclude any password hash from the response.
###
Executing the workflow
With the files defined and hosted in the repository, the developer opens VS Code and runs a prompt directed at the agent:
"Carefully read the files architecture.md, stack.md and features.md. Based on these specifications, initialize the Node.js project, create the directory structure based on Hexagonal Architecture (domain, application, infrastructure) and implement the User Registration use case with all the requested validations and integrations."
The agent will assimilate the context and autonomously generate the .proto files for gRPC, the Prisma schemas, the domain entities, the ports (interfaces in TypeScript), the adapters (gRPC controllers and PostgreSQL repositories) and the event publisher to Kafka, applying the requested cryptography and validations.
Considerations and implementation best practices
To scale AI-driven SDD professionally, engineering teams must internalize the following practices:
- Extreme specificity and edge case control: An agent is an excellent executor, but a poor guesser. If the specification omits how to handle Kafka server disconnection or which status codes to return in edge cases, the model will write generic code that may introduce vulnerabilities or failures in production.
- The specification is code (Review Process): .md files must be treated with the same rigor as source code. They must go through review processes (Pull Requests) among architects and developers. A conceptual error in the Markdown will propagate exponentially in the generated codebase.
- Fix the source, not the artifact: If the agent generates a defective implementation due to lack of context, the common instinct is to fix the code manually. This is an antipattern in SDD. The correct practice is to modify the .md file by adding the missing constraint and ask the agent to regenerate the module. This ensures that the technical documentation never loses sync with the actual software.
- Non-delegable technical audit: AI does not exempt the team from responsibility for the final product. The generated code must be inspected through static analysis, vulnerability scanning tools, and deep human review.
Conclusion
The convergence of Spec-Driven Development and intelligent agents represents a turning point in software engineering. By shifting cognitive effort from manual code transcription to deep design of architectures, contracts, and business rules, teams can build more robust systems at unprecedented speed.
Adopting this methodology demands a significant cultural change in development teams. It means moving away from thinking of documentation as a secondary and obsolete artifact, to turning it into the true source code of the system. In this scenario, the developer evolves from being a manual builder to becoming a system architect, using artificial intelligence as the ultimate execution engine.
Previous Posts

How to reduce tokens in coding agents - Claude, Codex, Cursor
Learn to reduce context consumption in coding agents through orchestration, specialized subagents, and reproducible measurement.

Chatbot architecture: an unbiased guide for businesses
An unbiased guide to choosing the right chatbot architecture in 2026. Compare RAG, fine-tuning, Agentic RAG, and MCP based on cost, risk, and use case.
