Spec Driven Development: Why the Future of AI-Assisted Software Development Starts with the Specification

A developer builds a new feature in 20 minutes by chatting with an AI agent. The result looks good, the tests pass. Three days later, the team spends an entire work week fixing security vulnerabilities, adapting the architecture to the existing codebase, and removing hardcoded credentials from the repository. What started as a productivity gain ended as technical debt.

This story repeats itself thousands of times across the industry. More and more startups are relying on predominantly AI-generated code – Y Combinator reported that a quarter of accepted startups submitted codebases with 95 percent AI-generated code. But what initially excites quickly leads to disillusionment: generic code, poor architecture, security vulnerabilities. Spec Driven Development (SDD) promises a way out – by making the specification the “single source of truth” before a single line of code is written.

The Promise and the Disillusionment

When Andrej Karpathy coined the term “Vibe Coding” in February 2025 [1], the euphoria was immense. Just prompt away, watch the AI code – software development as creative conversation rather than painstaking manual labor. Within weeks, developers were building prototypes that would have previously taken weeks.

The reality looks far more sobering by now. The Stack Overflow Developer Survey 2025 [2] paints a disillusioning picture: only 3 percent of developers have “high trust” in AI-generated code, and 72 percent reject vibe coding for professional work. GitClear’s longitudinal analysis [3] of 211 million lines of code shows that code churn – code that is modified or deleted shortly after being written – has doubled since the introduction of AI coding tools, while refactoring declined by 60 percent. This means: AI produces more code, but that code has a shorter half-life. CodeRabbit [4] reports 1.7 times more issues in AI-generated code than in human-written code.

The security numbers are particularly alarming. Veracode’s GenAI Code Security Report [5], which tested over 100 LLMs on 80 programming tasks, found insecure methods in 45 percent of cases. Java’s failure rate exceeded 70 percent, cross-site scripting stood at 86 percent, and log injection at 88 percent. A Stanford study (Perry et al.) [6] found that developers with AI assistance not only wrote less secure code but simultaneously overestimated its security by a factor of 3.5.

Apiiro’s analysis [7] of Fortune 50 companies confirms the trend in the enterprise context: while AI quadrupled development velocity, security risks increased tenfold. Privilege escalation vulnerabilities rose by 322 percent, and the companies found themselves confronted with over 10,000 new security findings per month.

The consequences are not abstract. In July 2025, security firm Wiz discovered a critical authentication bypass vulnerability in Base44 [8], a vibe coding platform acquired by Wix – 20,000 users were affected. CVE-2025-54135 (CurXecute) [9] allowed attackers to force Cursor into executing arbitrary commands on the developer’s machine. And GitGuardian’s analysis [10] of 20,000 repositories with active Copilot showed that 6.4 percent leaked at least one secret – 40 percent more than the average across all public repositories. The consequence was not less AI – but a call for better governance.

Snyk’s AI Code Security Report [11] underscores the systemic dimension: 75 percent of developers believe AI code is more secure than human code – even though 56 percent simultaneously admit that AI-generated code sometimes or frequently introduces security issues. Around 80 percent circumvent established security policies for using AI code tools, and only 10 percent scan the majority of AI-generated code. The overconfidence is systemic – and this is precisely where SDD comes in.

The Root of the Problem: Context Is King

Why do powerful models produce substandard code so frequently? The answer lies in missing context. A chat prompt like “Build me a user login” contains nothing about architectural decisions, existing dependency strategies, security requirements, or the project’s coding conventions. The model fills these gaps with statistically probable assumptions – and generates generic code that technically works but doesn’t fit the project.

Birgitta Böckeler of Thoughtworks described as early as 2023 three levels at which AI coding assistants need context [12]: the organization (architecture, standards, non-functional requirements), the project (dependencies, patterns, conventions), and the individual task (acceptance criteria, edge cases, dependencies). Without this context, the AI operates like a brilliant but uninformed freelancer on their first day.

McKinsey’s analysis [13] of over 200 organizations using AI coding tools identifies exactly this point as the differentiator: top performers shifted their focus from “story-driven” to “spec-driven” development. They invested more time in preparing context and reaped more consistent results. At the same time, the widely discussed METR study [14] showed that experienced developers with AI tools worked 19 percent slower on familiar projects than without AI – because the overhead for context communication, review, and correction outweighed the generation speed. The conclusion: the solution is not more AI, but better context.

What Is Spec Driven Development?

Spec Driven Development (SDD) inverts the conventional order: instead of generating code first and documenting later, the process begins with a precise, machine-readable specification. This specification serves as a contract between human intent and AI implementation – a “single source of truth” that is readable by both developers and AI agents.

