Skip to content

Instantly share code, notes, and snippets.

@DineshSolanki
Last active June 28, 2024 08:07
Show Gist options
  • Save DineshSolanki/973fa52826deb0f49410de6d08b39013 to your computer and use it in GitHub Desktop.
Save DineshSolanki/973fa52826deb0f49410de6d08b39013 to your computer and use it in GitHub Desktop.
Commit generation AI prompt

commit

  Avoid overly verbose descriptions or unnecessary details.
  Start with a short sentence in imperative form, no more than 50 characters long.
  Then leave an empty line and continue with a more detailed explanation.
  Write only one sentence for the first part starting with the type of commit such as chore:,fix:,feature:, and two or three sentences at most for the detailed explanation.

Check proper logging

Check the following code for proper logging practices:
  
$SELECTION

Locate any logical error

Locate any logic errors in the following code: 
$SELECTION

Check for SAST

Review the following code for potential SAST vulnerabilities(Group by CWE ID) and provide fixes:
    
 $SELECTION

Add logger

Add loggers to important piece of the code:

$SELECTION

Use 'log' as name of logger object, it is already declared just use it. don't show full class, only the provided code

Lower memory use

Optimize the following code for lower memory usage while keeping performance same or high:
 
$SELECTION

Calculate cyclomatic complexity

Calculate cyclomatic complexity of the following:
    
$SELECTION

Memory tips

Provide tips to Optimize the following code for lower memory usage while keeping performance same or high, Don't provide full code:
 
$SELECTION

Performance issues

Identify potential performance issues in the following code: $SELECTION

Find Resouce leaks

Find any resource leaks in the following code and suggest fixes: $SELECTION

Code review

I want you to act as a code reviewer and review the following code:
 
 $SELECTION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment