Audit — Unified Audit Command
Auto-detect and execute the appropriate audit workflow.
Methodology Tracking
Every audit report MUST include a methodology field (JSON) or Methodology section (Markdown) documenting:
- Files Scanned — every file actually read
- Knowledge Tiers — which levels (L1–L4) were activated and whether each was available
- Standards Source — the skill files, checklists, and external standards used as rule authority
- Coverage Gaps — anything unavailable (RAG down, checklist not found, no platform rules loaded)
Track these as you work. Never leave them empty or with placeholder values.
Knowledge Retrieval (Pre-Audit)
Before executing any audit mode, activate knowledge-retrieval to load relevant context:
- L1
docs/ — existing conventions, past findings, ADRs for the files under review
- L2 RAG — component implementations, token definitions, usage patterns
- L4 Grep/Glob — fallback if RAG unavailable (search
packages/, src/ directly)
- L5 Context7 — library API verification for external dependency usage
RAG unavailable? Skip L2, go directly to L4 Grep/Glob. Never block the audit waiting for RAG.
Subagent Constraint
Subagents cannot spawn further subagents — neither Agent tool nor Task tool is available in subagent context. Therefore, this skill runs inline in the main conversation (no context: fork). The main conversation is the orchestrator — it dispatches specialist agents and merges their results.
Step 0 — Flag Override + Mode Selection
If $ARGUMENTS contains --poc, --beta, or --stable: extract the maturity tier and pass it through to references/ui-workflow.md workflow (Step 0.6). These flags combine with --ui — they are not standalone modes.
If $ARGUMENTS starts with --ui and no maturity tier flag (--poc/--beta/--stable) is present:
Ask the developer to confirm maturity tier before dispatching:
"What's the maturity stage of {ComponentName}?
--poc — prototype / proof-of-concept (relaxed rules, phased roadmap)
--beta — in active development (moderate strictness)
--stable — production-ready (full strictness)
Reply with the flag or just poc / beta / stable."
Wait for reply, then set the maturity tier and proceed.
If $ARGUMENTS starts with --ui: dispatch epost-muji via Agent tool. Pass component name + platform flags + maturity tier (if present) + references/ui-workflow.md workflow.
If $ARGUMENTS starts with --a11y: dispatch epost-a11y-specialist via Agent tool. Pass references/a11y-workflow.md + platform hint.
If $ARGUMENTS starts with --close --ui: load references/ui-close.md and execute inline.
If $ARGUMENTS starts with --close: load references/a11y-close.md and execute inline.
If $ARGUMENTS starts with --code: dispatch epost-code-reviewer via Agent tool.
If auto-detected as hybrid (see Hybrid Detection below): run Hybrid Orchestration.
Otherwise: continue to Auto-Detection.
Hybrid Detection
Trigger hybrid mode when ALL conditions met:
- Target contains klara-theme files (path contains
libs/klara-theme/ or libs/common/)
- File count >= 20 OR multiple subdirectories in scope
- No explicit
--ui or --code flag (those force single-agent mode)
Hybrid Orchestration (main context)
This runs in the main conversation, NOT in a subagent. The main context has Agent tool available.
session_folder = reports/{YYMMDD-HHMM}-{slug}-audit/
- Create session folder:
Bash("mkdir -p {session_folder}")
- Dispatch epost-muji via Agent tool with Template A+ from
references/delegation-templates.md:
- Fill: Scope, Component(s), Mode: library, Platform, Output path:
{session_folder}/muji-ui-audit.md
- WAIT for muji to complete
- Read muji report at
{session_folder}/muji-ui-audit.md. Extract:
finding_locations: Set of file:line flagged by muji
verdict: muji's overall verdict
a11y_findings: contents of ## A11Y Findings section (if present)
- If a11y findings exist AND maturity tier is NOT
poc: dispatch epost-a11y-specialist via Agent tool (Template B):
- Output path:
{session_folder}/a11y-audit.md
- WAIT for completion
- POC exception: If
--poc, skip a11y dispatch — A11Y findings are already advisory-only in muji's report (no dedicated a11y pass needed until beta)
- Dispatch epost-code-reviewer via Agent tool:
- Pass: file list,
{session_folder}/muji-ui-audit.md path (for dedup), SEC/PERF/TS/ARCH/STATE/LOGIC scope
- Output path:
{session_folder}/code-review-findings.md
- WAIT for completion
- Merge reports into
{session_folder}/report.md:
- Executive Summary with overall verdict
## UI Audit — muji verdict, finding count, link to muji-ui-audit.md
## A11Y Audit (if ran) — link to a11y-audit.md
## Code Review — code-reviewer findings inline
- Methodology section
6.5. Run build verification:
node .claude/hooks/lib/build-gate.cjs
Append ## Build Verification section to {session_folder}/report.md:
- Exit 0:
Build verification: ✓ PASS ({platform}, {duration_ms}ms)
- Exit 1:
Build verification: ✗ FAIL — {error excerpt} (advisory — does not block report)
- Exit 0 (no command):
Build verification: skipped (no build command detected)
- Write session.json per
references/session-json-schema.md
- Update reports/index.json per
core/references/index-protocol.md
Verdict = max(muji, a11y, code-reviewer) where REDESIGN > FIX-AND-REAUDIT > APPROVE.
Single-Agent Delegation Protocol
For non-hybrid dispatches (--ui, --code, --a11y):
- Create session folder per
references/output-contract.md
- Select template from
references/delegation-templates.md
- Fill all
{placeholders} — include Output path: {session_folder}/{filename}
- Dispatch via Agent tool to the specialist agent
- Wait for specialist report
- Run build verification:
node .claude/hooks/lib/build-gate.cjs — append ## Build Verification to report (advisory)
- Write
session.json and update reports/index.json
Output contract: references/output-contract.md is the single source of truth for paths and responsibilities.
| Template |
Specialist |
When |
| A — UI Component Audit |
epost-muji |
--ui flag or UI component signals |
| A+ — Feature Module UI Standards |
epost-muji |
Hybrid mode, multi-file library audit |
| A++ — POC Organism Audit |
epost-muji |
--ui + organism classification + --poc/--beta |
| B — A11y Audit |
epost-a11y-specialist |
--a11y flag or A11y findings from UI audit |
| C — Code Escalation |
epost-code-reviewer |
Critical findings needing deeper pass |
| D — Docs Gap Detection |
epost-docs-manager |
Post-audit, new feature, or refactor |
| E — MCP/RAG Query |
epost-mcp-manager |
Component catalog lookup, pattern search |
Aspect Files
| File |
Purpose |
references/output-contract.md |
Single source of truth — all output paths, session folders, file names, agent responsibilities |
references/ui-workflow.md |
Audit UI component (Senior Muji Reviewer) |
references/a11y-workflow.md |
Audit staged changes for WCAG 2.1 AA violations |
references/a11y-close.md |
Mark an accessibility finding as resolved |
references/ui-close.md |
Close/resolve a UI finding in known-findings DB |
references/ui-findings-schema.md |
Schema for reports/known-findings/ui-components.json |
references/session-json-schema.md |
Schema for session.json — per-session metadata written to every session folder |
references/delegation-templates.md |
Structured handoff templates for specialist delegation |
Auto-Detection
Analyze $ARGUMENTS keywords and context:
| Signal |
Dispatch |
Component name (Epost*, UI keyword), "component", "ui-lib", "design system", "token", "klara", "muji" |
--ui → references/ui-workflow.md via epost-muji |
| "a11y", "accessibility", "wcag", "voiceover", "talkback" |
--a11y → references/a11y-workflow.md |
| "close" + "ui" signals |
--close --ui → references/ui-close.md |
| "close", "resolve", "finding" |
--close → references/a11y-close.md |
| "code", "security", "performance", staged changes without component signal |
--code → code-review |
| Ambiguous |
Ask: UI component audit, a11y audit, or code audit? |
Platform Detection (--ui mode)
When delegating to epost-muji, detect target platforms:
- Explicit
--platform web|ios|android|all in args → pass through
.swift context → --platform ios
.kt/.kts context → --platform android
.tsx/.jsx/.ts context → --platform web
- No context →
--platform all
Variant Summary
| Flag |
Agent |
Reference |
Scope |
--ui |
epost-muji |
references/ui-workflow.md |
Design system components (web/iOS/Android) |
--a11y |
epost-a11y-specialist |
references/a11y-workflow.md |
WCAG 2.1 AA violations |
--close |
epost-a11y-specialist |
references/a11y-close.md |
Mark a11y finding as resolved |
--close --ui <id> |
epost-muji |
references/ui-close.md |
Mark UI finding resolved |
--code |
epost-code-reviewer |
code-review |
General code quality, security, performance |
Examples
/audit --ui EpostButton → muji audits EpostButton across all platforms
/audit --ui EpostCard --platform web → muji audits web-only
/audit --ui SmartLetterComposer --poc → organism audit with poc maturity tier, phased roadmap verdict
/audit --ui SmartLetterComposer --platform web --beta → organism audit with beta maturity tier
/audit --a11y → a11y specialist audits staged changes
/audit --code → reviewer audits staged code changes
/audit --close --ui 3 → mark UI finding ID 3 as resolved
/audit EpostInput → auto-detected as UI audit → delegates to muji
1---2name: audit-163description: (ePost) Use when user says "audit", "run an audit", "check quality", "review before merge", "a11y audit", or "code audit" — detects audit type (UI component, a11y, or code) and dispatches the right specialist4---5
6# Audit — Unified Audit Command
7
8Auto-detect and execute the appropriate audit workflow.
9
10## Methodology Tracking
11
12Every audit report MUST include a `methodology` field (JSON) or **Methodology** section (Markdown) documenting:
13- **Files Scanned** — every file actually read
14- **Knowledge Tiers** — which levels (L1–L4) were activated and whether each was available
15- **Standards Source** — the skill files, checklists, and external standards used as rule authority
16- **Coverage Gaps** — anything unavailable (RAG down, checklist not found, no platform rules loaded)
17
18Track these as you work. Never leave them empty or with placeholder values.
19
20## Knowledge Retrieval (Pre-Audit)
21
22Before executing any audit mode, activate `knowledge-retrieval` to load relevant context:
23- L1 `docs/` — existing conventions, past findings, ADRs for the files under review
24- L2 RAG — component implementations, token definitions, usage patterns
25- L4 Grep/Glob — fallback if RAG unavailable (search `packages/`, `src/` directly)
26- L5 Context7 — library API verification for external dependency usage
27
28**RAG unavailable?** Skip L2, go directly to L4 Grep/Glob. Never block the audit waiting for RAG.
29
30## Subagent Constraint
31
32**Subagents cannot spawn further subagents** — neither Agent tool nor Task tool is available in subagent context. Therefore, this skill runs **inline in the main conversation** (no `context: fork`). The main conversation is the orchestrator — it dispatches specialist agents and merges their results.
33
34## Step 0 — Flag Override + Mode Selection
35
36If `$ARGUMENTS` contains `--poc`, `--beta`, or `--stable`: extract the maturity tier and pass it through to `references/ui-workflow.md` workflow (Step 0.6). These flags combine with `--ui` — they are not standalone modes.
37
38If `$ARGUMENTS` starts with `--ui` and **no maturity tier flag** (`--poc`/`--beta`/`--stable`) is present:
39**Ask the developer to confirm maturity tier before dispatching**:
40> "What's the maturity stage of `{ComponentName}`?
41> - `--poc` — prototype / proof-of-concept (relaxed rules, phased roadmap)
42> - `--beta` — in active development (moderate strictness)
43> - `--stable` — production-ready (full strictness)
44>
45> Reply with the flag or just `poc` / `beta` / `stable`."
46Wait for reply, then set the maturity tier and proceed.
47
48If `$ARGUMENTS` starts with `--ui`: **dispatch epost-muji** via Agent tool. Pass component name + platform flags + maturity tier (if present) + `references/ui-workflow.md` workflow.
49If `$ARGUMENTS` starts with `--a11y`: **dispatch epost-a11y-specialist** via Agent tool. Pass `references/a11y-workflow.md` + platform hint.
50If `$ARGUMENTS` starts with `--close --ui`: load `references/ui-close.md` and execute inline.
51If `$ARGUMENTS` starts with `--close`: load `references/a11y-close.md` and execute inline.
52If `$ARGUMENTS` starts with `--code`: **dispatch epost-code-reviewer** via Agent tool.
53If auto-detected as **hybrid** (see Hybrid Detection below): run Hybrid Orchestration.
54Otherwise: continue to Auto-Detection.
55
56## Hybrid Detection
57
58Trigger hybrid mode when ALL conditions met:
59- Target contains klara-theme files (path contains `libs/klara-theme/` or `libs/common/`)
60- File count >= 20 OR multiple subdirectories in scope
61- No explicit `--ui` or `--code` flag (those force single-agent mode)
62
63## Hybrid Orchestration (main context)
64
65**This runs in the main conversation, NOT in a subagent.** The main context has Agent tool available.
66
67```
68session_folder = reports/{YYMMDD-HHMM}-{slug}-audit/
69```
70
711. **Create session folder**: `Bash("mkdir -p {session_folder}")`
722. **Dispatch epost-muji** via Agent tool with Template A+ from `references/delegation-templates.md`:
73 - Fill: Scope, Component(s), Mode: library, Platform, Output path: `{session_folder}/muji-ui-audit.md`
74 - WAIT for muji to complete
753. **Read muji report** at `{session_folder}/muji-ui-audit.md`. Extract:
76 - `finding_locations`: Set of file:line flagged by muji
77 - `verdict`: muji's overall verdict
78 - `a11y_findings`: contents of `## A11Y Findings` section (if present)
794. **If a11y findings exist AND maturity tier is NOT `poc`**: dispatch epost-a11y-specialist via Agent tool (Template B):
80 - Output path: `{session_folder}/a11y-audit.md`
81 - WAIT for completion
82 - **POC exception**: If `--poc`, skip a11y dispatch — A11Y findings are already advisory-only in muji's report (no dedicated a11y pass needed until beta)
835. **Dispatch epost-code-reviewer** via Agent tool:
84 - Pass: file list, `{session_folder}/muji-ui-audit.md` path (for dedup), SEC/PERF/TS/ARCH/STATE/LOGIC scope
85 - Output path: `{session_folder}/code-review-findings.md`
86 - WAIT for completion
876. **Merge reports** into `{session_folder}/report.md`:
88 - Executive Summary with overall verdict
89 - `## UI Audit` — muji verdict, finding count, link to `muji-ui-audit.md`
90 - `## A11Y Audit` (if ran) — link to `a11y-audit.md`
91 - `## Code Review` — code-reviewer findings inline
92 - Methodology section
936.5. **Run build verification**:
94 ```bash
95 node .claude/hooks/lib/build-gate.cjs
96 ```
97 Append `## Build Verification` section to `{session_folder}/report.md`:
98 - Exit 0: `Build verification: ✓ PASS ({platform}, {duration_ms}ms)`
99 - Exit 1: `Build verification: ✗ FAIL — {error excerpt}` (advisory — does not block report)
100 - Exit 0 (no command): `Build verification: skipped (no build command detected)`
1017. **Write session.json** per `references/session-json-schema.md`
1028. **Update reports/index.json** per `core/references/index-protocol.md`
103
104Verdict = `max(muji, a11y, code-reviewer)` where REDESIGN > FIX-AND-REAUDIT > APPROVE.
105
106## Single-Agent Delegation Protocol
107
108For non-hybrid dispatches (`--ui`, `--code`, `--a11y`):
109
1101. Create session folder per `references/output-contract.md`
1112. Select template from `references/delegation-templates.md`
1123. Fill all `{placeholders}` — include `Output path: {session_folder}/{filename}`
1134. Dispatch via **Agent tool** to the specialist agent
1145. **Wait** for specialist report
1156. Run build verification: `node .claude/hooks/lib/build-gate.cjs` — append `## Build Verification` to report (advisory)
1167. Write `session.json` and update `reports/index.json`
117
118**Output contract**: `references/output-contract.md` is the single source of truth for paths and responsibilities.
119
120| Template | Specialist | When |
121|----------|-----------|------|
122| A — UI Component Audit | epost-muji | `--ui` flag or UI component signals |
123| A+ — Feature Module UI Standards | epost-muji | Hybrid mode, multi-file library audit |
124| A++ — POC Organism Audit | epost-muji | `--ui` + organism classification + `--poc`/`--beta` |
125| B — A11y Audit | epost-a11y-specialist | `--a11y` flag or A11y findings from UI audit |
126| C — Code Escalation | epost-code-reviewer | Critical findings needing deeper pass |
127| D — Docs Gap Detection | epost-docs-manager | Post-audit, new feature, or refactor |
128| E — MCP/RAG Query | epost-mcp-manager | Component catalog lookup, pattern search |
129
130## Aspect Files
131
132| File | Purpose |
133|------|---------|
134| `references/output-contract.md` | **Single source of truth** — all output paths, session folders, file names, agent responsibilities |
135| `references/ui-workflow.md` | Audit UI component (Senior Muji Reviewer) |
136| `references/a11y-workflow.md` | Audit staged changes for WCAG 2.1 AA violations |
137| `references/a11y-close.md` | Mark an accessibility finding as resolved |
138| `references/ui-close.md` | Close/resolve a UI finding in known-findings DB |
139| `references/ui-findings-schema.md` | Schema for `reports/known-findings/ui-components.json` |
140| `references/session-json-schema.md` | Schema for `session.json` — per-session metadata written to every session folder |
141| `references/delegation-templates.md` | Structured handoff templates for specialist delegation |
142
143## Auto-Detection
144
145Analyze `$ARGUMENTS` keywords and context:
146
147| Signal | Dispatch |
148|--------|----------|
149| Component name (`Epost*`, UI keyword), "component", "ui-lib", "design system", "token", "klara", "muji" | `--ui` → `references/ui-workflow.md` via **epost-muji** |
150| "a11y", "accessibility", "wcag", "voiceover", "talkback" | `--a11y` → `references/a11y-workflow.md` |
151| "close" + "ui" signals | `--close --ui` → `references/ui-close.md` |
152| "close", "resolve", "finding" | `--close` → `references/a11y-close.md` |
153| "code", "security", "performance", staged changes without component signal | `--code` → `code-review` |
154| Ambiguous | Ask: UI component audit, a11y audit, or code audit? |
155
156## Platform Detection (--ui mode)
157
158When delegating to epost-muji, detect target platforms:
159- Explicit `--platform web|ios|android|all` in args → pass through
160- `.swift` context → `--platform ios`
161- `.kt`/`.kts` context → `--platform android`
162- `.tsx`/`.jsx`/`.ts` context → `--platform web`
163- No context → `--platform all`
164
165## Variant Summary
166
167| Flag | Agent | Reference | Scope |
168|------|-------|-----------|-------|
169| `--ui` | epost-muji | `references/ui-workflow.md` | Design system components (web/iOS/Android) |
170| `--a11y` | epost-a11y-specialist | `references/a11y-workflow.md` | WCAG 2.1 AA violations |
171| `--close` | epost-a11y-specialist | `references/a11y-close.md` | Mark a11y finding as resolved |
172| `--close --ui <id>` | epost-muji | `references/ui-close.md` | Mark UI finding resolved |
173| `--code` | epost-code-reviewer | `code-review` | General code quality, security, performance |
174
175## Examples
176
177- `/audit --ui EpostButton` → muji audits EpostButton across all platforms
178- `/audit --ui EpostCard --platform web` → muji audits web-only
179- `/audit --ui SmartLetterComposer --poc` → organism audit with poc maturity tier, phased roadmap verdict
180- `/audit --ui SmartLetterComposer --platform web --beta` → organism audit with beta maturity tier
181- `/audit --a11y` → a11y specialist audits staged changes
182- `/audit --code` → reviewer audits staged code changes
183- `/audit --close --ui 3` → mark UI finding ID 3 as resolved
184- `/audit EpostInput` → auto-detected as UI audit → delegates to muji