DEV Community

Cover image for AI-TDD: you write the test, GPT writes the code to pass it ✅
Dima Sukharev
Dima Sukharev

Posted on • Updated on

AI-TDD: you write the test, GPT writes the code to pass it ✅

first — let's grow my twitter, so i can tell about my inventions quicker and make the world even better place (or not, idk)

AI-TDD — GPT4 CLI for TDD. You write the test, GPT writes the code to pass it ✅.

Yes, I know. It's a simple yet brilliant idea and open-source of the millennium. So feel free to fork and feature.

— Why?
— TDD is the only right way of..
— Wowow, man.. wait.. really.. don't..
— (Hits vape): Ok, ok... GPTs are not so good when prompted to generate code from a free text input, BUT when you prompt it with a test — GPT4 is killing it with impressive accuracy.
— Hmm.. And the more clearly you formulate a test, the cleaner and wiser you write the code?
— Yep, and so does GPT 🤖

This is probably it.

I won't tell you the whole 10 commandments of "why and how testing software is a blessing", just one thing — tests are like your friends, they tell you what you want to hear, but you can only trust them, and they save your a$$ anyway. You better have friends.

With AI-TDD, you adjust the tests, and the code is written for you. You leave the low level of "how to code this feature" and move above to the level of "what the feature should do". You clean your head from "implementations" and start operating "ideas" as the pro maximum deluxe engineer.

As AITDD is open-sourced, I'm happy to merge your PRs, so feel free to fork and feature!

There is one more good tool — OpenCommit — a GPT CLI to auto-generate conventional commits in 1 second.

I'll probably change the world with other extraordinary inventions and enlightenment, not sure yet, but anyway, follow the Twitter account (or don't).

Top comments (7)

serjobas profile image
Sergey Bunas

sounds really interesting will try to play with this in my side-project

disukharev profile image
Dima Sukharev

looking for the feedback!

alexvoda profile image

This is something I consider having far less downsides compared to OpenCommit.

As long as code still gets reviewed (and that is a very big if), this might be a great productivity booster.

__febe88 profile image
Anna D

Thanks, this is really helpful!!

disukharev profile image
Dima Sukharev

<3 thanks Anna

ginkgomzd profile image
Michael Z Daryabeygi

I prefer for GPT to write tests for me from my plain language requirements, then we collaborate on the code too, but I want more control over the code writing.

vens profile image
Vladimir Hudnitsky

even tho we all know that TDD is the way to go, we still have too much not covered existing code.
how about extending the tool to generate tests for written code? or maybe there is one already and I just not aware?