Four Instruction Files: CLAUDE.md, AGENTS.md, and More

Day 8 · Week 2 · Context — The Secret Sauce

Slack Message — copy & paste

🤖 Tip #8 — Four instruction files exist across platforms. Know who reads what — and use the env var trick to share rules without duplication.

#8 All Tools

Who Reads What

  • **CLAUDE.md** — Claude Code's primary file. Also read by Copilot coding agent (the cloud autonomous agent that works on GitHub issues). Supports @import for recursive includes.
  • **AGENTS.md** — the new open format (Aug 2025). Read by Copilot CLI, VS Code Chat, and the coding agent. Claude Code reads it too since v2.1.277, via the built-in `agents-md@builtin` plugin — but by default only in projects with no CLAUDE.md. Set `instructionFiles: claude-md-and-agents-md` in /config → Project instructions to load both.
  • **.github/copilot-instructions.md** — the original Copilot format. Still works. Repo-wide scope.
  • **.github/instructions/*.instructions.md** — path-scoped with `applyTo:` frontmatter. Like .claude/rules/ but for Copilot. Can exclude specific agents with `excludeAgent:`.
CLAUDE.md AGENTS.md copilot-instructions Instructions
#8 Context — The Secret Sauce

Cross-Platform Sharing

  1. 1 The sharing trick — no duplication needed
    • › Set `COPILOT_CUSTOM_INSTRUCTIONS_DIRS=".claude/rules"` as an env var
    • › Now BOTH Claude Code and Copilot CLI read the same rules
    • › Still need dual frontmatter (`paths:` + `applyTo:`) for path-matching in both tools
  2. 2 Check which instruction files your project has — ensure each tool can find what it needs
  3. 3 Set `COPILOT_CUSTOM_INSTRUCTIONS_DIRS=".claude/rules"` so Copilot CLI reads your existing Claude Code rules
  4. 4 Use dual frontmatter (`paths:` for Claude Code + `applyTo:` for Copilot) in all rule files for cross-platform path-matching
CLAUDE.md AGENTS.md copilot-instructions Instructions
Your screenshot here Optional — add a screenshot from your own workflow
KAI by Dragan Filipovic