The approach stands in the tradition of Design by Contract (Bertrand Meyer, 1986) [15], API-first development, and Behavior-Driven Development (BDD). What distinguishes SDD is its explicit orientation toward AI agents as the primary consumers of the specification. While traditional documentation is written for humans, SDD specs are simultaneously human-readable and machine-optimized. Compared to TDD, the difference lies in scope: TDD specifies behavior at the function level, SDD at the feature and system level.

Thoughtworks officially adopted SDD in Technology Radar Vol. 32 [16] as a recommended technique – a signal that the methodology has moved beyond the hype.

The typical SDD workflow follows four phases. In the Specify phase, requirements, constraints, and acceptance criteria are captured in a structured format – often in the Given/When/Then format familiar from BDD. A spec might look like this:

Feature: User Session Management
Given: An authenticated user with a valid session
When: The session has been inactive for more than 30 minutes
Then: The user is automatically logged out
And: All temporary data is cleaned up
And: An audit log entry is created
Constraints: No use of localStorage for session tokens

The Plan phase translates the specification into a technical implementation plan: Which components are affected? Which interfaces change? What risks exist? In the Tasks phase, the plan is broken down into atomic, actionable work items, each with clear acceptance criteria and estimated effort. Only in the Implement phase does the AI generate the actual code – but now with full context about the what, the why, and the constraints.

The Tools: Spec Kit and OpenSpec in Detail

Two open-source projects have established themselves as the leading SDD frameworks: GitHub Spec Kit [17] and Fission-AI OpenSpec [18]. They pursue the same fundamental idea but differ significantly in philosophy and implementation.

GitHub Spec Kit: The Methodical Heavyweight

Spec Kit emerged from John Lam’s research at GitHub and was released in September 2025 [17]. With approximately 67,000 GitHub stars, it has quickly built a large community. The tool is Python-based, runs via uv/uvx, and relies on a strict, phase-based workflow.

Its unique selling point is the “Constitution” concept: before any specification, the team defines non-negotiable project principles – architectural decisions, technology stacks, security guidelines, coding standards. A typical constitution contains statements like “All API endpoints must implement rate limiting” or “No direct database access outside the repository layer.” This constitution forms the immutable framework within which the AI operates. This prevents the AI from making its own architectural decisions for every feature – a problem that regularly leads to inconsistent codebases without a constitution.

A typical Spec Kit workflow:

/speckit.constitution   # Define project principles
/speckit.specify        # Capture requirements in structured form
/speckit.plan           # Create technical implementation plan
/speckit.tasks          # Generate atomic tasks
/speckit.implement      # Generate code based on tasks

Each phase has an explicit review point – a “gate” where the developer reviews and approves the result. Additionally, speckit.clarify offers a way to systematically uncover ambiguities in the specification, and speckit.analyze enables analysis of existing codebases as input for new specs. The thoroughness comes at a price: initial setup takes around 30 minutes, and token consumption is considerable due to the detailed Markdown documents.

OpenSpec: The Lightweight Framework

OpenSpec was released in October 2025 by Fission-AI [18] and pursues a deliberately different philosophy. With approximately 22,000 stars, it is explicitly aimed at existing codebases – “brownfield-first” rather than primarily greenfield. Its five core principles: fluid not rigid, iterative not waterfall, easy not complex, built for brownfield, scalable from personal to enterprise.

Setup takes just a few minutes, and the recommended workflow is intentionally less formal:

/opsx:new feature-auth   # Start a new change
/opsx:ff                 # Fast-forward: generate all artifacts at once
/opsx:apply              # AI implements the tasks
/opsx:archive            # Archive the change

The fast-forward command (/opsx:ff) generates four artifacts in a single step: a proposal (the why), specs in Given/When/Then format (the requirements), a design document (the technical approach), and a task list (the implementation steps). A traceable documentation of each change emerges in the openspec/changes// directory.

A notable feature is the delta-spec system: changes to existing specifications are marked as ADDED, MODIFIED, and REMOVED. This keeps the development history of requirements traceable – crucial in brownfield projects where requirements continuously evolve.

Choosing Between the Two

Spec Kit is suited for greenfield projects, large teams, and organizations that need strict process assurance – such as in regulated industries or when working with external service providers. OpenSpec excels with existing codebases, in smaller teams, and for rapid, iterative feature development where agility matters more than formal completeness. Both tools are MIT-licensed and integrate with over 20 different AI assistants – from Claude to Cursor to Copilot, without API keys. They are also not mutually exclusive: some teams use Spec Kit’s constitution concept for overarching architectural principles and OpenSpec for day-to-day feature work.

What Companies Report

Several prominent tech companies have publicly shared their experiences with spec-driven approaches – and the results are consistent.

