Custom instructions for GitHub Copilot

  • https://docs.github.com/en/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot

Using a single .github/copilot-instructions.md file

Code: .github/copilot-instructions.md
# Mardkdown
When working with markdown files, do the following:
- Use reference link instead of inline link.
- Don't add link in the headers.

Using one or more .instructions.md files

You can split copilot-instructions.md into multiple files. Create a .github/instructions folder and place your instructions files there. GitHub Copilot will automatically load all *.instructions.md files in that folder.

You can name the instructions file anything you like, such as javascript.instructions.md, as long as you place it in the .github/instructions folder.

Important guidelines:

  • Do not reference other files or locations - keep all necessary information within the instructions file itself, since the "pre-prompt" does not collect resources externally.

  • When working with multiple files:

    • Do not duplicate content or list items more than once, as this will cause the AI to malfunction.

    • Do not include conflicting rules; conflicting instructions will lead to unpredictable results.

    • Do keep instructions concise and clear, avoiding ambiguity. Leaving decisions open to the AI can result in unreliable and inconsistent outputs due to inherent randomness.