DEV Community

Alexander Shagov
Alexander Shagov

Posted on

How LLM users accidentally do TDD without realizing it

Most developers using LLM tools today are unknowingly following a loose version of test-driven development (TDD).

1. TDD and LLM prompting work surprisingly similar

a) Start with failure

  • TDD: You define an interface and write a failing test first. Now you know what needs fixing.
  • LLMs: You write a vague prompt, get bad results, and think "I need to explain this better." Same basic concept.

b) Make it work

  • TDD: You write code until the test passes.
  • LLMs: You tweak the prompt, add details, and retry until you get good output. Same iterative approach.

c) Clean it up

  • TDD: "Okay, now let's clean this up."
  • LLMs: "This works but looks messy - needs polishing." Same final step.

2. Why developers end up doing TDD-like work with LLMs

Many developers claim to hate TDD ("too much overhead!") but end up doing something similar because:

  • They have to think through requirements first (or the AI won't help)
  • They iterate repeatedly (just with prompts instead of tests)
  • They refine the AI's output (which is rarely perfect on first try)

3. LLMs reveal who actually understands coding

  • Beginners: Ask AI → Copy → Paste → Breaks → Gets stuck
  • Experienced devs: Plan → Experiment → Debug → Verify results

This mirrors TDD:

  • Weak developers write tests that don't actually help
  • Strong developers write tests that improve code and serve as documentation

The irony

If you avoid TDD but use LLMs... surprise! You're basically doing TDD-ish style of work without calling it that.

  • TDD is structured (test → fail → code → refine)
  • LLM prompting is more ad-hoc (ask → adjust → accept → maybe improve later)

What this shows us

Skilled developers use LLMs like TDD - they plan, test, and refine.
Junior developers use LLMs like supercharged Stack Overflow - copy, paste, and pray.

In the end, any tool just amplifies your existing thought process.

Top comments (1)

Collapse
 
michael_liang_0208 profile image
Michael Liang

Great post.
I think so, too. AI is just a tool for humans!
Also even though AI is a good tool, only experienced developers can use this tool for success!