Every development team adopting GitHub Copilot encounters the same irritation: the assistant writes clean, idiomatic code for an imaginary project that ignores your team's conventions. It imports the wrong HTTP client, writes class components in a modern React codebase, introduces legacy test utilities, or ignores your architectural layering by dropping raw queries into controllers.
You do not need to fight Copilot prompt by prompt. By configuring repository-level instructions, you embed your project's architectural invariants, framework constraints, and preferred idioms directly into the repository itself.
At 365Finds, our stance is direct: repository-level instructions are the most effective lever for aligning GitHub Copilot with real-world engineering standards, provided you resist the urge to turn them into an exhaustive encyclopedia. Here is how to configure them properly, how they behave across IDEs, and how to write rules that Copilot will actually respect.
1. The Standard Setup: .github/copilot-instructions.md
GitHub Copilot natively discovers and parses a designated Markdown file located inside your repository's .github directory:
my-repository/
├── .github/
│ └── copilot-instructions.md
├── src/
├── package.json
└── README.md
Setup Steps
- Navigate to the root of your project repository.
- Create the
.githubdirectory if it does not already exist. - Create a Markdown file named exactly
copilot-instructions.md. - Add your repository-wide conventions, constraints, and patterns in plain Markdown.
- Commit and push the file to your default branch.
Once committed, GitHub Copilot automatically incorporates the contents of .github/copilot-instructions.md into the context for Copilot Chat and inline code generation across Visual Studio Code, Visual Studio, JetBrains IDEs, and GitHub.com PR reviews.
2. A Production-Ready Instructions Template
A vague instruction like "Write clean and secure code" is completely ignored by language models. What Copilot needs are concrete rules, exact library names, and explicit negative constraints.
Here is a tested template used across modern TypeScript and Node.js repositories:
# Repository Instructions for GitHub Copilot
## Tech Stack & Ecosystem Baseline
- Runtime: Node.js 22 LTS
- Language: TypeScript 5.5+ (strict mode enabled)
- Framework: Next.js 15 (App Router only, no Pages router)
- State Management: TanStack Query and Zustand (do not suggest Redux)
- Testing: Vitest and Testing Library (do not suggest Jest)
## Architecture & Code Organization
- Domain logic must remain isolated within `src/core/` and have no direct HTTP dependencies.
- Database access is strictly confined to `src/repositories/` using Prisma ORM. Never write raw SQL in route handlers.
- Use named exports exclusively for functions and components. Avoid `export default`.
## Coding Idioms & Anti-Patterns
- Never use the TypeScript `any` type; prefer `unknown` with runtime type narrowing.
- Prefer `interface` over `type` for public API objects and component props.
- For async flow, use async/await with typed Result objects (`Result<T, E>`) instead of throwing uncaught exceptions.
- Do not import `@legacy-lib/utils`; always use the shared utility library `@acme/toolkit`.
## Testing Standards
- Colocate unit tests next to source files with the suffix `.test.ts`.
- Mock external network calls using MSW (Mock Service Worker). Do not patch `global.fetch` manually.
3. Advanced IDE Scoping in VS Code
While .github/copilot-instructions.md provides global repository context, larger codebases often require granular rules for separate folders—such as separating backend conventions from frontend components.
In Visual Studio Code, you have two additional ways to direct Copilot:
Option A: VS Code Workspace Settings
You can link explicit instruction files directly inside .vscode/settings.json using the github.copilot.chat.codeGeneration.instructions property:
{
"github.copilot.chat.codeGeneration.instructions": [
{
"file": ".github/instructions/frontend.md"
},
{
"file": ".github/instructions/backend.md"
}
]
}
Option B: Path-Specific .instructions.md Files
GitHub Copilot supports modular instruction files placed in .github/instructions/ with frontmatter defining target glob paths:
---
applyTo: "apps/web/**/*.tsx"
---
# Frontend Component Rules
- Always use React Server Components where interactive state is unnecessary.
- Style UI exclusively using Tailwind CSS utility classes; avoid custom CSS modules.
4. Priority Order Across Configuration Levels
When instructions conflict across environments, GitHub Copilot resolves context in a hierarchical sequence:
| Level | Location | Scope |
|---|---|---|
| 1. Personal Instructions | IDE settings / GitHub Chat profile | Applies only to your individual interactions |
| 2. Path-Specific Instructions | .github/instructions/*.instructions.md | Applies only to matched files and directories |
| 3. Repository Instructions | .github/copilot-instructions.md | Applies across the entire repository |
| 4. Organization Instructions | GitHub Org Settings > Copilot | Baseline enforced across enterprise repositories |
Personal instructions take precedence over repository rules in chat conversations, but repository instructions remain the foundational source of truth for repository structure and build conventions.
5. 365Finds Practical Recommendations and Common Pitfalls
At 365Finds, we have examined instruction configurations across dozens of commercial repositories. The difference between an effective configuration and a useless one comes down to three operational rules:
- Keep it under 100 lines: Language models allocate a finite context window to system instructions. When teams dump full architecture whitepapers or 1,500-line company style manuals into
copilot-instructions.md, Copilot begins suffering from instruction dilution. It misses critical constraints because the signal-to-noise ratio drops. - Prioritize negative constraints (What NOT to do): Copilot's base weights are trained on millions of public repositories, which skew toward older conventions. Telling Copilot what not to use (e.g., "Do not suggest Axios; use native fetch") has far higher impact than simply saying "Write modern network calls".
- Do not treat instructions as a replacement for CI: Instructions steer Copilot's initial suggestions; they do not enforce a cryptographic lock on code. A developer can accept wrong code or prompt Copilot around a rule. True compliance belongs in ESLint, TypeScript compiler checks, and automated CI test suites.
By committing a tight, curated .github/copilot-instructions.md file today, you eliminate repeated correction cycles and ensure every engineer on your team gets suggestions tailored to your actual architecture.