Shopify’s CEO Tobi Lütke declared in 2025 [19] that every employee must demonstrate AI usage before requesting additional resources. The shift from “just prompt away” to structured workflows led to measurable improvements. The internal motto: treat AI as a “95th-percentile junior developer” – extremely fast and productive, but without its own judgment about architecture and design decisions. This metaphor captures the core of SDD: it’s not the AI that needs to improve, but the instructions it receives.

EPAM Systems [20], one of the world’s largest software engineering companies with over 50,000 developers, integrated Spec Kit into existing enterprise projects and reported significantly fewer iteration loops in AI-assisted code generation. The decisive factor, according to EPAM, was not the tool itself but the compulsion to fully think through requirements before implementation – an effect the agile community calls “shift left of thinking.” Especially in regulated industries where traceability and audit trails matter, the automatically generated documentation proved a valuable side benefit.

HumanLayer, a startup in AI agent orchestration, uses OpenSpec for its own product development. CTO Dex Horthy [21] describes the approach as “Context Engineering” – the systematic preparation of context as an independent engineering discipline. The team found that the quality of AI-generated code was directly proportional to the quality of the specification, and made spec writing an explicit task in the sprint.

Red Hat [22] pursues a similar approach with “Spec Coding,” targeting 95 percent and above AI code accuracy. The key lies in the strict separation of what (specification, human responsibility) and how (implementation, AI responsibility). Initial internal results show that this separation not only improves code quality but also increases review efficiency, because reviewers can use the specification as a reference.

The Broader Ecosystem

SDD does not exist in a vacuum. A growing ecosystem of context files and rule systems addresses related problems at various levels.

AGENTS.md [23], an open standard from the Agentic AI Foundation under the Linux Foundation, provides a tool-agnostic way to give AI agents project context. A single AGENTS.md file in the repository root is automatically read by supported tools – including OpenAI Codex, Google Jules, Cursor, Windsurf, Devin, and many more. OpenAI’s own main repository now contains 88 such files.

Anthropic’s CLAUDE.md [24] offers a hierarchical memory system for Claude Code with three levels: user memory (~/.claude/CLAUDE.md), project memory (./CLAUDE.md), and directory-specific overrides. Cursor Rules [25] in .mdc format enable path-specific instructions with four activation modes (Always, Auto Attached, Agent Requested, Manual) – the Cursor Rules Directory already has over 250,000 monthly users.

AWS Kiro [26] deserves special mention as an enterprise alternative: the IDE, introduced in June 2025, combines spec generation from natural language, automatic task decomposition, and a “Steering Hook” mechanism that checks spec compliance on every file save – a continuous validation that neither Spec Kit nor OpenSpec offer.

These tools are complementary: while AGENTS.md [23] and Cursor Rules [25] provide static project context (coding standards, architectural principles, tool configuration), SDD defines the dynamic, feature-specific context. In practice, many teams use both – a CLAUDE.md for general standards and Spec Kit or OpenSpec for feature specification.

Critical Assessment

The most obvious objection to SDD: doesn’t this sound suspiciously like the waterfall model? Specification before implementation, strict phases – hasn’t the industry left that behind for good reason?

SDD differs from classic waterfall in three key ways: the specifications are lightweight and iterative, not monolithic. The feedback loop is extremely short – minutes rather than months. And the specs co-evolve with the implementation rather than being frozen in advance. OpenSpec’s delta-spec system is a good example: requirements change continuously, and the spec reflects this change rather than preventing it.

A second criticism concerns scalability: is the overhead worth it for every type of task? Probably not. For small scripts, one-off prototypes, and exploratory spike tasks, vibe coding is more efficient. Nobody needs a formal specification for a shell script that rotates log files. SDD delivers its value for features above a certain complexity threshold, for cross-team work, and wherever code needs to survive longer than a single sprint.

Finally, there’s the question of toolchain fragmentation. Spec Kit, OpenSpec, Kiro, AGENTS.md, CLAUDE.md, Cursor Rules – the ecosystem is young and unconsolidated. Standards are missing, and there’s a risk that teams spend more time on tool selection than on actual specifying. Consolidation will come – the question is whether a single standard will prevail or whether the fragmented landscape will persist.

The art ultimately lies in finding the right degree of specification for each context – enough structure to guide the AI, but not so much that the overhead outweighs the benefit.

Conclusion and Outlook

SDD is still in the early stages of its development, but the direction is clear. The next generation of tools will likely offer AI-assisted spec generation from codebase analysis, real-time compliance checks during implementation, and automatic spec updates on code changes. AWS Kiro’s Steering Hooks [26] already point in this direction.

When AI writes the code, the ability to specify precisely becomes the central engineering competency. SDD systematizes exactly this capability with tools and workflows that are already productively usable today. The shift from “writing code” to “writing specs” is perhaps the most profound change that AI tools are bringing to software development – not because coding disappears, but because it becomes an implementation detail, while the real engineering achievement lies in the specification.

