Skip to content

agent-improver

Create and improve agents.

Triggers

  • "create an agent for X"
  • "build me an agent"
  • "I need an agent that does Y"
  • "make a code review agent"
  • "create a testing agent"
  • "improve my agent"
  • "list agents"
  • "what agents do I have"

Create Agent

Write directly to .claude/agents/{name}.md:

markdown
---
name: agent-name
description: >-
  What this agent does and when Claude should delegate to it.
  Be specific. Include "Use proactively" if it should auto-trigger.
tools: Read, Grep, Glob, Bash
---

You are [role description]. [System prompt for the agent.]

When invoked:
1. First step
2. Second step
3. Third step

## Output Format

[Expected output structure]

Frontmatter Reference

FieldRequiredPurpose
nameYesUnique ID, lowercase + hyphens
descriptionYesWhen Claude should delegate. Include "Use proactively" for auto-trigger
toolsNoAllowlist of tools. Inherits all if omitted
disallowedToolsNoDenylist (removed from inherited/specified set)
modelNosonnet, opus, haiku, inherit, or full model ID
permissionModeNodefault, acceptEdits, dontAsk, bypassPermissions, plan
maxTurnsNoMax agentic turns before auto-stop
skillsNoSkills preloaded into agent context (full content injected)
mcpServersNoMCP servers: string reference or inline definition
hooksNoPreToolUse/PostToolUse/Stop hooks scoped to this agent
memoryNouser, project, or local
backgroundNotrue = always run as background task
effortNolow, medium, high, max
isolationNoworktree = isolated git worktree copy

Agent Scope

LocationScopePriority
--agents CLI flagCurrent session only1 (highest)
.claude/agents/Current project2
~/.claude/agents/All your projects3
Plugin agents/ dirWhere plugin enabled4 (lowest)

Higher priority wins when names collide.

Model Selection Guide

ModelBest for
haikuFast, cheap: exploration, search, simple tasks
sonnetBalanced: code review, analysis, moderate complexity
opusMost capable: complex reasoning, architecture, planning
inheritSame as main conversation (default)

Memory Scopes

ScopeLocationUse when
user~/.claude/agent-memory/{name}/Knowledge applies across all projects
project.claude/agent-memory/{name}/Project-specific, shareable via VCS
local.claude/agent-memory-local/{name}/Project-specific, NOT in VCS

Key Principles

  1. Focused responsibility — Each agent excels at one specific task
  2. Detailed description — Claude uses this to decide when to delegate
  3. Minimal tool access — Grant only necessary permissions
  4. Imperative system prompt — Clear instructions, not persona descriptions
  5. Specify model — Use haiku for fast/cheap, sonnet for balanced, opus for complex

List Agents

bash
ls .claude/agents/*.md

Add Agent to Chain

Edit the active chain file in .claude/chains/, add to flow: section:

yaml
flow:
  new-agent:
    routes:
      next-agent: "Description of when to go here"
      fallback-agent: "Description of fallback"
    decide: |
      If SUCCESS → "next-agent"
      If FAILED → "fallback-agent"

Improve Existing Agent

  1. Read the agent file: .claude/agents/{name}.md
  2. Check against frontmatter reference — are fields correct?
  3. Verify description is specific with trigger phrases
  4. Verify tools are scoped to minimum needed
  5. Verify system prompt uses imperative voice
  6. Check if skills field should preload companion skills
  7. Check if memory would benefit this agent

Released under the MIT License.