I’ve been using AI coding assistants for a while now and have found a process to get great suggestions.
🐚 Step 1: Create your public and private interface
The first step in creating a library or a package is to make the public and private interfaces but keep them void of logic.
Do nothing but return empty values.
During this step, you’ll get some basic suggestions. They may be right, or they may not.
🧪 Step 2: Create some basic tests
Since you have your interface defined, you can write some basic tests.
While writing these tests, you define the basic functionality of your methods and functions. The AI assistant will use this context for the next steps.
You may find that the coding assistants are giving better results during this step, but keep your expectations in check.
📖 Step 3: Add logic
Now, add your logic to make your tests pass. At this point, you should be getting good results from the AI assistants.
All of these assistants use the context of what you have open to create suggestions; you’ve created enough context with the interface and tests for the assistant to make reasonable suggestions.
👨🔬 Step 4: Add more test scenarios
With the basics covered now, you can add more test scenarios; the AI assistant will likely make excellent suggestions.
This stage is a great place to convert your tests to table tests. AI assistants are very helpful with table tests.
Anything with a list will result in good suggestions.
📚 Step 5: Add more logic and repeat Step 4
Make your tests pass and repeat step 4 until you are done.
At this point, any suggestions should be exactly what you want. The more you repeat steps 4 and 5, the better the suggestions will be.
🦥 Step 6: Tab complete documentation
Just keep tabbing.
🤩 Step 7: Look at your fantastic code
That’s it; all you need to do to get great results from AI coding assistants is to follow best practices.
What I described is just interface-driven design and test-driven design.
It turns out these practices help both Humans and AI create better code.







Top comments (0)