Claude Config Conventions
Architecture Layers
| Layer |
Location |
Loading |
Purpose |
| Rules |
.claude/rules/ |
Always loaded (main session only) |
Lightweight principles, language-agnostic |
| Skills |
.claude/skills/ |
Conditionally loaded by description match |
Principles and patterns (WHAT) |
| Agents |
.claude/agents/ |
Invoked explicitly |
Workflow and process (HOW) |
Content Placement Rules
- Skills define principles (WHAT). Agents define workflow (HOW). Never duplicate between them.
- Agents do NOT auto-inherit Rules or Skills -- declare skills in frontmatter (always-load) or in agent body with Skill tool (on-demand). See Skill Loading Strategy.
- Content needed in both main session and agents --> put in Skill (not Rule).
- When modifying an agent, check ALL skills it loads for consistency.
Scope Purity
A skill's content must match the scope declared by its name and description.
When creating a new skill:
- Can the principles be abstracted to be platform-independent?
- Yes -- Generic-scoped SKILL.md (principles only) + platform-specific content in
references/ or dedicated skills
- No -- Platform-scoped SKILL.md with specific content directly. Name must include the platform (e.g.,
postgresql-patterns, react-patterns)
Review checks:
- Generic-named skills must not contain platform-specific content
- Platform-named skills must not contain content for other platforms
references/ vs dedicated skill decision:
If the content is used independently without the parent skill -- dedicated skill. If always loaded together with the parent -- references/. When uncertain, start with references/ and promote to dedicated skill when independent usage emerges.
Naming Conventions
Agent naming: {scope}-{role}
{scope} matches the command's {object} keyword for discoverability
{role} conveys the agent's persona (designer, planner, reviewer, etc.)
- Examples:
ux-planner, how-planner, adr-architect, build-fixer, code-reviewer
Command naming: {verb}-{object}
- Verb-first for action clarity
- Examples:
/plan-ux, /plan-how, /fix-build, /code-review
Mapping rule: Agent {scope} = Command {object}
| Command |
Object |
Agent(s) |
Scope |
/plan-ux |
ux |
ux-planner, ux-critic, ux-optimizer, ux-synthesizer |
ux |
/plan-how |
how |
how-planner, how-critic, how-optimizer, how-synthesizer |
how |
/plan-claude-config |
claude-config |
claude-config-planner, -critic, -optimizer, -synthesizer |
claude-config |
/create-architecture-decision |
architecture-decision (long) |
adr-architect |
adr |
/fix-build |
build |
build-fixer |
build |
/code-review |
code-review |
code-reviewer |
code |
Exact match exception: When the command name is short and unambiguous, the agent can match exactly (e.g., /commit -> commit agent, /push-to-remote -> push-to-remote agent).
Agent Conventions
Frontmatter (required fields):
name -- kebab-case identifier
description -- clear purpose and when to use
tools -- list of required tools
skills -- list skills the agent always needs (see Skill Loading Strategy). Optional if the agent needs no skills.
model: field:
- Optional. If omitted, inherits from caller.
- Plans must NOT specify model selection for agents they create -- model choice is the user's decision.
- Exception -- Agent Team teammates: Commands that define Agent Team teammates MAY specify
model: to control cost. Teammates use standard Opus (not 1M context) since they process focused subtasks, while the main session uses Opus 1M for full project context. This is a cost optimization, not a quality downgrade.
- Do not downgrade to cheaper models (sonnet, haiku) without explicit user instruction.
Content rules:
- Agent = workflow/process (HOW). Never duplicate content from skills it loads.
- Do not include general knowledge Claude already knows (standard library usage, basic syntax, general concepts).
- Include a "When Invoked" section describing the execution flow. For Agent Team teammates, "Teammate Protocol" is an accepted alternative that describes the agent's role in the team debate workflow.
- Include output format specification if the agent produces structured output.
Skill Loading Strategy
Subagent skills in skills: frontmatter are fully preloaded at startup -- there is no conditional loading by description match. Use this decision framework:
| Category |
Where to declare |
When |
| Always-load |
skills: frontmatter |
Skills the agent needs on every invocation regardless of task |
| On-demand |
Agent body text + Skill tool |
Domain-specific skills needed only when the task involves that domain |
Always-load examples: review-severity-format (every review needs it), pcos-debate (every PCOS teammate needs it), ears-format (how-planner always writes EARS)
On-demand examples: postgresql-patterns (only when task involves PostgreSQL), cicd-patterns (only when task involves CI/CD)
To enable on-demand loading, add Skill to the agent's tools: list and include invocation guidance in the agent body:
## On-Demand Skills
Load these skills when the task involves their domain:
- `/database-patterns` -- database schema or query design
- `/cicd-patterns` -- CI/CD pipeline configuration
Reliability trade-off: On-demand loading depends on the agent's judgment to invoke the skill. Use always-load for skills whose absence causes incorrect output (e.g., review-severity-format for reviewers). Use on-demand for domain-specific skills whose absence degrades quality but does not cause wrong behavior.
Review check: if a skill in skills: frontmatter is only relevant to a subset of the agent's tasks, consider moving it to on-demand loading.
Command Conventions
Frontmatter (required fields):
description -- concise, starts with a verb (used for matching/triggering)
Content rules:
- Body is expanded in the main session context (not inside a subagent).
- Delegate to a subagent for actual work, UNLESS:
- Interactive: requires back-and-forth dialogue with the user during execution (e.g.,
/investigate)
- Trivial: a few simple operations where subagent overhead exceeds the work itself (e.g.,
/verify)
- Include a "Next Commands" section when the command has natural follow-up steps in a workflow.
- Include a "Prerequisites" section if the command requires prior state.
Rule Conventions
- Always loaded in main session only (not in agents).
- Lightweight principles, language-agnostic.
- Content needed in both main session and agents --> put in a Skill instead of a Rule.
Agent Responsibility Boundaries
Reviewers have non-overlapping responsibilities:
| Agent |
Scope |
code-reviewer |
Code quality: integrity, readability, comments, best practices |
security-reviewer |
All security and OWASP concerns |
performance-reviewer |
Algorithmic complexity, memory, rendering, bundle size, caching, network optimization |
sre-reviewer |
Observability, resilience, health checks, resource limits, blast radius, incident readiness |
database-reviewer |
SQL queries, ORM usage, schema design |
dead-code-reviewer |
Unused code, imports, dependencies |
claude-config-reviewer |
Claude Code configuration quality and consistency |
test-quality-reviewer |
Test coverage analysis, uncovered paths, test-to-code ratio |
accessibility-reviewer |
WCAG 2.2 compliance, ARIA correctness, keyboard navigation, screen reader compatibility |
Reviewer Integration Checklist
When a new reviewer agent is added to the /code-review pipeline, ALL of the following must be updated:
- Agent file created in
.claude/agents/ with boundary definitions
- Skill file created in
.claude/skills/ (if the reviewer needs domain-specific patterns)
/code-review command: reviewer table, reviewer count, issue ID prefix
review-severity-format skill: issue ID prefix added
claude-config-conventions skill: Agent Responsibility Boundaries table updated
CLAUDE.md: reviewer count and any workflow descriptions updated
PCOS Agent Team Pattern
The PCOS (Planner-Critic-Optimizer-Synthesizer) pattern uses Agent Teams for structured debate before implementation.
Four roles:
| Role |
Hat |
Responsibility |
| Planner |
Blue/White |
Drafts the plan based on analysis of existing files |
| Critic |
Black |
Finds problems -- missing edge cases, anti-patterns, conflicts |
| Optimizer |
Green |
Proposes improvements and breaks deadlocks between Planner and Critic |
| Synthesizer |
-- |
Converges debate into final plan with Critique Log |
When to use PCOS:
- Configuration changes that affect multiple interconnected files (agents, skills, commands)
- Changes where trade-offs need structured evaluation (e.g., architecture layer decisions)
- NOT for trivial single-file edits or mechanical updates
PCOS-enabled commands:
| Command |
Team |
Domain |
/plan-ux |
ux-planner, ux-critic, ux-optimizer, ux-synthesizer |
UX plans (user stories, Gherkin) |
/plan-how |
how-planner, how-critic, how-optimizer, how-synthesizer |
Implementation plans (EARS, ADR) |
/plan-claude-config |
claude-config-planner, -critic, -optimizer, -synthesizer |
Config changes (.claude/) |
All PCOS-enabled commands include a complexity gate: simple requests bypass the team debate and delegate to the Planner agent directly.
Debate flow:
- Planner drafts plan and shares with Critic and Optimizer
- Critic sends challenges, then Optimizer sends proposals incorporating Critic's input (both to Planner)
- Planner accepts/rejects/defers each item, sends revised version to Critic, Optimizer, AND Synthesizer
- Critic and Optimizer send final assessments to Synthesizer
- Synthesizer converges debate, writes output files, and sends Critique Log to team lead
- Team lead presents plan to user
Pre-implementation vs post-implementation review:
- PCOS Critic (pre-implementation): Reviews the plan during PCOS debate, before any files are created or modified. Catches architectural issues early. Exists in all PCOS teams (ux-critic, how-critic, claude-config-critic).
- Post-implementation reviewer (post-implementation): Reviews implemented file changes after the plan has been executed. Catches issues that only appear in actual file content (e.g., config-reviewer for config changes, code-reviewer for code changes).
These are different stages with different inputs -- no responsibility overlap.
Subagent Constraints
- Subagents return text results only -- no structured data (task IDs, etc.)
- Subagents must NOT use TaskCreate -- task creation is the main session's responsibility. Subagents that use TaskCreate pollute the task list with intermediate work items
- If a command needs tasks created from subagent results, specify this in the command body (e.g., "After the subagent returns, create TaskCreate entries for each action item")
- Subagents cannot spawn other subagents (no nested Task tool usage)
No Personal or Company Information in Git
This repository is a public dotfiles repo. Git-tracked files must NEVER contain:
- Real names (use
[user] placeholder or store in memory/ which is git-ignored)
- Company names, workspace URLs, or internal channel names
- Email addresses, Slack user IDs, or employee identifiers
- API tokens, OAuth secrets, or credentials
Personal/company-specific values go in memory/ (e.g., memory/slack-profile.md) or settings.local.json.
Anti-Patterns
- Putting workflow steps in a skill (belongs in agent)
- Putting shared principles in an agent (belongs in skill)
- Putting agent-needed content in a rule (rules are main-session only)
- Duplicating content between a skill and the agents that load it
- Downgrading model (sonnet, haiku) in plans or agent definitions without user instruction (Agent Team teammate model selection is allowed -- see model field rules)
- Omitting skills entirely (neither frontmatter nor on-demand) when the agent's responsibilities require them
- Commands doing substantial work directly instead of delegating to a subagent
- Giving subagents TaskCreate/TaskUpdate tools -- causes intermediate task pollution
- Hardcoding personal names, company names, or usernames in git-tracked config files
1---2name: claude-config-conventions3description: Conventions for Claude Code configuration files (agents, commands, rules, skills). Use when creating, reviewing, or modifying .claude/ configuration. Do NOT use for general application configuration (webpack, tsconfig, etc.) -- this is for Claude Code's own .claude/ directory only.4---5
6# Claude Config Conventions
7
8## Architecture Layers
9
10| Layer | Location | Loading | Purpose |
11|-------|----------|---------|---------|
12| Rules | `.claude/rules/` | Always loaded (main session only) | Lightweight principles, language-agnostic |
13| Skills | `.claude/skills/` | Conditionally loaded by description match | Principles and patterns (WHAT) |
14| Agents | `.claude/agents/` | Invoked explicitly | Workflow and process (HOW) |
15
16## Content Placement Rules
17
18- Skills define principles (WHAT). Agents define workflow (HOW). Never duplicate between them.
19- Agents do NOT auto-inherit Rules or Skills -- declare skills in frontmatter (always-load) or in agent body with Skill tool (on-demand). See Skill Loading Strategy.
20- Content needed in both main session and agents --> put in Skill (not Rule).
21- When modifying an agent, check ALL skills it loads for consistency.
22
23## Scope Purity
24
25A skill's content must match the scope declared by its name and description.
26
27When creating a new skill:
281. Can the principles be abstracted to be platform-independent?
29 - **Yes** -- Generic-scoped SKILL.md (principles only) + platform-specific content in `references/` or dedicated skills
30 - **No** -- Platform-scoped SKILL.md with specific content directly. Name must include the platform (e.g., `postgresql-patterns`, `react-patterns`)
31
32Review checks:
33- Generic-named skills must not contain platform-specific content
34- Platform-named skills must not contain content for other platforms
35
36**references/ vs dedicated skill decision:**
37If the content is used independently without the parent skill -- dedicated skill. If always loaded together with the parent -- references/. When uncertain, start with references/ and promote to dedicated skill when independent usage emerges.
38
39## Naming Conventions
40
41**Agent naming: `{scope}-{role}`**
42- `{scope}` matches the command's `{object}` keyword for discoverability
43- `{role}` conveys the agent's persona (designer, planner, reviewer, etc.)
44- Examples: `ux-planner`, `how-planner`, `adr-architect`, `build-fixer`, `code-reviewer`
45
46**Command naming: `{verb}-{object}`**
47- Verb-first for action clarity
48- Examples: `/plan-ux`, `/plan-how`, `/fix-build`, `/code-review`
49
50**Mapping rule: Agent `{scope}` = Command `{object}`**
51
52| Command | Object | Agent(s) | Scope |
53|---------|--------|----------|-------|
54| `/plan-ux` | `ux` | `ux-planner`, `ux-critic`, `ux-optimizer`, `ux-synthesizer` | `ux` |
55| `/plan-how` | `how` | `how-planner`, `how-critic`, `how-optimizer`, `how-synthesizer` | `how` |
56| `/plan-claude-config` | `claude-config` | `claude-config-planner`, `-critic`, `-optimizer`, `-synthesizer` | `claude-config` |
57| `/create-architecture-decision` | `architecture-decision` (long) | `adr-architect` | `adr` |
58| `/fix-build` | `build` | `build-fixer` | `build` |
59| `/code-review` | `code-review` | `code-reviewer` | `code` |
60
61**Exact match exception**: When the command name is short and unambiguous, the agent can match exactly (e.g., `/commit` -> `commit` agent, `/push-to-remote` -> `push-to-remote` agent).
62
63## Agent Conventions
64
65**Frontmatter (required fields):**
66- `name` -- kebab-case identifier
67- `description` -- clear purpose and when to use
68- `tools` -- list of required tools
69- `skills` -- list skills the agent always needs (see Skill Loading Strategy). Optional if the agent needs no skills.
70
71**`model:` field:**
72- Optional. If omitted, inherits from caller.
73- Plans must NOT specify model selection for agents they create -- model choice is the user's decision.
74- **Exception -- Agent Team teammates**: Commands that define Agent Team teammates MAY specify `model:` to control cost. Teammates use standard Opus (not 1M context) since they process focused subtasks, while the main session uses Opus 1M for full project context. This is a cost optimization, not a quality downgrade.
75- Do not downgrade to cheaper models (sonnet, haiku) without explicit user instruction.
76
77**Content rules:**
78- Agent = workflow/process (HOW). Never duplicate content from skills it loads.
79- Do not include general knowledge Claude already knows (standard library usage, basic syntax, general concepts).
80- Include a "When Invoked" section describing the execution flow. For Agent Team teammates, "Teammate Protocol" is an accepted alternative that describes the agent's role in the team debate workflow.
81- Include output format specification if the agent produces structured output.
82
83## Skill Loading Strategy
84
85Subagent skills in `skills:` frontmatter are fully preloaded at startup -- there is no conditional loading by description match. Use this decision framework:
86
87| Category | Where to declare | When |
88|----------|-----------------|------|
89| **Always-load** | `skills:` frontmatter | Skills the agent needs on every invocation regardless of task |
90| **On-demand** | Agent body text + `Skill` tool | Domain-specific skills needed only when the task involves that domain |
91
92Always-load examples: `review-severity-format` (every review needs it), `pcos-debate` (every PCOS teammate needs it), `ears-format` (how-planner always writes EARS)
93
94On-demand examples: `postgresql-patterns` (only when task involves PostgreSQL), `cicd-patterns` (only when task involves CI/CD)
95
96To enable on-demand loading, add `Skill` to the agent's `tools:` list and include invocation guidance in the agent body:
97
98```
99## On-Demand Skills
100
101Load these skills when the task involves their domain:
102- `/database-patterns` -- database schema or query design
103- `/cicd-patterns` -- CI/CD pipeline configuration
104```
105
106**Reliability trade-off**: On-demand loading depends on the agent's judgment to invoke the skill. Use always-load for skills whose absence causes incorrect output (e.g., review-severity-format for reviewers). Use on-demand for domain-specific skills whose absence degrades quality but does not cause wrong behavior.
107
108Review check: if a skill in `skills:` frontmatter is only relevant to a subset of the agent's tasks, consider moving it to on-demand loading.
109
110## Command Conventions
111
112**Frontmatter (required fields):**
113- `description` -- concise, starts with a verb (used for matching/triggering)
114
115**Content rules:**
116- Body is expanded in the main session context (not inside a subagent).
117- Delegate to a subagent for actual work, UNLESS:
118 - Interactive: requires back-and-forth dialogue with the user during execution (e.g., `/investigate`)
119 - Trivial: a few simple operations where subagent overhead exceeds the work itself (e.g., `/verify`)
120- Include a "Next Commands" section when the command has natural follow-up steps in a workflow.
121- Include a "Prerequisites" section if the command requires prior state.
122
123## Rule Conventions
124
125- Always loaded in main session only (not in agents).
126- Lightweight principles, language-agnostic.
127- Content needed in both main session and agents --> put in a Skill instead of a Rule.
128
129## Agent Responsibility Boundaries
130
131Reviewers have non-overlapping responsibilities:
132
133| Agent | Scope |
134|-------|-------|
135| `code-reviewer` | Code quality: integrity, readability, comments, best practices |
136| `security-reviewer` | All security and OWASP concerns |
137| `performance-reviewer` | Algorithmic complexity, memory, rendering, bundle size, caching, network optimization |
138| `sre-reviewer` | Observability, resilience, health checks, resource limits, blast radius, incident readiness |
139| `database-reviewer` | SQL queries, ORM usage, schema design |
140| `dead-code-reviewer` | Unused code, imports, dependencies |
141| `claude-config-reviewer` | Claude Code configuration quality and consistency |
142| `test-quality-reviewer` | Test coverage analysis, uncovered paths, test-to-code ratio |
143| `accessibility-reviewer` | WCAG 2.2 compliance, ARIA correctness, keyboard navigation, screen reader compatibility |
144
145## Reviewer Integration Checklist
146
147When a new reviewer agent is added to the `/code-review` pipeline, ALL of the following must be updated:
148
149- Agent file created in `.claude/agents/` with boundary definitions
150- Skill file created in `.claude/skills/` (if the reviewer needs domain-specific patterns)
151- `/code-review` command: reviewer table, reviewer count, issue ID prefix
152- `review-severity-format` skill: issue ID prefix added
153- `claude-config-conventions` skill: Agent Responsibility Boundaries table updated
154- `CLAUDE.md`: reviewer count and any workflow descriptions updated
155
156## PCOS Agent Team Pattern
157
158The PCOS (Planner-Critic-Optimizer-Synthesizer) pattern uses Agent Teams for structured debate before implementation.
159
160**Four roles:**
161
162| Role | Hat | Responsibility |
163|------|-----|---------------|
164| Planner | Blue/White | Drafts the plan based on analysis of existing files |
165| Critic | Black | Finds problems -- missing edge cases, anti-patterns, conflicts |
166| Optimizer | Green | Proposes improvements and breaks deadlocks between Planner and Critic |
167| Synthesizer | -- | Converges debate into final plan with Critique Log |
168
169**When to use PCOS:**
170- Configuration changes that affect multiple interconnected files (agents, skills, commands)
171- Changes where trade-offs need structured evaluation (e.g., architecture layer decisions)
172- NOT for trivial single-file edits or mechanical updates
173
174**PCOS-enabled commands:**
175
176| Command | Team | Domain |
177|---------|------|--------|
178| `/plan-ux` | ux-planner, ux-critic, ux-optimizer, ux-synthesizer | UX plans (user stories, Gherkin) |
179| `/plan-how` | how-planner, how-critic, how-optimizer, how-synthesizer | Implementation plans (EARS, ADR) |
180| `/plan-claude-config` | claude-config-planner, -critic, -optimizer, -synthesizer | Config changes (.claude/) |
181
182All PCOS-enabled commands include a complexity gate: simple requests bypass the team debate and delegate to the Planner agent directly.
183
184**Debate flow:**
1851. Planner drafts plan and shares with Critic and Optimizer
1862. Critic sends challenges, then Optimizer sends proposals incorporating Critic's input (both to Planner)
1873. Planner accepts/rejects/defers each item, sends revised version to Critic, Optimizer, AND Synthesizer
1884. Critic and Optimizer send final assessments to Synthesizer
1895. Synthesizer converges debate, writes output files, and sends Critique Log to team lead
1906. Team lead presents plan to user
191
192**Pre-implementation vs post-implementation review:**
193- **PCOS Critic** (pre-implementation): Reviews the *plan* during PCOS debate, before any files are created or modified. Catches architectural issues early. Exists in all PCOS teams (ux-critic, how-critic, claude-config-critic).
194- **Post-implementation reviewer** (post-implementation): Reviews *implemented file changes* after the plan has been executed. Catches issues that only appear in actual file content (e.g., config-reviewer for config changes, code-reviewer for code changes).
195
196These are different stages with different inputs -- no responsibility overlap.
197
198## Subagent Constraints
199
200- Subagents return text results only -- no structured data (task IDs, etc.)
201- Subagents must NOT use TaskCreate -- task creation is the main session's responsibility. Subagents that use TaskCreate pollute the task list with intermediate work items
202- If a command needs tasks created from subagent results, specify this in the command body (e.g., "After the subagent returns, create TaskCreate entries for each action item")
203- Subagents cannot spawn other subagents (no nested Task tool usage)
204
205## No Personal or Company Information in Git
206
207This repository is a public dotfiles repo. Git-tracked files must NEVER contain:
208- Real names (use `[user]` placeholder or store in `memory/` which is git-ignored)
209- Company names, workspace URLs, or internal channel names
210- Email addresses, Slack user IDs, or employee identifiers
211- API tokens, OAuth secrets, or credentials
212
213Personal/company-specific values go in `memory/` (e.g., `memory/slack-profile.md`) or `settings.local.json`.
214
215## Anti-Patterns
216
217- Putting workflow steps in a skill (belongs in agent)
218- Putting shared principles in an agent (belongs in skill)
219- Putting agent-needed content in a rule (rules are main-session only)
220- Duplicating content between a skill and the agents that load it
221- Downgrading model (sonnet, haiku) in plans or agent definitions without user instruction (Agent Team teammate model selection is allowed -- see model field rules)
222- Omitting skills entirely (neither frontmatter nor on-demand) when the agent's responsibilities require them
223- Commands doing substantial work directly instead of delegating to a subagent
224- Giving subagents TaskCreate/TaskUpdate tools -- causes intermediate task pollution
225- Hardcoding personal names, company names, or usernames in git-tracked config files