Platforms/GitHub Copilot

GitHub Copilot

GitHub Copilot is GitHub's AI pair programmer. It supports custom instructions through a workspace-level configuration file.

Configuration File

.github/copilot-instructions.md

A markdown file that Copilot reads to understand workspace-specific coding conventions and preferences.

File Location

your-project/
├── .github/
│   └── copilot-instructions.md   ← Your config file
├── src/
└── package.json

The file must be in the .github directory at the root of your repository.

How Copilot Uses It

Copilot automatically includes these instructions when generating suggestions:

  • Code completions in the editor
  • Copilot Chat responses
  • Code generation from comments

Availability: Custom instructions are available in GitHub Copilot Business and Enterprise plans. Check GitHub's documentation for the latest features.

Example Instructions

# Copilot Instructions for MyProject

## Language and Framework
- This is a TypeScript project using React and Next.js
- Always use TypeScript types, avoid `any`
- Use functional components with hooks

## Code Style
- Use 2 spaces for indentation
- Prefer arrow functions for components
- Use single quotes for strings
- Always include semicolons

## Naming Conventions
- Components: PascalCase (e.g., UserProfile)
- Functions: camelCase (e.g., getUserData)
- Constants: SCREAMING_SNAKE_CASE
- Files: kebab-case (e.g., user-profile.tsx)

## Best Practices
- Always handle errors in async functions
- Use React Query for server state
- Prefer composition over inheritance
- Write unit tests for utility functions

Tips

Be Specific

Copilot works best with concrete, specific instructions rather than vague guidelines.

Focus on Style

Naming conventions, formatting, and patterns are where instructions help most.

Keep It Short

Copilot has context limits. Focus on the most important rules.

Include Examples

Show code examples for patterns you want Copilot to follow.

← Claude CodeWindsurf →