π οΈ GitHub Copilot: Custom Instructions, Prompts & Chats

π οΈ Customizing Your GitHub Copilot Experience: Instructions, Prompts, and Chat Modes
GitHub Copilot is more than just an autocomplete toolβit’s a powerful AI assistant you can tailor to your team’s needs. With the latest features in VS Code, you can now define custom instructions, prompts, and chat modes to make Copilot work exactly the way you want.
This post walks you through customizing Copilot for your projects, with hands-on steps, theory, and examples. Let’s dive in!
π Step 1: Repository Custom Instructions
Repository custom instructions let you guide Copilot with project-specific context and standards. By adding a .github/copilot-instructions.md
file, you ensure Copilot’s suggestions match your conventions.
Theory:
- Instructions are automatically included in every Copilot Chat request in your repo.
- Keep them short and focused: project purpose, folder structure, coding standards, and key tools.
- Docs: Adding repository custom instructions
Example:
# Project Description
This project is an educational website for sharing homework assignments and coding exercises with students.
## Project Structure
- `assignments/`: Contains a subfolder for each homework assignment.
- `templates/`: Stores reusable templates for new content.
- `assets/`: Holds CSS, JavaScript, images, and configuration files.
- `index.html`: The main website page, configurable via `config.json`.
## Project Guidelines
- Use consistent styling across all pages.
- Name files and folders descriptively and keep them organized.
## Educational Standards
- Focus on clear learning objectives and appropriate difficulty levels.
- Use language that is clear, encouraging, and student-friendly.
How to:
- Create
.github/copilot-instructions.md
in your repository. - Add your project description, structure, guidelines, and standards.
- Test by asking Copilot Chat:
Briefly explain this project to me
. Your instructions should be referenced in the response.
π Step 2: File-Specific Instructions
File-specific instructions (.instructions.md
) let you target rules to certain files or folders using glob patterns. Place them in .github/instructions/
.
Theory:
- Use
applyTo
in the frontmatter to specify which files the instructions apply to. - Focus on how tasks should be done in that part of the codebase.
- Docs: Custom Instructions
Example:
---
applyTo: "assignments/**/*.md"
---
# Assignment Markdown Structure Guidelines
## 1. Template Usage
- Use the structure from `templates/assignment-template.md` for all assignments.
- Each assignment should be a `README.md` file.
- Do not remove or skip any required sections from the template.
## 2. Section Guidance
- **Title**: Provide a short, descriptive name for the assignment.
- **Objective**: Write 1-2 sentences summarizing what the student will learn or accomplish.
- **Tasks**: Use action-oriented task names, clear requirements, and provide example input/output if helpful.
How to:
- Create
.github/instructions/assignments.instructions.md
. - Add your assignment structure and section rules.
- Open an assignment file and ask Copilot Chat to update it to match the template.
- Commit your instructions and the updated assignment file.
β‘ Step 3: Reusable Prompts
Prompt files (.prompt.md
) are reusable templates for common tasks, accessible via slash commands in Copilot Chat. Place them in .github/prompts/
.
Theory:
- Use prompts for repeatable workflows (e.g., creating new assignments).
- Reference other files with relative links.
- Docs: Prompt Files
Example:
---
mode: agent
description: Create a new programming homework assignment
---
# Create New Programming Assignment
## Step 1: Gather Assignment Information
Ask for the assignment topic if not provided.
## Step 2: Create Assignment Structure
- Create a new directory in `assignments/` for the assignment.
- Add a `README.md` file using the template.
- Fill out the assignment details and add starter code if needed.
## Step 3: Update Website Configuration
- Update `config.json` to include the new assignment. Set the due date to the current date plus 7 days, unless specified otherwise.
How to:
- Create
.github/prompts/new-assignment.prompt.md
. - Add your prompt steps and description.
- Use
/new-assignment
in Copilot Chat to trigger the workflow. - Review and commit the generated files.
π¬ Step 4: Custom Chat Modes
Chat modes (.chatmode.md
) let you define specialized Copilot personalities and workflows. Place them in .github/chatmodes/
.
Theory:
- Chat modes can restrict tools, set response formats, and maintain a unique personality.
- Docs: Custom Chat Modes
Example:
---
description: π‘ Assignment brainstorming assistant for Mr. Johnson's CS class
tools: ["codebase", "search"]
---
# π‘ Assignment Brainstorming Assistant
## My Response Style
- QUICK SCAN: Provide a brief analysis of existing assignments.
- IDEA BURST: Suggest 3-5 new assignment ideas quickly.
- NEXT QUESTION: Ask what information is needed to help further.
## Rules
- Keep responses short.
- Always end with a question.
- Focus on concepts, not details.
- Never write full assignment specifications.
- Base ideas on gaps in the current curriculum.
How to:
- Create
.github/chatmodes/assignment-brainstorming.chatmode.md
. - Add your description, tools, response style, and rules.
- Select your chat mode in Copilot Chat and try brainstorming questions.
π Recap
By combining repository instructions, file-specific rules, reusable prompts, and custom chat modes, you can make GitHub Copilot a true teammate. It will understand your project, enforce your standards, and help accelerate your workflow.
Next steps:
- Try these features in your own projects.
- Explore more on GitHub Docs and VS Code Docs
Happy customizing! π