For developers and tech leads, the pragmatic recommendation is: start small. Specify an existing feature with OpenSpec or Spec Kit, compare the AI output with and without a spec, and draw your own conclusions. The tools are open source, the risk is low – and the likelihood of being surprised by the difference is high.


Sources

[1] Andrej Karpathy, “Vibe Coding” – X/Twitter Post, February 3, 2025. https://x.com/karpathy/status/1886192184808149383

[2] Stack Overflow, “Developer Survey 2025”. https://survey.stackoverflow.co/2025

[3] GitClear, “AI Code Quality Research 2025 – Analyzing 211 Million Lines of Code”. https://www.gitclear.com/ai_assistant_code_quality_2025_research

[4] CodeRabbit, “State of AI vs Human Code Generation Report”, December 2025. https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report

[5] Veracode, “GenAI Code Security Report 2025”. https://www.veracode.com/resources/genai-code-security-report

[6] Neil Perry et al., “Do Users Write More Insecure Code with AI Assistants?”, Stanford University, arXiv:2211.03622. https://arxiv.org/abs/2211.03622

[7] Apiiro, “4x Velocity, 10x Vulnerabilities: The AI-Generated Code Crisis”, September 2025. https://apiiro.com/blog/4x-velocity-10x-vulnerabilities

[8] Wiz Research, “Critical Vulnerability in AI Vibe Coding Platform Base44”, July 2025. https://www.wiz.io/blog/critical-vulnerability-base44

[9] CVE-2025-54135 (CurXecute) – Cursor IDE Remote Code Execution Vulnerability. https://nvd.nist.gov/vuln/detail/CVE-2025-54135

[10] GitGuardian, “State of Secrets Sprawl 2025”. https://www.gitguardian.com/state-of-secrets-sprawl-report-2025

[11] Snyk, “AI Code Security Report: Secure Adoption in the GenAI Era”. https://snyk.io/reports/secure-adoption-in-the-genai-era/

[12] Birgitta Böckeler, “Context is Everything: How to Make AI Coding Assistants Work for You”, Thoughtworks, 2023. https://www.thoughtworks.com/insights/blog/generative-ai/context-is-everything-ai-coding-assistants

[13] McKinsey, “Unlocking the Value of AI in Software Development”, 2025. https://www.mckinsey.com/industries/technology-media-and-telecommunications/our-insights/unlocking-the-value-of-ai-in-software-development

[14] METR, “Measuring the Impact of Early AI Assistance on Software Development” (Randomized Controlled Trial), arXiv:2507.09089, July 2025. https://arxiv.org/abs/2507.09089

[15] Bertrand Meyer, “Design by Contract”, in: Object-Oriented Software Construction, Prentice Hall, 1988.

[16] Thoughtworks, “Technology Radar Vol. 32 – Spec Driven Development”. https://www.thoughtworks.com/en-us/radar/techniques/spec-driven-development

[17] GitHub, “Spec Kit – Specification-Driven Development Framework”. https://github.com/github/spec-kit

[18] Fission-AI, “OpenSpec – Lightweight Spec-Driven Development”. https://github.com/Fission-AI/OpenSpec

[19] Tobi Lütke, “Reflexive AI usage is now a baseline expectation at Shopify” – Internal Memo, April 2025. https://x.com/tobi/status/1909251946235437514

[20] EPAM Systems, Experience Report on Integrating Spec Kit into Enterprise Projects, 2025.

[21] Dex Horthy / HumanLayer, “Advanced Context Engineering for Coding Agents”. https://github.com/humanlayer/context-engineering

[22] Red Hat, “Spec Coding: Achieving 95%+ AI Code Accuracy”, 2025.

[23] AGENTS.md – Open Standard by the Agentic AI Foundation / Linux Foundation. https://agents.md

[24] Anthropic, “CLAUDE.md – Memory Files for Claude Code”. https://docs.anthropic.com/en/docs/claude-code/memory

[25] Cursor Rules Directory. https://cursor.directory

[26] AWS, “Kiro – Spec-Driven AI IDE”, June 2025. https://kiro.dev

This article is part of the JAVAPRO magazine issue:

From AI as a Feature to AI as Infrastructure

Move beyond AI experimentation and into AI engineering.
Explore the architectures, platforms, and operational practices required to build trustworthy AI systems at scale. From governance and observability to modern Java infrastructure, this edition examines the foundations of production-ready AI.

Discover the edition →

Total
0
Shares
Previous Post
Two boxers in a ring in front of a wall of source code – Java on the left in red gloves, Kotlin on the right in blue gloves, with a large orange 4 between them for part 4.

Kotlin kontra Java – Part 4 – Language for Safety

Next Post

JCON EUROPE 2027: Get 30% Off & Secure Free Tickets Now

Related Posts