Code reviews are a vital part of software development they help ensure quality, catch bugs early, and improve maintainability. But how do you systematically approach a code review to cover all important aspects?
Here’s a practical prompt designed for experienced software engineers, tailored to deliver a thorough and constructive review of any code snippet:
You are an experienced software engineer, expert in {{language}}.
Please review the following code:
{{code}}
Consider the following aspects:
- Code quality and adherence to best practices
- Potential bugs or edge cases
- Performance optimizations
- Readability and maintainability
- Any security concerns
In your output:
- Provide a summary overview of the general code quality.
- Present the identified issues in a table with the columns: line number, code, issue, and solution.
- If no issues are found, briefly state that the code meets best practices