Wiring audit

From NickCrew/Claude-Cortex · View interactive version

Wiring audit is an AI agent skill from the GitHub repository NickCrew/Claude-Cortex. User-triggered audit that finds wiring drift between a project's UI surfaces and backend capabilities — orphan surfaces (UI calls endpoints/hooks/procedures that no longer exist), unwired capabilities (backend routes/exports that nothing surfaces), shape drift (both exist but contracts mismatch), me

How to use this skill

Skill file

Wiring Audit

Overview

Diff a project's consumed surface (UI buttons, components, hooks, fetch calls, tRPC client invocations, GraphQL queries, server actions) against its produced capability (route handlers, hook exports, tRPC routers, GraphQL resolvers, exported async functions) and report every mismatch as a prioritized finding with citations on both sides.

The audit's load-bearing claim: every UI consumption should match exactly one backend production, and every production should be consumed somewhere. Orphans, drift, and gaps are the failure modes. The report is the punch list.

When to use

Trigger this skill when the user asks for:

Do not trigger for:

Workflow

Six phases. The diff (phase 3) is the load-bearing one — the rest are supporting work to feed it accurate inputs.

1. Scope

Establish:

2. Dispatch enumerators (parallel)

Two sub-agents, dispatched in a single message with two Agent tool calls (parallel, one-shot, no team_name):

Both return YAML registries (see references/audit-protocol.md for the contract). Both need sonnet because correlation reasoning across full files matters here — Explore excerpt reads aren't sufficient.

3. Drift detection (orchestrator)

Read references/drift-detection.md. The orchestrator:

  1. Builds consumption and production maps keyed by (kind, identifier).
  2. Computes set differences (orphans on each side).
  3. For matched pairs, runs shape/method/auth/validation comparison.
  4. Each mismatch becomes a candidate finding tagged with one of the 8 categories from references/finding-categories.md.

4. Severity assignment

Apply the rubric in references/finding-categories.md:

| Severity | Default applies to | Override when |

|---|---|---|

| broken | orphan-surface, method-drift | Surface is dead code (no callers itself) — downgrade to stale |

| drifted | shape-drift, validation-drift, permission-drift | Auth-bypass flavor → upgrade to broken |

| stale | stale-label | Public-facing user surface → upgrade to drifted |

| gap | unwired-capability, unsurfaced-config | Capability is brand-new (recent commit) → annotate "expected, planned" |

5. Verify

Every finding's citation must resolve. Use codanna (when .codanna/ exists) or grep + Read to confirm:

Discard findings whose citations fail to resolve. Maintain a discard log for the report's verification section.

6. Render report (and optional wiring graph)

Output layout

docs/audits/2026-05-10/
├── report.md                          ranked findings, severity-grouped
├── wiring.mmd                         optional supplemental graph
├── wiring.svg                         optional, run scripts/render.sh
└── registries/
    ├── surfaces.yaml                  raw consumed-set
    └── capabilities.yaml              raw produced-set

Strict citation policy

Every finding must carry path:line citations on both sides where applicable:

Fabricated "missing X" claims are the dominant failure mode for audits — sub-agents over-fire on absence. The verification protocol grep-checks every absence claim before the finding is recorded.

React focus

Generic by design but optimized for React. The signal catalog in references/react-patterns.md covers:

For non-React targets, the same workflow applies but the FE-side signal catalog is sparser. Tell the user up front if the UI-side detection will be limited.

Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.