Custom instructions allow you to define reusable guidelines that automatically shape Copilot Chat’s responses — ensuring consistency, quality, and alignment with your project or team standards.
📝 Instruction File Types
File Type | Purpose | Applies To |
---|---|---|
.github/copilot-instructions.md | Workspace-wide defaults | All chat prompts in the workspace |
*.instructions.md | Task/file-specific | Based on applyTo glob pattern |
✅ How to Enable & Use
-
Enable setting
Insettings.json
: -
Create instructions file
Options:-
From Chat View →
Configure Chat > Instructions > New instruction file
-
Or run:
Chat: New Instructions File
from Command Palette
-
-
Specify scope using frontmatter
📂 Where to Store Instructions
Location | Notes |
---|---|
.github/ | Workspace instructions (version-controlled) |
VS Code User Profile | Reusable across projects |
settings.json | Direct config for specialized tasks |
✍️ Instruction File Format
-
Use Markdown for formatting
-
Link to other instructions:
[see shared rules](./general-coding.instructions.md)
✨ Use Cases & Examples
✅ General Guidelines
✅ TypeScript + React
✅ Docs Writing
🛠 Settings-based Instructions
In settings.json
:
⚡ Generate Instructions Automatically
-
Open Chat View
-
Configure Chat > Generate Instructions
-
Edit the generated
.github/copilot-instructions.md
🔁 Sync Across Devices
-
Enable Settings Sync in VS Code
-
From Command Palette:
Settings Sync: Configure
-
Enable sync for Prompts and Instructions
💡 Best Practices
-
🧱 Keep each rule simple and atomic
-
🔄 Reuse and reference other instructions using links
-
📁 Use
applyTo
to scope rules to file types or folders -
👥 Store in workspace to share with teams via Git
-
📚 Split files by language, task, or framework
0 件のコメント:
コメントを投稿