Skip to content

luongnv89/awesome-github-copilot-instruction

 
 

Repository files navigation

Awesome GitHub Copilot Custom Instructions

Awesome GitHub Copilot Custom Instructions

A curated list of awesome custom instructions for GitHub Copilot to enhance your coding experience.

GitHub Copilot is an AI pair programmer that helps you write better code. Custom instructions allow you to tailor Copilot's behavior to your specific needs and preferences.

Why Custom Instructions?

Custom instructions allow you to enhance GitHub Copilot's responses by providing persistent context about your development preferences and requirements. These instructions automatically apply to all interactions with Copilot, eliminating the need to repeat context in every query. They can be configured for specific purposes:

  1. Code Generation: Define coding style preferences, naming conventions, and implementation patterns
  2. Test Generation: Specify testing frameworks and methodologies
  3. Code Review: Set criteria and focus areas for code analysis
  4. Commit Messages: Define commit message format and content requirements

Custom instructions are applied automatically in Chat view, Quick Chat, and Inline Chat, making them a powerful tool for maintaining consistency across your development workflow.

How to Use

Method 1: Using Settings

  1. Open VS Code settings.json file
  2. Configure custom instructions using github.copilot.chat.codeGeneration.instructions
  3. Instructions can be defined directly in settings or referenced from external files

Example settings.json configuration:

"github.copilot.chat.codeGeneration.instructions": [
  {
    "text": "Always add a comment: 'Generated by Copilot'."
  },
  {
    "text": "In TypeScript always use underscore for private field names."
  },
  {
    "file": "code-style.md"
  }
]

Example code-style.md:

Always use React functional components.

Always add comments.

Note:

  • Instructions can be defined at User or Workspace level
  • You can specify language-specific instructions
  • External files can be referenced using the file property
  • Multiple instructions can be combined in a single configuration

Method 2: Using Instructions File (Recommended)

  1. Create a .github/copilot-instructions.md file at the root of your workspace
mkdir -p .github
touch .github/copilot-instructions.md
  1. Enable instruction files in VS Code settings:

    • Set github.copilot.chat.codeGeneration.useInstructionFiles to true
  2. Add your custom instructions to the file using Markdown format

Note:

  • Instructions can be written as single paragraphs or separated by blank lines
  • Whitespace between instructions is ignored
  • The file works in both VS Code and Visual Studio
  • If you have instructions in both settings and the file, Copilot will combine them

Tip: In VS Code's Explorer view, you can create the folder and file in one step by typing the full path as the file name.

Contributing

Contributions are welcome! To add a new custom instruction:

  1. Fork this repository
  2. Create a new markdown file in the appropriate category under instructions/
  3. Follow the template in TEMPLATE.md
  4. Add your entry to the README.md
  5. Submit a pull request

Please ensure your contribution is original and includes:

  • Clear description of the instruction's purpose
  • Example usage
  • Any relevant context or limitations
  • Proper formatting and organization

License

CC0

About

📄 A curated list of awesome GitHub Copilot custom instruction - inspired from PatrickJS/awesome-cursorrules

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 87.9%
  • CSS 9.2%
  • HTML 2.9%