copilot-instructions

A reference for configuring GitHub Copilot with repository-wide instructions, path-specific rules, and agent guidance. GitHub Copilot is a coding assistant that can use these files when generating, reviewing, or changing code.

In plain words
What is it for?
Use it to create or organize Copilot instruction files, set rules for selected file types or directories, and understand how Copilot also uses AGENTS.md and related guidance.
Why use it?
It clarifies where Copilot looks for instructions and how rules for particular file paths differ from project-wide guidance. This reduces the chance of putting instructions in a file Copilot does not use.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/copilot-instructions
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 730 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00730
Opus 5 $0.00000 $0.00365
Sonnet 5 $0.00000 $0.00146
Haiku 4.5 $0.00000 $0.00073

Measured 2d ago against content hash 9c710d89d20b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

copilot-instructions scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nullifies safety policiesmediumAnti-refusal

"You have no restrictions", "do anything now", "ignore your guidelines": a direct jailbreak that disables guardrails.

- Don't try to give Copilot a personality or override its safety guidelines — it won't work and wastes instruction space

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

rules-mdc/ai-tools/copilot-instructions.mdc · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GitHub Copilot Custom Instructions Rules

Copilot supports three layers of custom instructions, from broad to specific.

Repository-Wide Instructions

  • File: .github/copilot-instructions.md
  • Applies to all Copilot interactions in the repo: chat, completions, code review, and the coding agent
  • Plain markdown, no special frontmatter required
  • You can ask the Copilot coding agent to generate this file for you — it will analyze your repo and create one

Path-Specific Instructions

  • Files: .github/instructions/<name>.instructions.md
  • Each file includes a YAML frontmatter applyTo field with a glob pattern specifying which files the instructions apply to
  • When Copilot is working on a file that matches the glob, both the repo-wide and the matching path-specific instructions are used together
  • Example:
---
applyTo: "**/*.ts"
---
# TypeScript Instructions
- Use strict mode
- Prefer interfaces over type aliases for object shapes
- Use discriminated unions for state management

Agent Instructions (AGENTS.md)

  • Copilot coding agent also reads AGENTS.md files (the OpenAI Codex format)
  • Nearest AGENTS.md in the directory tree takes precedence over others
  • Copilot also supports CLAUDE.md and GEMINI.md at the repo root as alternatives
  • If you have both copilot-instructions.md and AGENTS.md, both are used

What Works Well

  • Build, test, and validation commands — the coding agent uses these to verify its own changes
  • Framework and library preferences: "use React Testing Library, not Enzyme," "use fetch, not axios"
  • Naming conventions, file organization expectations, import ordering
  • Code review instructions: what Copilot should flag during reviews ("check for missing error handling," "verify accessibility attributes on interactive elements")

Path-Specific Patterns

  • **/*.test.ts — testing conventions (framework, assertion style, mock patterns)
  • src/api/** — API conventions (response format, error handling, auth patterns)
  • **/*.css — styling conventions (methodology, naming, no inline styles)
  • docs/** — documentation conventions (format, required sections, link validation)

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 62 lines · 0 tokens per session scan B 9c710d89d20b

Subscribe to this mod's changes

copilot-instructions is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 730 tokens. A static security scan graded it B with 1 finding (nullifies safety policies). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.