To make sure I get the code from my AI assistant, such as Cursor IDE, I provide these instructions along with my request:
- Write Tests First – The AI generates tests based on my task description. This ensures that functionality is well-defined before writing any implementation.
- Develop Code to Pass the Tests – Once the tests are in place, the AI writes the code needed to make them pass, following best practices for clean and efficient implementation.
- Iterate Until Perfection – If necessary, the AI refines the implementation, improving structure and efficiency while ensuring all tests pass.
This structured prompt guarantees high-quality, test-driven code without unnecessary back-and-forth.
[Task Description Here]
Instructions:
Begin by writing the necessary tests based on the task description.
Make sure to write many tests, including complex ones, to ensure that is working as expected.
Develop the code to fulfill the task, ensuring all tests pass successfully.
Iterate as needed to refine the implementation.
By providing a clear task description and following these instructions, the AI will assist you in developing code using the TDD approach, ensuring robust and reliable implementations.