| name | agent-audit |
| description | Audits Claude Code agent configuration against latest best practices. Works on any project. Manual via /agent-audit. Use when this capability is needed. |
| metadata | {"author":"cj-ways"} |
Agent Configuration Audit
Audit this project's Claude Code agent configuration against latest best practices.
Gotchas
- Flagging intentional patterns as issues. Read CLAUDE.md and
.claude/rules/ FIRST. What looks like a misconfiguration may be an intentional project convention documented there. Never report something as an issue if it's explained in the project's own docs.
- Recommending fields that don't exist. Claude Code's supported frontmatter fields change between versions. ALWAYS verify against the latest docs (Phase 1 research) before flagging a "missing" field — it may not be supported yet, or may have been deprecated.
- Overwhelming output. A full audit can produce 50+ findings. Prioritize ruthlessly — lead with HIGH severity, collapse LOW items into a summary table. Users stop reading after 10 findings.
- Ignoring user-level config. Project-level
.claude/ is only half the picture. Always check ~/.claude/settings.json, ~/.claude/rules/, and ~/.claude/skills/ for conflicts or overrides that affect behavior.
Argument Parsing
Parse $ARGUMENTS to determine scope. Examples:
| Invocation | Scope |
|---|
/agent-audit | Full audit — all components |
/agent-audit full | Same as above |
/agent-audit hooks | Only hooks (settings.json hook config + .claude/hooks/ scripts) |
/agent-audit permissions | Only permission allowlists/denylists in settings.json |
/agent-audit claudeignore | Only .claudeignore |
/agent-audit claude-md | Only CLAUDE.md |
/agent-audit memory | Only MEMORY.md |
/agent-audit skills | Deep-dive ALL skills — skip general audit |
/agent-audit skill:add-logs | Deep-dive ONLY the add-logs skill — skip everything else |
/agent-audit skill:agent-audit | Deep-dive ONLY this skill (meta-audit) |
/agent-audit agents | Deep-dive ALL agents — skip general audit |
/agent-audit agent:code-reviewer | Deep-dive ONLY the code-reviewer agent — skip everything else |
/agent-audit rules | Audit rules files — quality + conflict detection |
Routing logic:
- If argument starts with
skill: → extract skill name → jump directly to Skill Deep-Dive for that one skill only. Skip Phases 1-2.
- If argument starts with
agent: → extract agent name → jump directly to Agent Deep-Dive for that one agent only. Skip Phases 1-2.
- If argument is
skills → discover all skills → run Skill Deep-Dive for each. Skip Phase 2 general audit.
- If argument is
agents → discover all agents → run Agent Deep-Dive for each. Skip Phase 2 general audit.
- If argument is
rules → jump directly to Rules Conflict Detection. Skip Phases 1-2.
- If argument is a component name (
hooks, permissions, etc.) → run Phase 1 research scoped to that topic + Phase 2 checklist for that component only.
- If empty or
full → run everything.
Phase 1: Research Latest Best Practices
Use the Agent tool to launch parallel research agents (subagent_type: "general-purpose"). All agents MUST search the web for the current year's content:
Agent 1: Official Claude Code Docs
Fetch latest official Claude Code documentation for:
- Hooks: events, matchers, exit codes
- Settings: permissions, deny lists, sandbox, attribution
- Memory: CLAUDE.md hierarchy, auto-memory,
.claude/rules/
- Skills: valid frontmatter fields (critical — verify which fields are actually supported vs silently ignored)
- MCP, plugins, subagents
Agent 2: Community Patterns & New Features
Search for:
- Claude Code changelog / release notes for current year
- Community best practices and patterns
- New features or deprecated settings
When scoped to a component (e.g., /agent-audit hooks): only research that component's docs, not everything.
Phase 2: General Audit
Read and audit agent-related files. Skip this phase entirely for skills or skill:<name> arguments.
Files to Check
Auto-discover — check for existence of each:
.claudeignore
.claude/settings.json
.claude/settings.local.json
.claude/hooks/*
.claude/commands/*
.claude/skills/*/SKILL.md (surface-level only — name, description, size)
.claude/agents/* (if exists)
.claude/rules/* (if exists)
.mcp.json (if exists)
CLAUDE.md (or claude.md)
openspec/ (if exists)
.gitignore
Checklist
.claudeignore
.claude/settings.json
Hooks
CLAUDE.md
Commands & Skills (surface-level)
Memory (MEMORY.md if exists)
.gitignore
Phase 3: Skill Deep-Dive
Triggered by: skills (all), skill:<name> (one), or during full audit if a skill looks problematic in surface-level check.
Discovery
- List all skills:
ls .claude/skills/*/SKILL.md
- If
skill:<name> — find the matching skill directory
- Read each target skill's SKILL.md fully
Complexity Assessment (for skills argument only)
Before auditing each skill, assess if it needs a separate agent:
Use a separate agent when ANY of these are true:
- SKILL.md exceeds 100 lines
- Skill contains inline commands (exclamation-backtick syntax) that need execution testing
- Skill references external files or scripts
- Skill has complex argument handling
Audit inline (no separate agent) when:
- SKILL.md is short and simple (under 100 lines)
- No inline commands or external references
- Straightforward instructions
Skill Audit Checklist
For EVERY skill being deep-dived, check ALL of the following:
Frontmatter
Content & Structure
Technical Correctness
Codebase Alignment
Invocation & UX
Security
Skill Deep-Dive Report (per skill)
### Skill: <skill-name>
**Lines:** N | **Complexity:** low/medium/high | **Agent used:** yes/no
**Checks Passed:** X/Y
| Category | Check | Status | Detail |
|----------|-------|--------|--------|
| Frontmatter | Supported fields only | PASS/FAIL | ... |
| Frontmatter | Description concise | PASS/FAIL | ... |
| Technical | Inline commands valid | PASS/FAIL | ... |
| Technical | Patterns match codebase | PASS/FAIL | ... |
| Alignment | Matches CLAUDE.md | PASS/FAIL | ... |
| Security | No secrets exposed | PASS/FAIL | ... |
Phase 3b: Agent Deep-Dive
Triggered by: agents (all), agent:<name> (one), or during full audit.
Discovery
- List all agents:
ls .claude/agents/*.md
- If
agent:<name> — find the matching agent file
- Read each target agent file fully
Agent Audit Checklist
For EVERY agent being deep-dived, check ALL of the following:
Frontmatter
Codebase Alignment
Content Quality
Security
Agent Deep-Dive Report (per agent)
### Agent: <agent-name>
**Lines:** N | **Model:** sonnet/opus
**Checks Passed:** X/Y
| Category | Check | Status | Detail |
|----------|-------|--------|--------|
| Frontmatter | Has name + description | PASS/FAIL | ... |
| Frontmatter | Model appropriate | PASS/FAIL | ... |
| Alignment | Tech stack matches project | PASS/FAIL | ... |
| Alignment | Conventions match CLAUDE.md | PASS/FAIL | ... |
| Content | Clear workflow | PASS/FAIL | ... |
| Security | No secrets | PASS/FAIL | ... |
Phase 3c: Rules Conflict Detection
Triggered by: rules, or during full audit.
Rules Conflict Detection
When auditing rules (either as part of full or rules scope):
-
Identify sources: Classify each rules file:
- Arcana rules: files matching
arcana-*.md pattern in .claude/rules/
- User rules: all other
.md files in .claude/rules/
- CLAUDE.md: project root instructions
-
Read all rules files and extract the key directives from each
-
Cross-check for semantic conflicts:
- For each Arcana directive, check if any user rule contradicts it
- Example conflict: Arcana says "research before acting" but user rule says "be concise, no research"
- Example non-conflict: Arcana says "verify before output" and user says "use TypeScript strict" (different concerns)
-
Report findings with source labels:
📦 Arcana rules (3 files):
✓ arcana-quality.md — no conflicts
⚠ arcana-research.md — potential conflict with your rules
Arcana: "Research before acting"
Your rule (coding-style.md): "Keep responses concise and fast"
→ These may conflict during complex analysis tasks
📁 Your project rules (2 files):
✓ architecture.md — no issues
✓ coding-style.md — reviewed (see conflict above)
-
For each conflict: Ask the user which should take priority. Do NOT auto-resolve.
-
Self-audit note: When auditing Arcana's own skills, label them clearly:
📦 Arcana skill: deep-review
✓ Frontmatter valid
⚠ Could benefit from `context: fork` (new Claude Code feature)
Never say "Arcana's skill is wrong." Say "could benefit from [improvement]" or "consider updating."
Phase 4: Report
Full/Component Audit Report
## Agent Configuration Audit Report
**Date:** YYYY-MM-DD
**Project:** <project name from CLAUDE.md or directory name>
**New Features Found:** [any new Claude Code features from research]
### Score: X/10
### What's Working Well
- ...
### Issues Found
| # | Severity | Component | Issue | Recommendation |
|---|----------|-----------|-------|----------------|
### Recommendations (Priority Ordered)
1. [HIGH] ...
2. [MEDIUM] ...
3. [LOW] ...
Phase 5: Implementation Plan
If actionable improvements found:
- Write concrete plan with exact file changes
- Wait for user approval
- On approval, implement changes
If no issues: report "All clear — configuration is up to date" and skip planning.
Rules
- NEVER modify files without user approval
- ALWAYS search latest docs — do not rely on cached knowledge
- Be specific — include exact file paths and code snippets in recommendations
- Flag deprecated or silently-ignored settings/fields
- If CLAUDE.md exceeds 15KB, recommend moving sections to
.claude/rules/
- Adapt to whatever project structure exists — don't assume any specific stack
- Check for both project-level AND user-level skills/rules conflicts
Source: cj-ways/arcana — distributed by TomeVault.