Spec-Driven Development: Structured AI Coding Beyond Vibe Coding
TL;DR
- Spec-driven development shifts AI coding from reactive "vibe coding" to a proactive, context-rich process, enabling developers and models to collaboratively define program behavior before implementation, thereby reducing errors and maintaining intent.
- By formalizing program intent into specifications and requirements, spec-driven development provides a persistent, version-controlled artifact that acts as a compass, allowing for easier navigation and correction of deviations during development.
- Declarative programming, exemplified by SQL, allows developers to specify desired outcomes rather than step-by-step instructions, a paradigm mirrored in spec-driven development's focus on "what" the program should do, abstracting away implementation details.
- Kiro's integrated approach, separating requirements, design, and tasks into distinct documents, helps manage complexity and provides a structured framework for AI-assisted development, mitigating the risk of LLMs losing context over long development horizons.
- "Steering" documents provide organizational context and best practices to AI models, guiding their decision-making to align with established standards and ensuring consistency beyond explicit requirements, akin to code review feedback.
- The core skill of crisply explaining desired program outcomes, whether through natural language, mockups, or code snippets, remains a durable and increasingly important competency for developers navigating AI-assisted development.
- Neuro-symbolic AI, combining neural networks with symbolic reasoning, promises to enhance LLM capabilities by grounding them in formal computer science principles, leading to more robust and accurate code generation and API integrations.
Deep Dive
Spec-driven development, particularly as implemented through tools like Kiro, represents a significant evolution in AI-assisted coding, shifting from ad-hoc "vibe coding" to a more structured, declarative approach. This methodology leverages detailed specifications to guide AI, enabling developers to maintain context, manage complexity, and produce more reliable software, especially as projects scale.
The core advantage of spec-driven development lies in its ability to combat the inherent ambiguity and context-loss common in prompt-by-prompt AI coding. By first establishing a clear specification--detailing what the program should do--developers create a foundational artifact that the AI can reference throughout the development lifecycle. This structured approach mirrors historical shifts in programming, such as the move from imperative to declarative languages like SQL, where developers focus on desired outcomes rather than step-by-step execution. The specification acts as a "ground truth," allowing for easier iteration and correction when development deviates from the intended path, thereby preventing the cascading errors that can arise from fragmented AI interactions.
This structured development process has several second-order implications. First, it fundamentally changes the nature of developer-AI collaboration, moving from a reactive prompt-response loop to a more proactive, design-centric partnership. This encourages developers to think more rigorously about requirements and design upfront, a skill that remains valuable regardless of AI advancements. Second, it enables better management of complexity. Tools like Kiro break down development into distinct phases: requirements, design, and tasks. This decomposition helps manage large projects by ensuring that the AI has a clear plan and context for each stage, mirroring agile methodologies and providing a more robust framework than simply chaining prompts. Third, spec-driven development, by producing version-controlled specifications alongside code, creates a more transparent and auditable development history. This artifact allows teams to understand the evolution of a project's intent and provides a valuable resource for maintenance and onboarding. Finally, the integration of "steering" documents--which encode organizational standards and best practices--allows AI to adhere to specific coding styles and architectural patterns, ensuring consistency and quality across AI-generated code. This moves beyond simply executing instructions to embodying organizational "taste" and technical standards.
The enduring value of spec-driven development lies in its emphasis on clear communication and structured thinking--skills that transcend specific AI models or tools. While prompt engineering techniques may evolve, the ability to crisply articulate requirements and design intent will remain a critical competency. This approach, therefore, offers a pathway to harness AI's generative power more effectively, making complex software development more accessible and manageable, particularly in professional environments where reliability, maintainability, and scalability are paramount.
Action Items
- Create spec-driven development framework: Define 3-5 core components (specification, requirements, design, tasks) for structured AI-assisted coding.
- Draft initial specification document: Outline program functionality and desired outcomes for 1-2 small, achievable projects.
- Implement steering document: Document 3-5 organizational standards or best practices for AI code generation consistency.
- Audit 10-15 generated code snippets: Evaluate for adherence to requirements and identify areas for prompt refinement.
- Track prompt evolution: For 2-3 complex features, document prompt changes and their impact on generated code quality.
Key Quotes
"You know, this AI space is moving so fast, there are so many new concepts and so, and you know, and some reusing of old concepts too."
Marc Brooker explains that the rapid advancement of AI introduces many novel ideas, but also reintroduces or recontextualizes existing concepts. This highlights the dynamic nature of the field, where innovation often builds upon or repurposes prior knowledge.
"Spec-driven development is this idea that, hey, instead of starting with writing a program with the AI, you know, the AI model and and the developer are going to work together to write a specification, just a a description of what the program does and step through that, and then write some requirements of like, well, hey, I want to build this in Python, I want to use these libraries, I don't want to use these libraries, I want it to work on these operating systems and so on."
Marc Brooker defines spec-driven development as a collaborative process between a developer and an AI model. This approach prioritizes creating a detailed specification and requirements document before writing code, contrasting with prompt-by-prompt AI coding.
"I think we all know that you don't always know that completely upfront; you discover that as you go. And so, you know, I don't want to imply that these specs are an immutable artifact. What you're going to do as you develop and as you test and as you talk more to your customers is keep going back and updating the spec and saying, well, here's what I've learned, here's some new user stories, here's some new requirements."
Marc Brooker emphasizes that specifications are not static documents. He explains that as development progresses and feedback is gathered, specifications should be iteratively updated to reflect new learnings and evolving requirements.
"Imperative programs are like, do this, and then do this, and then do this, do this loop. Add these numbers together and so on. And that's what a lot of, you know, is especially the Python code, the C code, the Rust code that people are writing. It's like, and then there's this other approach to coding which is more declarative, which is, I want this result. You know, it's more like, go off and figure out how to do this result."
Marc Brooker differentiates between imperative and declarative programming. He describes imperative programming as a step-by-step instruction set, common in languages like Python, while declarative programming focuses on specifying the desired outcome, leaving the execution details to the system, as seen in SQL.
"I think that tasks file is somewhat an artifact of the limitations of today's LLMs and their ability to do things over long time horizons. And so forcing the LLM to say, make a plan, make a plan to achieve this, really helps it kind of do things in bite-sized chunks and not get lost along the way."
Marc Brooker explains that the "tasks file" in Kiro is a way to manage LLM limitations. He notes that by breaking down development into smaller, planned tasks, LLMs are better able to execute complex processes without losing track of the overall goal.
"The fundamental skill of, you know, listening to your users or or thinking about your business and crisply writing down what you want to achieve, that's been a great skill for programmers to have for 40 years. It's going to be a great skill for, you know, for folks to have in another 40 years. I don't see that changing. And so that's the core of spec-driven development is getting good at at crisply explaining what you know what a program should do."
Marc Brooker identifies the core of spec-driven development as the enduring skill of clearly articulating desired outcomes. He asserts that this ability to listen to users and precisely define program objectives is a foundational programming skill that will remain valuable for decades to come.
Resources
External Resources
Books
- "The Pragmatic Programmer: Your Journey to Mastery" by Andrew Hunt and David Thomas - Mentioned as an example of a book that provides practical advice for developers.
Articles & Papers
- "Understanding Spec-Driven Development, Kiro, Spec Kit, and Tessell" (Martin Fowler com) by Brigitta Buckeller - Mentioned as an article exploring spec-driven development and related tools.
People
- Mark Brooker - VP and Distinguished Engineer at AWS, guest discussing specification-driven development and Kiro.
- Christopher Trudo - Mentioned in relation to discussions about good taste in programming and behavior-driven development.
- Simon Willis - Mentioned for his work on AI coding and prompt engineering.
- Edgar F. Codd - Mentioned in relation to the development of SQL.
Organizations & Institutions
- AWS (Amazon Web Services) - Employer of guest Mark Brooker.
- University of Cape Town - Where guest Mark Brooker completed his PhD.
- Amazon - Company where guest Mark Brooker works.
Tools & Software
- Kiro - An integrated development environment (IDE) from Amazon built around turning prompts into structured requirements.
- VS Code - Mentioned as the platform Kiro is built upon, supporting plugins and familiar IDE features.
- QCLI - A command-line interface tool that uses the same technology as Kiro.
- FileMaker - Mentioned as a tool used to build applications that could be demonstrated in interviews.
- SourceForge - Mentioned as a platform where code was hosted before GitHub existed.
- GitHub - Mentioned as a platform for hosting code.
- Blender - Mentioned as a tool for creating graphics, but its G-code output was noted as problematic.
- AutoCAD - Mentioned as a tool that can fix G-code issues.
Websites & Online Resources
- realpython.com - Website for Real Python, offering tutorials, courses, and podcast information.
- brooker.co.za - Guest Mark Brooker's blog.
Other Resources
- Spec-driven development - An approach to development where developers and AI work together to write specifications outlining what a program should do.
- Vibe coding - An AI-powered coding method described as a prompt-by-prompt approach.
- Declarative programming - A programming paradigm where developers specify what they want the outcome to be, rather than how to achieve it.
- Imperative programming - A programming paradigm where developers specify a sequence of commands to achieve a result.
- SQL (Structured Query Language) - An example of a declarative programming language used for databases.
- G-code - An esoteric language used by programmable tools for metalworking.
- Towers of Hanoi - A classic small example used for practicing programming concepts.
- Behavior-driven development (BDD) - A development methodology that emphasizes collaboration and user stories.
- Neuro-symbolic AI - An emerging field combining neural networks with symbolic reasoning for AI development.
- MPC servers - Used to plug additional context and information into IDEs for AI models.
- Agent core - An AWS infrastructure for running agents.
- Strands agent framework - A framework for building agents.
- Python coding with AI learning path - A resource on realpython.com covering AI coding features, prompt engineering, and more.
- G-code linter - A tool developed to add sanity checks to G-code.