In this article, Harald Binkle details how custom chat modes for GitHub Copilot in VS Code can improve productivity and collaboration in large projects by tailoring AI behavior and tools to specific workflows.

GitHub Copilot Custom Chat Modes for Large Projects

Author: Harald Binkle
Posted on: July 6, 2025, 03:00 PM

Overview

Learn to create custom chat modes in Visual Studio Code for GitHub Copilot to enhance development workflows, especially in complex, multi-faceted projects. These custom modes let you tailor Copilot Chat’s behavior and available tools to specific tasks, making AI assistance more efficient, focused, and consistent across your team.


What are Custom Chat Modes?

Custom chat modes are a feature in VS Code that allow developers to define and switch between specialized configurations for GitHub Copilot Chat. Unlike standard instruction files, custom chat modes:

  • Allow task-specific configurations (“AI personalities”) optimized for workflows like code reviews, testing, API design, and more.
  • Provide tool restrictions, enabling only the tools relevant to each task.
  • Enable quick context switching without rewriting instructions.
  • Combine both instructions and toolsets for holistic customization.

VS Code provides three default modes:

  • Ask Mode: Answers questions about the codebase and general coding concepts.
  • Edit Mode: Makes code edits across multiple files.
  • Agent Mode: Runs autonomous edits and terminal commands.

Custom chat modes go further by allowing you to define your own modes with detailed control.


Creating and Structuring Custom Chat Modes

Custom chat modes are defined by .chatmode.md files, typically placed in .github/chatmodes/ within your project. Each file combines frontmatter (with metadata and tool configuration) and instructions. For example:

Example 1: Code Review Mode

File: .github/chatmodes/blog-review.chatmode.md

---
description: Review code changes and suggest improvements
tools: ["codebase", "search", "usages"]
---

# Code Review Mode Instructions

You are in code review mode. Focus on:

1. Code quality and best practices
2. Potential bugs or security issues
3. Performance implications
4. Maintainability and readability
5. Adherence to project conventions

Provide specific, actionable feedback with code examples where appropriate.

Example 2: Testing Mode

File: .github/chatmodes/testing.chatmode.md

---
description: Focus on test creation, debugging, and testing strategies
tools: ["codebase", "search", "usages", "findTestFiles", "terminal"]
---

# Testing Mode Instructions

You are in testing mode. Your primary focus is on all aspects of testing:

## Test Creation

- Write unit tests for functions and components
- Create integration tests for API endpoints
- Develop end-to-end tests for user workflows
- Generate test data and mock objects

## Test Analysis

- Review existing tests for completeness
- Identify missing test coverage
- Suggest improvements to test structure
- Debug failing tests

## Testing Best Practices

- Follow AAA pattern (Arrange, Act, Assert)
- Use descriptive test names
- Keep tests focused and isolated
- Prefer behavior-focused tests

## Framework-Specific Guidelines

- For React: Use React Testing Library
- For APIs: Test success and error scenarios
- For E2E: Test critical user journeys
- Consider edge cases and errors

Provide complete, runnable examples with appropriate setup and teardown.

Example 3: Interfaces & Endpoints Mode

File: .github/chatmodes/interfaces.chatmode.md

---
description: Design and work with APIs, interfaces, data contracts
tools: ["codebase", "search", "usages", "fetch", "githubRepo"]
---

# Interfaces & Endpoints Mode Instructions

You are in interfaces and endpoints mode. Focus on API design and data contracts:

## API Design

- Create RESTful endpoints and select proper HTTP methods
- Define request/response schemas
- Plan versioning and error handling

## Interface Definition

- Create TypeScript interfaces for models
- Define contracts between frontend and backend
- Ensure type safety, document structures

## Data Validation

- Input and schema validation
- Handle malformed data, consider security

## Documentation Standards

- Use OpenAPI/Swagger
- Include examples, document errors and codes

## Best Practices

- Consistent naming
- Proper HTTP codes
- Pagination, caching, backward compatibility

Always consider the data lifecycle and integration points.

How to Set Up Custom Chat Modes

  1. Create .github/chatmodes/ Directory: In your project root folder.
  2. Add .chatmode.md Files: Define modes, each with instructions and allowed tools.
  3. Configure Tool Access: Tailor each mode’s toolset in the file’s metadata.
  4. Switch Modes: Use the chat mode dropdown in VS Code’s Chat view.

Chat mode folder structure in VS Code

Advanced Chat Mode Examples

Documentation Mode

---
description: Focus on creating and improving documentation
tools: ["codebase", "search", "fetch"]
---

# Documentation Mode Instructions

You are in documentation mode. Focus on creating clear, comprehensive documentation:
- Write for your target audience
- Use concise language
- Provide practical examples
- Structure content logically
- Add troubleshooting where relevant
- Cover APIs, user guides, technical specs, contribution guidelines

Keep docs updated with the codebase.

Performance Optimization Mode

---
description: Focus on performance analysis and optimization
tools: ["codebase", "search", "usages", "terminal"]
---

# Performance Optimization Mode Instructions

Focus on:
- Identifying and resolving bottlenecks
- Reviewing queries, API calls
- Analyzing loading/memory patterns
- Caching, code-splitting, lazy loading
- Measurable, actionable recommendations

Benefits of Custom Chat Modes

  • Faster context switching: Activate the right context instantly for any workflow.
  • More focused conversations: Each mode restricts Copilot’s behavior and tooling.
  • Better tool usage: Only relevant features are enabled per mode.
  • Consistent behavior: Ensures AI interaction is predictable.
  • Team alignment: Shared modes create uniform experiences for everyone.

When to Use Chat Modes vs Instruction Files

  • Use instruction files for file/folder-specific technical context, coding standards, and consistent behavior across all files.
  • Use custom chat modes for broad, task-oriented work (like code review, testing, API design), or when tasks cannot be matched to file paths.
  • Choose the approach that best aligns with your workflow and combine both for maximum Copilot effectiveness.

Best Practices for Chat Modes

  1. Keep each mode narrowly focused.
  2. Limit available tools to just what’s needed.
  3. Write precise instructions for each mode.
  4. Use clear, descriptive names for easy identification.
  5. Maintain modes regularly as your project evolves.
  6. Share and standardize modes across your team.

Conclusion

Custom chat modes in VS Code make GitHub Copilot a far more effective assistant in complex projects. By defining distinct AI configurations for different development workflows, teams can improve productivity, collaboration, and output quality.

Start by implementing modes for your most common tasks, iterate based on team feedback, and continue refining as requirements change. For a broader Copilot optimization strategy, combine chat modes with instruction files to cover both project-wide standards and task-specific behaviors.

Have you tried custom chat modes? Share your experiences and new ideas with Harald Binkle!

This post appeared first on “Harald Binkle’s blog”. Read the entire article here