4 ms·
And if you use Claude Code you can also tell it to compile it and test it and it will keep fixing problems until it gets it right or gives up or spirals to a de
by tomashubelbauer 1y ago
And if you use Claude Code you can also tell it to compile it and test it and it will keep fixing problems until it gets it right or gives up or spirals to a dead end.
- sylware 1y agoYou can give a set of test cases?
- tomashubelbauer 1y agoWith Claude Code you can, it is aware of your code base. Or you can have it generate them and then manually check them. If there are existing tests you can tell it to use those. I usually have it work on the thing I want it to do, keep a journal MarkDown file capturing what it did and why in case I want to review something later and tell it to build and test its changes after each edit.
- rahoulb 1y agoMy favourite way to use it is to write tests first, then say "make these pass". It will generate some code, run the tests, say "oh, there's an error here ... let's fix that ... oh, there's an error there, let's fix that ..." and (most of the time) it will reach a solution where the tests pass. I already do TDD a lot of the time, and this way I can be sure that the actual requirements are covered by the tests. Whereas asking it to add tests to existing code often gets over-elaborate in areas that aren't important and misses cases for the vital stuff. Sometimes, when asking Claude to pass existing tests, it comes up with better implementations than I would have done. Other times the implementation is awful, but I know I can use it, because the tests prove it works. And then I (or Claude) can refactor with confidence later.