DEV Community

Cover image for ChatGPT - Prompts for Code Review and Debugging
Sandeep Kumar
Sandeep Kumar

Posted on • Updated on

ChatGPT - Prompts for Code Review and Debugging

Why Code Review and Debugging is important:

Code review and Debugging are crucial in software development. They help identify and fix bugs, improve code quality, enhance software reliability, optimize performance, promote knowledge sharing, ensure adherence to coding standards, and mitigate risks and vulnerabilities.

ChatGPT Prompts for Code Review and Debugging:

Sharing a list of the prompts that can help you to use ChatGPT to review the code and debugging.

Replace the words in block to get the desired result, for example, use your choice of language, i.e., C#, JavaScript, Python, NodeJS, etc.

Type Prompt
1 Debug Can you help me debug this error message from my C# program:
[error message]
2 Debug Describe the unexpected behavior you are observing in the code and provide any error messages or stack traces for further analysis.
[error message]
3 Debug Help me debug this Python script that processes a list of objects and suggests possible fixes.
[Enter your code here]
4 Debug Highlight any error-handling mechanisms in the code and explain how they are currently handling or failing to handle the encountered issue.
[Enter your code here]
5 Debug Debug the given Java code. It should perform [expected behavior], but it’s producing [current behavior].
[Enter your code here]
6 Debug Debug the following JavaScript code:
[Enter your code here]

It’s expected to perform [expected behavior] but instead, it’s producing [current behavior] when given inputs: [input examples].
7 Issues Could you find potential issues in this JavaScript code:
[Enter your code here]
8 Issues Can you identify any bugs in this C# code snippet:
[Enter your code here]
9 Issues Look over this PowerShell script to check if there are any bugs.
[Enter your code here]
10 Issues Help me understand why this JavaScript function is not working as expected.
[Enter your code here]
11 Issues What are the potential issues with this C++ recursive function:
[Enter your code here]
12 Issues Find any potential issues in this C# code that processes string array:
[Enter your code here]
13 Issues Can you spot the bug in this Java function that handles database connection:
[Enter your code here]
14 Issues What’s wrong with this C# method that suppose to parse a CSV file:
[Enter your code here]
15 Issues Find the logic error in this JavaScript function that is intended to reverse the array, given these inputs: [input parameters], and expected to produce [output], but currently gives [incorrect output].
[Enter your code here]
16 Issues Find potential bugs in the Python script that processes [input type] and outputs [output type]:
[Enter your code here]
17 Issues Identify the logic error in this C# function intended to check the password strength with these inputs: [input parameters] and expected output: [output]
[Function Description]
18 Performance Can you find any performance issues in this Java code:
[Enter your code here]
19 Performance Are there any memory leaks in this C# code:
[Enter your code here]
20 Performance Review the following C# function.
[Enter your code here]

Please identify any potential bugs, performance issues, and non-compliance.
21 Performance Please review the Java function for any potential memory leaks or performance issues when processing an Array of a million records.
22 Performance Find the memory leaks in the following C# code and suggest possible optimizations:
[Enter your code here]
23 Performance Review the given Java code for potential scalability issues:
[Enter your code here]
24 Performance Review the algorithms and data structures used in the code to ensure they are optimized for performance.
[Enter your code here]
25 Review Review this C# function for errors:
[Enter your code here]
26 Review Can you review this C# function and suggest areas for error handling
[Enter your code here]
27 Review Review the following JavaScript function and provide suggestions for error handling and potential bottlenecks.
[Enter your code here]
28 Review Can you spot any potential problems with this C# class definition:
[Enter your code here]
29 Review Can you analyze this Python code and point out potential errors?
[Enter your code here]
30 Review Please review this Angular code for style and best practices:
[Enter your code here]
31 Review Please review the following JavaScript to check if it is following Google Style Guide:
[Enter your code here]
32 Review Please review this JavaScript code that is supposed to calculate the factorial given the inputs [input variables] and return [output]:
[Enter your code here]
33 Security Are there any security vulnerabilities in this C# code:
[Enter your code here]
34 Security Identify potential vulnerabilities in the code and propose mitigation strategies:
[Enter your code here]
35 Security Analyze the code for any potential security loopholes and suggest ways to address them.:
[Enter your code here]
36 Security I am concerned about security issues in this C# code. what are your thoughts?
[Enter your code here]
37 Security Examine the code for possible security risks and provide recommendations to enhance its security posture.
[Enter your code here]
38 Security Inspect the code for any security vulnerabilities and outline steps to remediate them.
[Enter your code here]
39 Security Help identify any potential security issues in the following Java code related to cross-site scripting.
[Enter your code here]
40 Security Scrutinize the code for any security weaknesses or loopholes and suggest measures to strengthen its security posture.
[Enter your code here]

Top comments (0)