plugins/claude-skills/skills/repair-agent/SKILL.md
This skill should be used when the user asks to "repair an agent", "audit an agent", "fix my agent", "review agent quality", "check if my agent is well-written", "diagnose agent problems", "what's wrong with this agent", "improve this agent", or "what's wrong with this agent file". Not for skills — use repair-skill.
npx skillsauth add gupsammy/claudest repair-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit and improve an existing Claude Code agent against a gold standard. Unlike create-agent (which generates from scratch), this skill diagnoses violations and identifies gaps — what is broken, what is missing, and what would raise quality. The output is a structured improvement plan covering all dimensions of agent design.
The agent file at $ARGUMENTS is loaded inline:
@$ARGUMENTS
Note the directory from $ARGUMENTS to verify it lives in agents/ (not skills/).
Identify any skills: preloads listed in the frontmatter above.
If the file is a SKILL.md or lives in a skills/ directory, decline and tell the user
to use repair-skill instead. If the path is missing or ambiguous, use AskUserQuestion
to resolve before proceeding.
Load the following reference files before Phase 2:
${CLAUDE_PLUGIN_ROOT}/skills/repair-agent/references/agent-anatomy.md — gold standard
for system prompt structure, voice conventions, size invariants, naming, skills: preload
pattern, and the gap analysis checklist. Required for Dimensions 3, 5, 6, and 7.${CLAUDE_PLUGIN_ROOT}/skills/create-agent/references/agent-frontmatter.md — complete
frontmatter field catalog, valid values, tool selection framework, color semantics, and
execution modifiers. Required for Dimensions 1 and 2.Proceed to Phase 2 when: agent file is confirmed in scope and reference files are loaded.
Run each dimension independently. For each finding record: the dimension code, what is wrong or missing, which principle it violates or which gold standard it falls short of, and the specific change required. Proceed to Phase 3 when all 7 dimensions are evaluated.
Finding types:
Severity:
The description is read by the routing model to decide when to spawn this agent. It is the primary trigger mechanism and is always in context. Audit for violations and gaps.
Violations:
> folded scalar, 50-70 tokens.
No <example> blocks — they waste context without improving routing. Major if examples
present or description exceeds ~80 tokens.> (folded). Minor if using | without XML blocks.Gaps:
Refer to agent-frontmatter.md for the complete field catalog, tool selection framework,
and color semantics. Omitting a field is not an error when the default applies — audit for
mismatches (violations) and missing configuration that would improve the agent (gaps).
Violations:
tools include unscoped Bash for an agent that doesn't need full shell access?
Agents run autonomously with no human in the loop — unrestricted Bash is the highest
blast-radius grant. Major.model: opus set for a task sonnet handles? Cost scales directly per spawn. Major.isolation: worktree set without the agent performing git-state modifications?
Unnecessary isolation adds overhead. Minor.disallowedTools block a tool the system prompt requires? Critical.Gaps:
color absent? Visual identity in the UI helps users track which agent is active
in multi-agent workflows. Minor.tools absent for a read-only analysis agent? Least-privilege requires an explicit
allowlist for autonomous agents — omitting it grants full access when restricted access
would suffice. Major for analysis-only agents.maxTurns absent for a task with a predictable completion horizon? Unbounded agents
can loop on ambiguous input. Minor for bounded tasks.skills absent for an agent with domain-specific knowledge needs? Embedding domain
reference directly in the system prompt inflates every spawn; skills: defers it.
Major if system prompt exceeds 300 lines of embedded reference data.isolation: worktree absent for an agent that modifies files in the working tree?
Without isolation, modifications are immediate and irreversible during the run. Major.memory absent for an agent that would benefit from cross-session learning? Agents
that review code, audit patterns, or accumulate project knowledge should use persistent
memory (project recommended default). If memory is set, does the system prompt include
memory maintenance instructions? Without them, the agent won't proactively update its
knowledge base. Major if the agent's domain involves pattern accumulation.effort absent for a cost-sensitive or complexity-varying agent? Fast classification
tasks benefit from effort: low; deep reasoning tasks from effort: high. Minor.initialPrompt absent for a session-mode agent designed for --agent use? Without
it, the agent waits for user input instead of self-starting. Minor if applicable.The markdown body of an agent file is its system prompt. Voice, persona, and structural
conventions determine whether the agent behaves as a specialist or a generic assistant.
Refer to agent-anatomy.md for voice conventions and the gold standard structure.
Violations:
Gaps:
Load ${CLAUDE_PLUGIN_ROOT}/skills/create-skill/references/script-patterns.md before
auditing this dimension. The same five signal patterns apply to agents as to skills.
Agents mix LLM-guided reasoning (agentic) and deterministic operations. The split should
be deliberate — see the Degrees of Freedom table in agent-anatomy.md.
Violations:
scripts/, not in the system prompt. Major.Gaps — apply the five signal patterns to each process step:
--help for this step → CLI candidate. Minor.Every line in the agent body is loaded into context every time the agent is spawned. Domain
reference data and lookup tables belong in skills: preloads, not embedded inline. Refer
to size invariants in agent-anatomy.md to calibrate severity.
Violations:
description field. The body loads only after triggering — routing guidance there
never informs the triggering decision and burns context on every spawn. Major.skills: preload
instead. Major.skills:
preloads. Major.Gaps:
skills: reduce system prompt size? Identify sections only needed for specific
sub-tasks. Major if system prompt > 300 lines with extractable content.A complete agent process is sequential, has explicit steps, and defines what "done" looks like at each step. Audit for broken workflow and for missing structure that would help.
Violations:
Gaps:
Agents are typically single files, but their ecosystem includes skills: preloads and
optional companion scripts. This dimension asks whether declared structure matches needs.
Refer to the Gap Analysis Checklist in agent-anatomy.md for each absent element.
Violations:
skills: listed in frontmatter but not referenced in process: Dead preloads inflate
context on every spawn without being used. Minor.Gaps:
skills: preload for domain-heavy agents: System prompt embeds a large reference
catalog that could be externalized. Major if body > 300 lines.color absent: No visual identity in multi-agent UI contexts. Minor.memory for pattern-accumulating agents: Agent reviews code, audits quality, or
accumulates project knowledge but has no persistent memory configured. Major if the
agent's value increases with accumulated context.Present findings as a structured report. Split violations from gaps. See
${CLAUDE_PLUGIN_ROOT}/skills/repair-agent/examples/sample-repair.md for a complete
example of the report format and a before/after repair session.
AGENT IMPROVEMENT REPORT: <agent-name>
System prompt: [N] lines | Description: [N] tokens | Tools: [listed / unrestricted]
VIOLATIONS
──────────
CRITICAL
[D1] Description does not start with "Use this agent when..." — routing model cannot
match. Fix: rewrite opening as "Use this agent when [trigger conditions]."
MAJOR
[D3] Body uses first-person throughout ("I will analyze...") — system prompt must be
second-person because it is an address to the agent, not a narration of intent.
Fix: rewrite as "Analyze the input and identify..." throughout.
[D2] `tools` omitted for a read-only analysis agent — omission grants full tool access;
least-privilege for autonomous agents requires an explicit allowlist.
Fix: add tools block sequence (Read, Grep, Glob)
MINOR
[D2] `color` not set — no visual identity in multi-agent UI.
Fix: add color: blue (analysis/review semantic).
GAPS (what would improve this agent)
─────────────────────────────────────
MAJOR
[D7] System prompt is 380 lines of embedded domain reference. Extract to a skill file
and preload via `skills:` frontmatter to reduce per-spawn context cost.
MINOR
[D6] No edge cases section — what happens when the agent receives no input?
Improvement: add "Edge Cases: No input provided — ask the user to share the target."
Group violations by severity, then gaps by severity. For each: dimension code, what is wrong or missing, the principle it falls short of, the exact fix.
Ask: "Apply all critical and major items? Or select specific ones?"
Proceed to Phase 4 when the user has indicated which items to apply.
Apply confirmed items in order: critical violations → major violations → major gaps → minor violations → minor gaps.
For each item:
After applying:
tools block sequence (Read, Grep, Glob) because this
is a read-only agent and least-privilege for autonomous execution requires an explicit allowlist"maxTurns unset — task horizon is open-ended"Phase 4 is complete when all confirmed items are applied, explanation delivered, and the validation checklist passes.
After applying all improvements:
Run the structural validator:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/create-agent/scripts/validate_agent.py \
<agent-file> --output json
Exit 0 = structure clean. Exit 1 = parse the errors array; report each entry's
field, message, and severity before delivering final results.
Load ${CLAUDE_PLUGIN_ROOT}/skills/repair-agent/references/quality-checklist.md
and run the quality standards check followed by the item-by-item checklist. Report
any failing items before delivering final results.
testing
Recall, search, continue, or analyze past conversations. Triggers on recall phrases ("what did we discuss", "continue where we left off", "we decided"), retrospective phrases ("do a retro", "post-mortem", "what went well", "lessons learned", "find antipatterns"), and implicit signals (past-tense references, possessives without context, assumptive questions like "do you remember").
data-ai
Persist learnings to memory or maintain existing memories. Triggers on "extract learnings", "save this for next time", "remember this pattern", "consolidate memories", "dream", "clean up memories".
development
Use for any image creation or editing request — logo, sticker, product mockup, nano banana, t2i, i2i, multi-reference compositing via generate.py. Not for HTML/CSS mockups, diagrams, or coded UI.
development
This skill should be used when the user says "update CLAUDE.md", "refresh CLAUDE.md", "sync CLAUDE.md with the codebase", "reorganize CLAUDE.md", "optimize project instructions", or when CLAUDE.md is stale, verbose, or out of sync.