GitHub Copilot allows you to customize its behavior by adding Markdown files to your .github
folder in a Git repository. There are three types of files you can add:
- Instructions – guide Copilot on your coding preferences
- Prompts – reusable prompt templates
- Chat Modes – customized modes for different tasks
1. Instructions
Instruction files let you provide Copilot with guidance and preferences.
Create a copilot-instructions.md
file in the .github
folder:
# Copilot Instructions ## General Guidelines - Follow the instructions in the instructions folder whenever possible. - File Changes: Only edit files when you have full context. Prefer reading large sections of code before making changes. - ... ## Workflow ... ## Coding Standard ...
This file will automatically bring the instructions into your chat context.
You can also create path-specific instruction files (xxx.instructions.md
) inside .github/instructions
.
--- applyTo: "**/*.ts,**/*.tsx" ---
This ensures instructions only apply to the files you specify.
2. Prompts
Prompt files allow you to create reusable prompts.
Create an xxx.prompt.md
file in .github/prompts
:
--- mode: 'agent' model: GPT-4o tools: ['githubRepo', 'codebase'] description: 'Generate a new React form component' --- Your goal is to generate a new React form component based on the templates in #githubRepo contoso/react-templates. Ask for the form name and fields if not provided. Requirements: * Use form design system components: [design-system/Form.md](../docs/design-system/Form.md) * Use `react-hook-form` for form state management * Always define TypeScript types for your form data * Prefer *uncontrolled* components using `register` * Use `defaultValues` to prevent unnecessary rerenders * Use `yup` for validation * Create reusable validation schemas in separate files * Use TypeScript types to ensure type safety * Customize UX-friendly validation rules
To use it, type /
followed by the prompt file name in the chat window.
3. Chat Modes
Create an xxx.chatmode.md
file in .github/chatmodes
:
--- description: Generate an implementation plan for new features or refactoring existing code. tools: ['codebase', 'fetch', 'findTestFiles', 'githubRepo', 'search', 'usages'] model: Claude Sonnet 4 --- # Planning mode instructions You are in planning mode. Your task is to generate an implementation plan for a new feature or for refactoring existing code. Do not make any code edits; just generate a plan. The plan should include: * **Overview** – brief description of the feature or task * **Requirements** – list of requirements * **Implementation Steps** – detailed step-by-step plan * **Testing** – tests to verify the implementation
You can select your custom chat mode in the chat window.
Summary
You don’t need to create these files from scratch. Awesome Copilot provides many templates—you just need to copy them into your project as needed.
Top comments (8)
This is a really practical breakdown. I’ve seen plenty of “use Copilot better” articles, but most skip over the customization side with instructions, prompts, and chat modes. The folder structure and file examples make it much clearer how to actually implement this in a real project. I especially like the idea of path-specific instructions—it’s a simple but powerful way to enforce coding standards without having to repeat yourself everywhere.
Yeah, I believe these configuration files are crucial, much like how we need a lint tool when writing code to ensure consistent code style within a project. These files can guide the style and quality of AI-generated code from a global perspective, and more importantly, they can significantly boost AI's work efficiency. For example, I personally really like this customized chat mode, where every time I ask the AI a question, it follows a process outlined in a file, and the answers returned are very structured. The results are more satisfying compared to those provided without custom prompt words.
Totally agree—config files for AI feel like .eslintrc for your brain. Without them, you get wild-west answers; with them, you get clean, consistent, almost linted thoughts. Honestly, half the battle with AI is teaching it not to freestyle like a jazz saxophonist when you just wanted bullet points.
Haha, I feel the same way. I'm always telling AI not to update the xxx file! It's working better with these instruction files.
spec-kit is quite something for a spec-driven development with Copilot (works with other agents too).
Also would look at Joyride !
Thank you for mentioning those useful projects here!
Good stuff
Thx bro. I enjoy Meme Monday ❤️