Prompting tips for maintenance tasks – Part 2

This blog is also a living document for myself so I can improve and reference this working pattern in the future.

Model selection

If using ChatGPT for coding tasks, especially maintenance tasks, opt for o1, other models are crap and will hallucinate or forget more of the original code.

Avoiding regressions

If the goal is to alter existing code, ChatGPT risks breaking existing code by removing as part of the end result, a good prompt is something like below, to reduce the amount of feedback loop and future debugging.

[insert-here your own description of your problem to be solved by ChatGPT/LLM, with instructions, followed by the text below]

Here is the code to be modified. I want the complete code as the final result, with the same number of functions as in the original.

First, tell me the list of ALL the functions you see, and which ones you will modify.
Show me all the resulting code from each modification.
Show me the final file with the modifications
.
Do not omit code for brevity, keep untouched code same as before.

[Insert here the original code to be maintained/modified/debugged by the LLM]

See also

Leave a Reply

Your email address will not be published. Required fields are marked *