AI-Assisted Debugging Prompt
Source: Notion | Last edited: 2024-10-23 | ID: 1282d2dc-3ef...
By using this prompt, we can leverage the capabilities of LLM to automatically add additional logging and diagnostics to our code. This approach allows us to treat the script as a black box and iteratively improve it without having to manually dissect the code.
Here’s how it works:
- Copy & paste the entire terminal output, which shows the error, to the Cursor’s
COMPOSERprompting area. - Quote them with two triple backticks ````` to clearly delineate.
- We use this prompt to instruct the AI to add appropriate logging statements to our code.
- The AI enhances the script with additional logs, focusing on
WARNING,ERROR, andCRITICALlevel logs for maximum visibility. Also check: - Python rich logging
- We run the modified script and collect the generated logs and error messages.
- We then feed these logs and errors back into the AI system (such as the Cursor IDE).
- The AI analyzes the feedback and suggests further improvements or identifies root causes of issues.
- We repeat this process as necessary, allowing the AI to build a comprehensive understanding of the code’s behavior and potential problems.
This iterative approach is particularly effective with advanced models like
o1-mini. It allows us to quickly identify and resolve issues in our code without having to manually trace through every line, saving time and reducing the cognitive load on our development team.
AI-Assisted Debugging Prompt
Section titled “AI-Assisted Debugging Prompt”Do you have enough insights or enough understanding of the root causes to make accurate corrections? If not, what additional information do you need to gain better understanding? For instance, what additional log should be added to enhance visibility? When adding logs, ensure to maximize the use of contingent `WARNING`, `ERROR` and `CRITICAL` logs.
Holistically & contextually examine the Current File.Ignore the top importing section of the Current File.Ignore docstrings. Retain existing logging & logger.Retain existing modularization.
Don't delete or modify any commented out code because they're for future use.