ADR-AI-002 — Layered Instructions: Always-On, Path-Scoped and On-Demand
Status: Accepted Date: 2026-11-29 Authors: Engineering Team
Context
The ecommerce platform alone has detailed rules for template selection, layering, audit fields, tracing, metrics and Pub/Sub publishers. The infrastructure projects have naming, provisioning and OpenTofu rules. The documentation site has its own pipeline. Everything in an always-loaded instruction file is sent on every turn of every session, so a single large file is expensive and pushes out the code the assistant actually needs. Guidance the assistant does not need for the current task also makes it less likely to follow the guidance that matters.
Claude Code offers three ways to deliver instructions: CLAUDE.md files (always loaded for their folder), files in .claude/rules/ (always loaded, or loaded only for matching files when the rule has paths: frontmatter), and skills (only the description is always visible, and the body loads when the task matches).
Decision Drivers (FRs & NFRs)
- BRD-AI-001 BR-1.2 — right guidance at the right time.
- BR-1.7 — efficient sessions.
- SR-AI-001 SR-F-03, SR-F-04, SR-F-05, SR-NF-04.
Decision — How is assistant guidance organised and loaded?
Option 1 — One large workspace CLAUDE.md
Pros:
- Everything in one place, simple to find.
Cons:
- Every rule for every project is sent on every turn.
- Project rules apply, or look like they apply, to unrelated projects.
Option 2 — CLAUDE.md per project and module only
Pros:
- Guidance sits next to the code it describes.
Cons:
- Cross-project rules (secrets, references, coding patterns) must be copied into every project.
- Long procedures and checklists still load whenever that folder is in use.
Option 3 — Three layers: short CLAUDE.md files, path-scoped rules, on-demand skills (CHOSEN)
Pros:
- Always-on: the workspace
CLAUDE.md(project map and working rules) plus the rules that apply everywhere (06-security,12-config-pointer-resolution). - Path-scoped:
01-coding-patternsloads for source files,09,10and11for infrastructure files, andecommerce-shoppee.md(the short hard constraints) for files underecommerce-shoppee/**. - On-demand: the full ecommerce rule set, the dev container template, infrastructure doc templates, GitHub hardening and graphify are skills. The body loads only when the description matches, or when a person types
/<skill>. - Project and module
CLAUDE.mdfiles hold only what is specific to them.
Cons:
- A rule can be missed if its
paths:list is too narrow, or a skill can be skipped if its description does not match the request. - Authors must decide which layer a new rule belongs in.
Final Decision
Guidance is split into three layers. The test for placement is: a rule that must hold on every task is always-on. A rule tied to a file type or a project is path-scoped. A procedure, template or checklist used only for some tasks is a skill. One large file was rejected for cost and noise. Per-project files only were rejected because cross-project rules would be copied. The cost accepted is careful paths: lists and skill descriptions written as triggers (“Use when …”).