Today, you can use Custom Instructions in JetBrains to speed up development while staying aligned with your team’s coding standards and personal preferences.
Whether you’re working on a solo project or part of a larger team, adhering to consistent coding standards is essential. Custom Instructions provide a mechanism to reinforce team coding guidelines or embed personal coding preferences.
Example: Make custom instructions for newly generated code
Make sure you have the latest version of GitHub Copilot installed on you JetBrains IDE. Then, navigate to the GitHub Copilot settings to find the Custom Instructions section.
Go to the Settings page of GitHub Copilot, and find Custom Instructions, in the Copilot Instructions part you can configure custom instructions either for the current workspace or as global settings.
Alternatively, you can create the instruction files manually:
- Workspace-level instructions:
.github/copilot-instructions.md
(you may find the .github folder in your project root) - Global instructions:
- macOS:
/Users/your-username/.config/github-copilot/intellij/global-copilot-instructions.md
- Windows:
C:\Users\your-username\AppData\Local\github-copilot\intellij\global-copilot-instructions.md
- macOS:
In this example, I’m setting a workspace-level instruction.
Next, let’s create a new Java class named Quicksort
in the root folder, which implements the quicksort algorithm.
As soon as the class is created, you’ll see the custom header automatically added at the top, just as specified in the Copilot’s custom instructions we configured earlier.
Example: Customize git commit messages
You may also customize the git commit message based on you needs. Go to the Settings page of GitHub Copilot, and find Custom Instructions, then you can configure git commit messages either for the current workspace or as global settings.
Alternatively, you can create the instruction files manually:
- Workspace-level instructions:
.github/git-commit-instructions.md
(you may find the .github folder in your project root) - Global instructions:
- macOS:
/Users/your-username/.config/github-copilot/intellij/global-git-commit-instructions.md
- Windows:
C:\Users\your-username\AppData\Local\github-copilot\intellij\global-git-commit-instructions.md
- macOS:
Now expand the Commit tab in the side bar, and click the Copilot icon , You should see a commit message generated based on the instruction we just set.
Learn More
You can find more custom instructions usage in the official doc.
Feedback
Your feedback drives improvements. Let us know what you think using the in-product feedback option, or share your thoughts in the following channels:Â JetBrains IDE Feedback.
0 comments
Be the first to start the discussion.