Telling an AI assistant what your team expects is exhausting when you have to do it across fifty pull requests and dozens of daily chat prompts. GitHub Copilot addresses this friction through .github/copilot-instructions.md—a single Markdown file checked into your repository that injects project-specific rules, architectural patterns, and testing conventions directly into Copilot's prompt context.
At 365Finds, our view on this feature is straightforward: calling it "enforcement" is an exaggeration, but treating it as a contextual rudder transforms how useful GitHub Copilot is across an engineering team. It will not replace your linter or compiler. What it does is eliminate the tedious ritual of repeating "we use TypeScript strict mode, not any" every single morning.
The Mechanism: How Copilot Ingests Your File
The workflow is intentionally lightweight. You create a Markdown file located at .github/copilot-instructions.md in the root of your repository.
Whenever a developer triggers GitHub Copilot Chat, uses inline chat (Ctrl+I or Cmd+I), invokes Copilot Edits, or runs agentic workflows in supported editors like Visual Studio Code, Copilot automatically searches for this file. It reads the instructions and appends them to the system-level prompt sent to the underlying large language model.
You can verify that Copilot processed your instructions by inspecting the chat interface. Under the response, Copilot lists the reference files it consulted; when configured correctly, .github/copilot-instructions.md appears alongside any open workspace files. In Visual Studio Code, this behavior is governed by the setting github.copilot.chat.codeGeneration.useInstructionFiles, which defaults to enabled.
GitHub Copilot also supports hierarchical and path-specific layering:
- Repository-wide instructions:
.github/copilot-instructions.mdapplies across the entire codebase. - Path-specific instructions: Files saved under
.github/instructions/*.instructions.mdleverage YAML frontmatter with anapplyToglob pattern (for example,applyTo: "apps/api/**/*.ts"). These apply targeted rules only when Copilot touches matching files. - Agent instructions: Copilot recognizes multi-agent formats like
AGENTS.mdacross directory trees, respecting conventions shared across other developer tooling.
The Critical Distinction: Chat vs. Ghost Text
Here is the limitation most teams miss during initial rollout: .github/copilot-instructions.md does not govern real-time inline code completions.
Inline ghost text—the gray autocomplete suggestions that appear line by line as you type—operates on sub-100-millisecond latency budgets. The models powering inline suggestions evaluate immediate cursor proximity, recently viewed tabs, and adjacent syntax. They do not parse repository-wide instruction markdown files on every keystroke.
Custom instructions actively guide:
- GitHub Copilot Chat sidebars and panels
- Inline Chat conversations and prompt-driven rewrites
- Multi-file Copilot Edits and agent workflows
- GitHub pull request summaries and automated code review agents
If your team expects ghost text to magically stop suggesting var or unapproved libraries purely because of an instruction file, you will be disappointed. The file educates generative interactions; local file patterns educate autocomplete.
What Belongs in the File (and What Dilutes It)
The most common mistake 365Finds observes in team configuration is treating .github/copilot-instructions.md like an entire corporate wiki. Massive files backfire. Language models possess finite context attention; flooding the prompt with 500 lines of aspirational engineering philosophy causes the model to ignore nuanced rules altogether.
Keep the file under 150 lines. Focus on concrete, negative and positive constraints rather than vague prose.
| Category | High-Impact Instruction Example | Wasteful Fluff to Avoid |
|---|---|---|
| Language & Types | Use TypeScript 5.4+; strict mode enabled; avoid any; use unknown with type guards. | Write clean, type-safe code. |
| Architecture | Place business logic in services/; controllers only validate inputs with Zod and return HTTP responses. | Follow industry-standard clean architecture principles. |
| Error Handling | Return Result<T, AppError> types; do not throw unhandled exceptions in asynchronous service methods. | Handle errors gracefully. |
| Testing | Write unit tests using Vitest; name test files *.spec.ts; mock external APIs using MSW. | Write thorough tests with high test coverage. |
| Styling & UI | Use Tailwind CSS utility classes; avoid custom CSS modules or inline style objects. | Make sure the UI looks modern and responsive. |
Provide short "Do" and "Avoid" snippets for non-obvious conventions. LLMs mirror syntax examples far more reliably than descriptive paragraphs.
365Finds Evaluation: Steering vs. Guardrails
365Finds strongly advises teams not to confuse prompt guidance with automated governance. An instruction file is a probabilistic prompt enhancer, not a deterministic boundary.
An LLM instructed to "never use deprecated API X" will still occasionally generate deprecated API X if training data frequency overrules system prompt weight. True enforcement remains the domain of deterministic tooling:
- ESLint, Prettier, and Biome enforce syntax invariants and formatting.
- TypeScript and language compilers enforce structural type correctness.
- Continuous Integration (CI) test runners enforce functional contracts.
- Custom Instructions (
copilot-instructions.md) steer AI generation closer to team conventions on the first pass, cutting down the friction of manual refactoring.
When configured with sharp, scoped instructions, .github/copilot-instructions.md dramatically reduces onboarding friction and prevents AI suggestions from drifting into outdated framework patterns. Visual Studio Code activates this context by default through github.copilot.chat.codeGeneration.useInstructionFiles, reading changes to the Markdown file as soon as it is saved to disk.