A community-driven collection of code generation instructions for GitHub Copilot's experimental feature. Customize Copilot to follow your preferred coding styles, frameworks, and best practices!
GitHub Copilot has introduced an experimental feature that allows developers to provide Code Generation Instructions. These instructions guide Copilot to generate code that adheres to your specific coding styles, uses preferred libraries, and follows best practices.
This repository serves as a centralized collection of such instructions, categorized by programming languages and frameworks. Whether you're using Python, JavaScript, or any other language, you'll find tailored instructions to enhance your Copilot experience.
note: The instruction sets provided here are intended as starting points. We understand that no single set of instructions will be perfect for everyone, and that's perfectly fine. Our primary goal is to raise awareness of this GitHub Copilot feature and offer initial versions for you to customize and build upon according to your needs. We encourage you to contribute your own suggestions and improvements to help enhance this resource for everyone!
Code Generation Instructions are guidelines that you can provide to GitHub Copilot to influence the code it generates. They can specify:
- Coding styles and conventions
- Preferred libraries and frameworks
- Commenting and documentation styles
- Design patterns and architectural principles
By setting these instructions, Copilot can produce code that better fits your project's needs and your personal or team's coding standards.
-
Enable the Experimental Feature:
Ensure you have the latest version of GitHub Copilot and that the experimental feature
github.copilot.chat.experimental.codeGeneration.instructions
is enabled in your VS Code settings. -
Select Instruction Files:
- Browse the
/instructions/
directory in this repository to find instruction files that suit your needs. - Instruction files are organized by programming language and framework.
- Feel free to customize these instruction files by adding, modifying, or removing instructions to fit your specific requirements.
- Browse the
-
Combine Instruction Files (Optional):
You can combine multiple instruction files to tailor Copilot's code generation to your preferences.
Example:
To combine the base Python instructions with NumPy-specific instructions:
cd instructions/python cat base.md numpy.md > ../../.vscode/copilot-instructions.md
-
Add Instructions to Your Project:
Place the combined instruction file at
.vscode/copilot-instructions.md
in the root directory of your project. -
Update Your VS Code Settings:
Add the following configuration to your
settings.json
file:"github.copilot.chat.experimental.codeGeneration.instructions": [ { "file": ".vscode/copilot-instructions.md" } ],
-
Restart VS Code:
Reload or restart VS Code to apply the new settings.
- Community Contributions: A growing collection of instruction sets contributed by developers worldwide.
- Organized Structure: Instructions are categorized by language and framework for easy navigation.
- Customizable: Combine and modify instruction files to suit your coding style and project requirements.
- Open to Feedback: We're eager to collaborate with the community to refine and improve these instructions.
copilot-instructions/
βββ README.md
βββ CONTRIBUTING.md
βββ LICENSE
βββ CODE_OF_CONDUCT.md
βββ instructions/
βββ python/
β βββ base.md
β βββ numpy.md
β βββ pandas.md
β βββ README.md
βββ javascript/
β βββ base.md
β βββ react.md
β βββ README.md
βββ [other languages]/
βββ [instruction files].md
βββ README.md
These instruction files are general guidelines. We encourage you to customize them to suit your specific needs. Feel free to add, modify, or remove instructions based on your coding style preferences and project requirements.
It's worth noting that the purpose of this feature is to guide Copilot in generating code that aligns with your standards. It's ultimately about your style and preferences, so please make sure to customize these instructions accordingly.
We're actively seeking feedback and ideas from the community! Check out our GitHub Discussions to participate.
We welcome contributions! Please read our Contributing Guidelines and adhere to our Code of Conduct.
We are open to feedback and collaboration to define and refine community standards for Copilot code generation instructions. The decisions made here are just a starting point, and we welcome your input to make this resource better for everyone.
This work is licensed under the Creative Commons Attribution 4.0 International License.
For questions, suggestions, or feedback, feel free to open an issue or reach out via email at [email protected].
Shoutout to the GitHub Copilot team for introducing this experimental feature and empowering developers to customize their code generation experience!