Five layers that turn a wandering agent into a focused one. The infrastructure that makes Copilot, Claude, and any other coding AI stop guessing and start delivering.
An instructions file is a real upgrade. After a few weeks, the cracks show. One file is loaded into every conversation, so it has to be short. Some rules belong everywhere; some rules belong on one file type; some rules are procedures, not standards. When everything goes in the same place, none of it lands consistently.
Every token your AI reads is a token it cannot spend on your problem. The fix is not to write more rules, it is to put each rule on the right layer so it loads only when it actually applies. Three questions decide the layer.
Stacked from highest cost to lowest. The right rule on the right layer is the entire game. Every layer below the first is essentially free unless the model needs it.
The first three layers shape what your AI sees before it starts thinking. Identity is the lens. Path rules are the page-margins. Skills are the recipes it can pull off the shelf when asked.
The last two layers solve different problems. Subagents protect the main conversation from doing too much at once. Hooks remove the model from the loop entirely for rules that must always fire.
For any new rule, walk these five questions top to bottom. Stop at the first one that fits. The same rule placed on the wrong layer either burns context every turn or never fires when it should.
Every project that uses AI long enough drifts into one of these. They are easy to fix once you see them, hard to spot from inside.
.claude/rules/. One file per dialect or path: a sql.md for T-SQL conventions, a pq.md for Power Query, a reports.md for everything inside the reports folder. Add a globs: line to the frontmatter so it auto-loads only when relevant..claude/skills/. One folder per skill (monthly variance, week-over-week refresh, ad-hoc audit), each with a SKILL.md. Put exact trigger phrases in the description so the model knows when to load it..claude/settings.json under hooks. Hooks run as shell commands on fixed events (when a file is saved, when the AI tries to stop), with the model out of the loop.Each layer in this module maps to a documented surface in either the Claude Code or VS Code Copilot ecosystem. The five-layer framing is original synthesis, but every layer is a real, documented configuration mechanism. Verify anything you want to.
Umbrella reference for the Claude Code CLI. Backs the framing that CLAUDE.md, path-scoped rules, skills, subagents, and hooks are all first-class configuration surfaces, not just convention.
docs.claude.com/en/docs/claude-code/overviewDocuments how subagents are defined in .claude/agents/, how the tools list restricts their capabilities, and how their context is isolated from the main thread. Backs Layer 4 (scene 6).
Reference for the hook system: hook events (PreToolUse, PostToolUse, Stop, etc.), how they are configured in settings.json, and the fact that they run as deterministic shell commands. Backs Layer 5 (scene 6) and the enforcement framing in scene 3.
Documents .github/copilot-instructions.md as the always-on identity surface plus the .github/instructions/ folder for path-scoped instructions. Backs Layers 1 and 2 in the Copilot ecosystem.
Umbrella reference for every Copilot customization surface, including chat modes and reusable prompts (Copilot's analog to skills). Backs the cross-ecosystem framing in scenes 4 through 6.
code.visualstudio.com/docs/copilot/customization/overview