Smaller prompts, better answers with GitHub Copilot Custom Instructions
AI Summary
Summary of GitHub Co-Pilot Custom Instructions in VS Code
- Custom Instructions Feature:
- GitHub Co-Pilot in VS Code allows for custom instructions to fine-tune responses.
- Custom instructions enable smaller prompts and provide context for each chat request.
- Setting Up Custom Instructions:
- Create a
.github
directory and add a markdown file namedco-pilot-instructions.md
.- Add code snippets with standard instructions, such as variable naming conventions and indentation preferences.
- Commit these instructions to the Git repository for team use.
- Adjusting Co-Pilot Responses:
- You can adjust tone, humor, accent, and other aspects of Co-Pilot’s responses.
- Example given of dialing up an Australian accent for fun.
- GitHub Co-Pilot for Commit Messages:
- Co-Pilot can generate commit messages by summarizing changes.
- Custom styling instructions can be added to VS Code workspace settings to personalize commit messages, including emojis.
- Custom Instructions for Various Functions:
- Add a
settings.json
to the workspace with snippets for code generation, commit messages, code review, and test generation.- Override internal VS Code settings with custom instructions for each function.
- Using Custom Instructions in Practice:
- Code review and test generation can be performed by Co-Pilot using custom instructions.
- Tests are created using the preferred testing framework and the AAA approach.
- Advanced Custom Instructions:
- Include detailed documents such as code styles, database styles, and sprint specs in the project.
- Change settings in
settings.json
to reference files for tasks like generating SQL schemas.- Code Generation with Custom Instructions:
- Co-Pilot can generate and edit files using file references as context.
- Example given of generating a SQL schema and a Prisma schema with custom instructions.
- Conclusion:
- Custom instructions in VS Code enhance GitHub Co-Pilot’s effectiveness.
- They save time and align Co-Pilot’s output with team and project standards.
- The video encourages exploring and having fun with custom instructions.
Detailed Instructions and URLs
No specific CLI commands, website URLs, or detailed tips were provided in the transcript.