Agent Audit
Role: orchestrator. This skill performs mechanical compliance
checks — pattern matching against known-good structure.
You have been invoked with the /agent-audit skill. Audit agents and
skills for compliance with the eval system patterns documented in
.claude/docs/eval-system.md.
Monorepo-relative by design (#1637). Steps 8 and 2e's scripts/validate_agent_contract.py and scripts/check_registry_sync.py calls are intentionally bare, not a dangling-path defect. check_registry_sync.py hardcodes plugins/dev-team and checks this marketplace repo's own registry — it exists only at this repo's root, so no ${CLAUDE_PLUGIN_ROOT} path could ever resolve it. validate_agent_contract.py's repo-root copy is a thin wrapper delegating to plugins/marketplace-dev/scripts/validate_agent_contract.py (which does ship and is portable) — but there is no single variable spanning two independently-installed plugins, so the wrapper is reachable only from this monorepo checkout, where both plugin directories are siblings on disk. Both calls only make sense run from a dev-team-monorepo-shaped checkout (this repo, or a structural fork), never an installed plugin cache. See tests/repo/test_agent_implemented_by_resolves.py's INTENTIONAL_BARE_INVOCATION set, which checks the "does not ship" premise mechanically. (#1652 landed a Bash(...) grant in this skill's allowed-tools frontmatter covering all three of these script steps — including verify_tier.py below — by their exact bare/repo-relative invocation form, so they execute today; see the allowed-tools block above.)
Orchestrator constraints
- Check structure, not semantics. Verify required sections,
fields, and patterns exist. Do not evaluate whether detection
rules are good — that's agent-eval's job.
- Deterministic checks only. Every check should be reproducible:
does the field exist? Is the format correct? Does the section
match the expected pattern?
- When
--fixis used, apply minimal structural fixes. Insert
missing sections/fields using templates. Do not rewrite existing
content.
- Be concise. Output the report table and action items. No
preambles, no per-file narration, no restating what was checked.
Steps
1. Parse arguments
Arguments: $ARGUMENTS
- No argument or
--all: audit everything - A specific file path (e.g.,
.claude/agents/js-fp-review.md): audit that
file only
--fix: after generating the report, automatically apply fixes
for FAIL/WARN items
2. Audit agents
Scope: this audit covers agents from all plugins in the repository, not just
plugins/dev-team/agents/. Currently audited directories:
plugins/dev-team/agents/— the primary dev-team plugin agentsplugins/security-assessment/agents/— the security-assessment plugin agents
The automated effort-band gate (tests/agents/test_agent_effort_frontmatter.py)
discovers and checks agents from both directories; add new plugin agent directories
to AGENTS_DIRS in that test file when a new plugin is introduced.
Read each file in .claude/agents/*.md whose body contains a structured JSON
output schema — either inline (a line with "status": "pass|warn|fail|skip")
or a citation of knowledge/review-agent-output-contract.md — these are
review agents. Check:
- Structured output format: Does the agent specify a JSON output
schema, inline or by citing the shared contract?
- Review agents MUST include
status,issues, andsummary
fields (inline or via the cited contract)
- FAIL if a review agent has no output format and no contract citation
- Severity definitions: Does the agent define severity levels?
- MUST define
error,warning, andsuggestionwith clear
criteria
- FAIL if severity levels are missing
- Detection rules: Does the agent list what it detects?
- MUST have a section listing specific patterns/issues to flag
- WARN if detection rules are vague or missing
- For
esm-enforcer,js-fp-review,naming-review, and
structure-review: run
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/check_detect_tags.py. Each
## Detect bullet MUST carry exactly one [MECHANICAL] or [JUDGMENT]
tag, and each [MECHANICAL] bullet MUST name a lint rule
(rule: <id>) or give a reason (no rule: <reason>). The id MUST be in
templates/eslint/rule-ids.json (enabled or planned). A bullet
converted to a lint pointer MUST say "otherwise judge fully" and name a
rule listed as convertible there. FAIL on any offender. The same check runs as detect-bullets-tagged in
repo_invariants.py.
- Scope boundaries: Does the agent declare what it ignores?
- Review agents SHOULD state what other agents handle
- WARN if missing (helps avoid duplicate findings)
- Self-describing: Does the agent depend on external config?
- Agents MUST NOT reference
config/,review-config.json, or
external config files
- Thresholds, file scope, and defaults MUST be declared inline
in the agent definition
- FAIL if an agent references external config
- File scope: Does the agent declare which file types it
applies to?
- Language-specific agents (e.g., js-fp-review) MUST declare
their file scope
- Language-agnostic agents (e.g., structure-review) may omit this
- WARN if a language-specific agent has no file scope declaration
- Skip support: Does the agent define when to return
status: "skip"?
- All review agents MUST have a
## Skipsection - MUST describe conditions when the agent is inapplicable
- MUST show the skip JSON response format
- WARN if skip section is missing
- Model/effort contract: Does the agent's frontmatter conform to the
native Claude Code sub-agent contract (ADR 0026)?
- Run
python3 scripts/validate_agent_contract.py <file>and fold every
error into FAIL and every warning into WARN in the report. This is
the sole frontmatter-contract check — required-field presence (name,
description), name pattern, enum membership on any field present
(model, effort, permissionMode, memory, isolation, color,
background, maxTurns), unknown/misspelled-key warnings, and the
plugin-ignored-field warning for hooks/mcpServers/permissionMode.
- This repo's own convention: every
plugins/dev-team/and
plugins/security-assessment/ agent declares model: (an alias, full
model ID, or inherit) and effort: high — WARN if either is missing,
since that is this repo's local practice, not a contract requirement.
- Single source:
model:/effort:MUST be declared only in
frontmatter. WARN if a body line restates either as prose (e.g. an
Effort: line, or a body-level model-tier label) — that duplicate is a
drift source and must be removed.
- Carve-out —
Verify-model:/Verify-effort:(#1628): these two
body declarations are NOT a restatement of model:/effort: and must
never be flagged by the single-source rule above. They name a different
tier — the one used for fix-verification re-dispatches only — and they
live in the body for the same reason Scope: and Cites: do (#1333:
frontmatter is reserved for the official contract; these are not part
of it). Validate them with:
```bash
python3 plugins/dev-team/scripts/verify_tier.py --all
```
This one is repo-relative, not ${CLAUDE_PLUGIN_ROOT}-qualified, even
though the script ships: /agent-audit's whole job is auditing the
agents in the current working tree the operator just edited.
${CLAUDE_PLUGIN_ROOT} would resolve to the installed plugin cache
instead — silently auditing a stale, already-released copy rather than
the edit under review.
Fold a non-empty errors array into WARN, naming the agent and the
invalid value. An agent with no declaration is correct, not incomplete —
the default is deliberately "same tier as discovery". Contract:
knowledge/verification-mode.md.
- Context needs: Does the agent declare a
Context needs:field?
- All agents MUST declare what input context they need
- Valid standalone values:
diff-only— agent reads only the unified difffull-file— agent needs the complete file contentproject-structure— agent needs directory/project layoutartifact-stream— agent consumes upstream JSON artifact streams
(prior-phase findings, RECON output) and does not read source
files directly; qualifies when the agent's only input is an artifact
produced by an earlier pipeline phase
- Combinability: a comma-separated list of two or more values is
valid when every token is one of the four values above (e.g.
artifact-stream, full-file is valid for an agent that reads both
upstream artifacts and full source files). An unknown token in a
combined declaration still WARNs on that token specifically.
- WARN if the field is missing entirely
- WARN if the declaration contains an unrecognised token
- No colons in description: Does the
description:frontmatter field contain a colon?
- The
descriptionfield MUST NOT contain colons — they break argument-hints and other tooling - FAIL if the description value contains a colon character (
:)
2b. Audit agent tool declarations (all agents)
Read every file in .claude/agents/*.md (team agents and review agents). Check:
- Skills-Skill invariant: If the agent body contains a
## Skillsheading, thetools:frontmatter MUST includeSkill.
- The
## Skillssection documents which skills an agent invokes. WithoutSkillintools:, the agent cannot load skill content at runtime (whentools:is specified as an allowlist, only listed tools are available). - FAIL if a
## Skillssection is present butSkillis absent fromtools:. - PASS if no
## Skillssection is present (the invariant does not apply). - PASS if
## Skillsis present andSkillis intools:.
Include the result in the agent report table under a Skills-Tool column.
Fix (when --fix is passed): Append , Skill to the tools: frontmatter line. Report FIXED: <agent> — Added Skill to tools:.
- Code-intelligence MCP invariant (review agents): Every read-only
*-reviewagent MUST grant the five code-intelligence MCP tools intools:—mcp__codegraph__codegraph_exploreandmcp__plugin_repowise_repowise__{get_context,get_symbol,search_codebase,get_risk}— so a review on a repo with a CodeGraph/Repowise index uses verified skeletons and resolved call graphs instead of raw whole-file reads (the grant is inert when the server is absent; agents fall back to Read/Grep/Glob). This mirrors the Skills-Skill invariant: it self-extends to future*-reviewagents.