CLAUDE.md, Rules and Skills
Guidance is delivered in three layers so the assistant gets what the task needs and nothing more. The reasoning is in ADR-AI-002.
Which layer?
| The guidance is … | Put it in | Loaded |
|---|---|---|
| A working rule for every session (project map, where to start, git per project) | Workspace CLAUDE.md |
Always |
A rule that must hold on every task in every project (secrets, op:// references) |
.claude/rules/<nn>-<name>.md with no paths: |
Always |
| A rule for a file type or one project | .claude/rules/<nn>-<name>.md with paths: |
When matching files are in play |
| A long procedure, template, checklist or audit | .claude/skills/<name>/SKILL.md |
When the task matches the description, or on /<name> |
| Facts about one project or module only | <project>/CLAUDE.md, <project>/<module>/CLAUDE.md |
When working in that folder |
Precedence: the workspace rules apply everywhere. Where a project or module CLAUDE.md is more specific, it wins for that project. A rule is changed once, in the workspace repository, and never copied into a project repository.
CLAUDE.md files
- Workspace
CLAUDE.mdholds the Projects table, the read order, the documentation requirement, the new-project checklist and the graphify instructions. Keep it short. Everything in it is sent on every turn. - Project
CLAUDE.mdholds only what is specific to that project: stack, layout, commands, conventions. It links to shared rules by name ([[06-security]]) instead of repeating them. - Module
CLAUDE.mdholds a module’s ports, wiring and real gotchas. The source code wins over a staleCLAUDE.mdclaim, and the stale claim is recorded in the project’s private register.
Rules — .claude/rules/
A rule is a Markdown file. An optional paths: frontmatter list limits when it loads:
---
paths:
- "**/*.tf"
- "**/*.opnames"
---
# OpenTofu Conventions
...
Current rules:
| Rule | Scope | Covers |
|---|---|---|
01-coding-patterns |
Source files (.go, .rs, .ts, .tsx, .js, .dart, .astro, …) |
No-comment policy, no over-engineering, DTO parameters, validation files |
06-security |
Always | Secrets, no retrieval code, the guard hooks, auth header contract |
09-infra-naming-conventions |
Infrastructure files | Resource, credential, vault and Environment naming |
10-infra-provisioning-and-access |
Infrastructure files | Provisioning, identity scope and expiry |
11-opentofu-conventions |
Infrastructure files | Module layout, state, the code guard |
12-config-pointer-resolution |
Always | op:// references and op run |
ecommerce-shoppee |
ecommerce-shoppee/** |
The short hard constraints. The detail is in the skill |
Write a rule as a short list of MUST and NEVER statements with the reason, and end with a “Source of truth” table that points to longer material.
Skills — .claude/skills/<name>/
A skill is a folder with a SKILL.md and any supporting files:
---
name: infra-docs
description: "Create or update the operator documentation of an infrastructure layer ... Use when adding a layer or site repo, adding, renaming or removing a runbook, or when asked how infrastructure docs are named."
---
# /infra-docs
...
Only name and description are always visible. Write the description as a trigger: what it does, then “Use when …”, with the words a person would actually type. Keep SKILL.md as a short index and put templates, checklists and scripts beside it. The assistant reads them only when needed.
Current skills:
| Skill | Use it for |
|---|---|
/ecommerce-shoppee |
Full engineering rules for the ecommerce microservices and UIs: template matrix, layers, audit fields, tracing, metrics, deployment, audit-trail publishers |
/dev-container-tofu |
Creating, changing or auditing an OpenTofu dev container so it matches the tested template. Includes audit.sh |
/infra-docs |
Layout, numbered runbooks and README templates for infrastructure documentation |
/drawio-diagrams |
One format and style for every .drawio diagram: colour code, shapes, routed edges, a legend, a validator (validate.js) and the image export |
/publish-review |
Checking site content before it is published: real identifiers, credential names, weaknesses, attack-useful detail, copied code and duplicated facts. Includes a scanner (scan.js) and a checklist |
/github-repo-hardening |
Auditing a repository’s branch protection, CODEOWNERS, secret scanning and Actions settings, and applying fixes only after approval |
/graphify |
Building and querying the knowledge graph |
Adding a rule or skill
- Decide the layer with the table above. Prefer a skill for anything longer than a page.
- For a rule, set
paths:as narrowly as is still safe. A security rule has nopaths:. - For a skill, write the description as a trigger and list what it is not for (“Not for other projects”).
- Add it to the “Shared configuration” table in the workspace
CLAUDE.mdif people need to know it exists. - Commit to the workspace repository through a pull request. Rules and skills are part of the reviewed configuration.