---
name: cc-audit
description: |
  Audit Claude Code components (skills, agents, hooks, settings).
  Use this skill when:
  - Checking component health and conventions
  - Inventorying all components in a project
  - Validating structure before deployment
  - Verifying cross-references between components
argument-hint: "[project|global|templates]"
disable-model-invocation: true
---

<objective>
Audit all Claude Code components (skills, agents, hooks, settings) in a given scope, validate their structure against official conventions, and generate a comprehensive report with actionable recommendations.
</objective>

<quick_start>

```bash
/cc-audit                  # Audit current project (.claude/)
/cc-audit project          # Audit project-level components
/cc-audit global           # Audit user-level (~/.claude/)
/cc-audit templates        # Audit SmartStack CLI templates/
/cc-audit all              # Audit all scopes
```

</quick_start>

<parameters>

<flags>
| Flag | Description |
|------|-------------|
| `project` | Scan `.claude/` in current working directory |
| `global` | Scan `~/.claude/` (user-level) |
| `templates` | Scan `templates/` (SmartStack CLI source) |
| `all` | Scan all scopes |
| `--fix` | Attempt auto-fix of common issues |
| `--verbose` | Show detailed validation per component |
</flags>

<examples>
```bash
# Quick health check
/cc-audit

# Full audit with details
/cc-audit all --verbose

# Audit and fix issues
/cc-audit project --fix
```
</examples>

</parameters>

<workflow>
1. Parse scope and flags
2. Scan directories for all components
3. Validate each component against official conventions
4. Check cross-references (skills ↔ agents, hooks ↔ scripts)
5. Generate audit report with status and recommendations
</workflow>

<state_variables>
| Variable | Type | Description |
|----------|------|-------------|
| `{scope}` | string | project, global, templates, or all |
| `{fix_mode}` | boolean | Auto-fix common issues |
| `{verbose}` | boolean | Show detailed output |
| `{scan_paths}` | string[] | Directories to scan |
| `{skills_found}` | object[] | Skills inventory |
| `{agents_found}` | object[] | Agents inventory |
| `{hooks_found}` | object[] | Hooks inventory |
| `{issues}` | object[] | All issues found |
</state_variables>

<entry_point>

**FIRST ACTION:** Load `steps/step-00-init.md`

</entry_point>

<step_files>
| Step | File | Purpose |
|------|------|---------|
| 00 | `steps/step-00-init.md` | Parse scope, detect environment, resolve paths |
| 01 | `steps/step-01-scan.md` | Scan all components in target directories |
| 02 | `steps/step-02-analyze.md` | Validate structure, frontmatter, cross-references |
| 03 | `steps/step-03-report.md` | Generate audit report with recommendations |
</step_files>

<execution_rules>
- **Load one step at a time** - Progressive loading
- **Non-destructive** - Read-only unless --fix is set
- **Comprehensive** - Check ALL components, not just a sample
- **Actionable** - Every issue must have a clear recommendation
- **Reference official docs** - Base all checks on Claude Code documentation
</execution_rules>

<success_criteria>
- All components in scope are inventoried
- Each component validated against official conventions
- Cross-references verified (no broken links)
- Clear report with status per component
- Actionable recommendations for each issue
</success_criteria>
