How to Set Up VS Code Copilot Custom Instructions
Why Use Custom Instructions?
Why Use Custom Instructions?
- Consistency: Ensure everyone follows the same standards for commits, docs, and more.
- Productivity: Automate repetitive tasks and reduce manual errors.
- AI Readiness: Make your workflow friendly for Copilot, ChatGPT, and other AI tools.
- Personalization: Tailor Copilot’s suggestions to your coding style and team practices.
Quick Start
Follow these steps to create your first custom instructions file:
Open the Command Palette (
Cmd+Shift+P
orCtrl+Shift+P
).Run
Chat: New Instructions File
to create a.instructions.md
file in.github/instructions
at the root of your repository.Add your guidelines in Markdown format. Example:
# Custom instructions for Copilot ## Project context This project is a web application built with React and Node.js. ## Indentation We use tabs, not spaces. ## Coding style Use camelCase for variable names and prefer arrow functions over traditional function expressions. ## Testing We use Jest for unit testing and Playwright for end-to-end testing.
Optionally, use the
applyTo
metadata to target specific files:--- applyTo: "**/*.ts" --- Coding practices for TypeScript files. ...
Example 1: Git Commit Message Guidelines
Commit Message Template
Use this format for clear, actionable commit messages:
<type>: [<JIRA-ticket>] <short description>
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat: [JIRA-2345] implement custom instruction UI
fix: [JIRA-7890] resolve extension crash issue
docs: [JIRA-4567] improve README file structure
Checklist:
- Use a valid type
- Include a JIRA ticket
- Keep it concise
- Use present tense
Example 2: Markdown Authoring Guidelines
Markdown Best Practices
- Use headings for structure
- Lists for steps or options
- Fenced code blocks for code/config
- Descriptive links and alt text
- Prefer Mermaid for diagrams
Example: Simple Flowchart
Important
.github/instructions/
are recognized by Copilot for custom instructions. Other locations like .vscode/
or docs/
are not supported.Tips & Tricks from VS Code Copilot Docs
- Personalize Copilot: Use instructions files to match your coding style and practices.
- Write effective prompts: Start general, then get specific. Give examples and break down complex tasks.
- Reuse prompts: Save prompt files in
.github/prompts
for your team to use in chat (for chat-based Copilot features, not custom instructions). - Provide context: Reference files, folders, or codebase in your prompts for more accurate suggestions.
- Choose the right Copilot tool: Use completions, chat, edits, or agent mode depending on your task.
- Workspace indexing: Let Copilot search your codebase for relevant context.
How to Add Custom Instructions in VS Code
- Create a Markdown file with your custom instructions template.
- Store it in
.github/instructions/
at the root of your repository. This is the only location recognized by Copilot for custom instructions. - Reference it in your team docs or onboarding guides as needed.
- (Optional) Use
.github/prompts/
to share reusable chat prompts with your team (for Copilot Chat, not custom instructions).
Tips for Teams & AI
- Keep instructions short, clear, and actionable.
- Use consistent formatting for easy parsing by AI tools.
- Update templates as your workflow evolves.
FAQ: Copilot Custom Instructions
Q: What are Copilot custom instructions? A: Custom instructions are markdown files that guide Copilot and other AI tools to follow your coding standards, workflows, and preferences.
Q: Where should I store my instructions files?
A: Place them in .github/instructions/
at the root of your repository. Other locations like .vscode/
or docs/
are not supported for Copilot custom instructions.
Q: Can I target instructions to specific file types?
A: Yes, use the applyTo
metadata to specify file patterns (e.g., **/*.ts
).
Q: Do custom instructions work with other AI tools? A: Many AI coding assistants, including Copilot and ChatGPT, can use these markdown guidelines for better context and suggestions.
Resources
- Git Commit Guidelines Gist
- Markdown Authoring Guidelines Gist
- VS Code Copilot Tips & Tricks
- VS Code Snippets Docs
- Mermaid Live Editor
Empower your team and your AI assistant—start using custom instructions in VS Code Copilot today!