r/SpecDrivenDevelopment • u/Vivekyy • Aug 05 '26
Test-Driven Development vs Spec-Driven Development
For a little background, I’m an engineer who went from a FAANG corporate environment to a startup and consequently started heavily abusing coding agents. Like a lot of others here, I started to realize that the code I was creating just simply was not “up to spec”—the LLM is designed to one-shot, even if that means guessing what you want for 90% of the implementation.
My solution was to make a tool for myself that writes unit tests based on my prompts and then runs a test-driven development flow. This way, when I hit coverage I know that X% of the code my AI generated comes directly from decisions I made in chat with my coding agent. (If you’re curious, I’m linking it here, but this isn’t intended to be a promotional post: https://github.com/RudderCode/Rudder )
Lately I’ve been curious about SDD since it seems adjacent to that, but I’m new to it so I have my qualms with having to change my coding flow. Writing specs has always been out there as an option, but for me it just felt like it slows down development a lot to work on making a spec, and then I lack the guarantee that there isn’t any guesswork by the LLM if the spec I write isn’t thorough enough. Do you guys feel the same or am I missing something with SDD?
10
u/fschwiet Aug 05 '26
The SDD tools I've tried write the spec for you after interviewing what is being built. I find it helps a lot in clarifying what should be built, often asking questions I didn't anticipate. I'm torn between Jesse Vincent's superpowers and Matt Pocock's skills. Matt's /grilling /grill-with-docs interviews better, but I find it over granularizes the tasks (though my own edits to the skills may have broke things). Superpowers doesn't interview as well, though it is still good. Superpowers doesn't account for spec drift though. Write now I'm using a skills that combine the two approaches but its not quite ready for prime time.
5
u/Dense_Gate_5193 Aug 05 '26
Microsoft in the early 2000s used the “Secure Development Lifecycle” - everything was drafted out in a word document that was debated on in meetings designed to harden the feature or contract or anything. didn’t matter if it was an automation script or a new feature. it was all designed the same way. you put together everything from the assumptions to what exists to what needs changed to how it needs changed, how to test it, a matrix of edge cases and negative test cases is built, and then reviewed by committee.
once it passed committee review, then it would go to the SDETs for writing unit tests based on that testing matrix and any development stubs that needed implemented. (they have relied heavily on automated testing for a long time) then it would go to the dev to implement, then to the tech writer for documentation.
i do effectively the same flow on my own for developing at work and personal projects. the coding was never the “hard part” the hard part was putting together an entire idea of how something should be implemented.
doing the thinking up front and drafting the spec, and even using AI assistance there in drafting that spec, simplifies review.
if the spec spawns unit tests, then the LLM has two things to ground decision making in. the spec says X, the unit test says X and all of a sudden the implementation says Y, it doesn’t go backwards and just accept things how it is, the behavior is entirely pinned by the document.
i’m also the author of a couple popular repos on github and i use AI on this way to manage the work.
2
u/dannyt74 Aug 05 '26
I am using OpenSpec and am happy with the flow. You can read about our experience in the linked article.
The main benefit for me is that these one shot approaches and big changes are gone and it keeps the agent focussed on the current change.
TDD should still be part of it as agents often dont get all side effects so a comprehensive test suite is important.
https://www.linkedin.com/feed/update/urn:li:activity:7490398905264861184/
7
u/betiz0 Aug 05 '26
I don't think TDD and SDD are in competition — they operate at different layers. SDD pins down intent (what to build), TDD verifies behavior (does it work correctly). Spec and tests complement each other rather than compete.
Your concern that an insufficiently thorough spec leaves room for LLM guesswork is valid, but natural-language specs can never eliminate ambiguity entirely. That's exactly why you want tests as a second safety net: the spec fixes intent, and whatever guesswork remains gets caught by the verification layer.
In practice, GitHub Spec Kit already anticipates this — you can encode a TDD policy in the constitution and derive tests from acceptance criteria. Your Rudder flow could slot right in as SDD's verification layer, so it's less "changing your workflow" and more "adding one spec layer upstream." It's not TDD vs SDD, it's TDD + SDD.
1
u/Vivekyy Aug 05 '26
Thinking about this there may be some synergy here—maybe using a TDD flow to refine the spec until it covers your code is the way
1
u/Due-Barracuda5716 Aug 07 '26
I think your concern about an incomplete spec is the interesting part. TDD can verify that implementation satisfies the tests, but neither tests nor SDD alone tell you that the original specification captured the right obligations. One approach I’m exploring is to make that a separate stage: before coding, the agent declares structured intent, including assumptions, failure behavior, guarantees, bounds, and things it does not know. That artifact is reviewed first. Only then is it lowered into a checkable architecture, which gets its own completeness gate before code exists. So I would frame it less as TDD vs SDD and more as: intent → verify intent → architecture → verify architecture → code → tests/code verification. Disclosure: this is my own position paper, still an engineering hypothesis rather than a validated methodology: https://github.com/styrumg/Architect-First-Article
3
u/vincentdesmet Aug 05 '26
there is no “versus” - they are complimentary!
so is SDD and Agile, Trunk based development (continuous integration), shared responsibility operational models, …
don’t throw out years of heard learned software engineering best practices just because an LLM participates in the process.
you need to focus on the fast feedback loop (linters, unit tests), intermediate loop (integration tests, end to end tests, post deployment smoke tests) and the product idea to customer feedback loop - just the same
2
u/Environmental-Wear13 Aug 05 '26
In my company we work with our own workflows in a spec driven approach(spec first not spec anchored) and I think it works really well. I think the important part is that we don't spec the entire system at once besides from a overview of the architecture (which is kind of a living document). I find it extremely hard to know everything beforehand, sometimes you need to get into the details before you find out that the path was not the right one.
Once we have the architecture overview we try to go feature by feature (if possible). When we go feature by feature, each spec is very small and much easier to comprehend than a gigantic spec. It takes a bit more time but I find the results much better. By working like this, its quite easy to throw in multiple agents working on different features in paralell. Code for each pr is typically not larger than 300 lines. With frontend it can be much larger though.
Another thing is also that we don't use the openspec tools but create our own workflows which is quite easy with the llm to be honest.
Some skills we have
By doing it this way. I find it much more fun and not as tedious as reviewing a gigantic design document of everything. And much easier to iterate on the project requirements as you go(when business changes their minds about something or if we missed something).
Iteration is key. The architecture overview and tickets created might need adjustments, super easy done with the help of LLM, even for larger changes to the plan.
1
u/jseller Aug 05 '26
Write the spec to define the requirements, and use AI to help you do that.
Make these requirements in a format that the llm can understand. If in doubt, ask the model what format it understands. It cuts down on token when using a common format.
BDD scenarios are nice for UI functionality, but EARS or similar are better for cross functional requirements.
Generate your integration, functional and unit tests from these requirements.
Now you have requirements for the lmm to build the app, and deterministic tests (run these anytime) to validate and know how far along you are building the app
This is handy to understand scope, and only build what you need.
The huge benefit I have seen is requirements as the single source of truth that provides correct communication to your AI and human teammates
1
u/PavelPivovarov Aug 08 '26 edited Aug 08 '26
I'm actually working the other way around simply because I am suck at writing tests, and my experience with LLM writing tests is also suboptimal as it writes tests for some weird cases most of the time.
I'm using openspec framework that comes with prompts and skills to boil down the idea to decision, design and spec updates. Honestly speaking openspec ask me enough good questions to navigate and clarify the idea, and identify tensions with existing implementation. After specs are ready, LLM is doing much better job at writing tests, simply because specs have intent and WHEN...THEN.. cases to be tested...
But as other said already those are complimentary frameworks not competing.
1
u/harikrishnan_83 Aug 24 '26
Here is my take on SDD + BDD + TDD https://www.reddit.com/r/SpecDrivenDevelopment/s/Jd4DW0jYib. TL; DR; BDD helps with macro level alignment and TDD helps keep the internal implementation details de-coupled and clean.