Skip to main content

What are Agents?

Agents are autonomous sub-agents that handle complex, multi-step tasks with specialized instructions. Unlike skills (which provide guidance), agents take full control and execute workflows independently.
Agents are Claude instances with constrained instructions and tool access. They operate independently within their defined scope and return results to the main conversation.

When to Use Agents

Use agents for:
  • Complex multi-step workflows - Tasks requiring 10+ coordinated steps
  • Specialized analysis - Deep dives requiring domain expertise (security audits, compliance checks)
  • Isolated context - Tasks that need clean context without main conversation history
  • Quality gates - Workflows requiring validation and verification loops
  • Parallel work - Multiple independent analyses that can run simultaneously
Don’t use agents for:
  • Simple single-step tasks (use skills instead)
  • Tasks requiring user interaction (agents run autonomously)
  • Quick lookups or searches (use tools directly)

Agent Structure

Agents are markdown files in the agents/ directory with YAML frontmatter:

Frontmatter Format

agent-name.md

Frontmatter Fields

string
required
Agent name in kebab-case. Must be unique within the plugin.
string
required
Third-person description of the agent’s purpose and when to invoke it.Be specific about the agent’s specialized role.
string
required
Comma-separated list of allowed tools (no YAML array, just comma-separated string).Example: Read, Grep, Glob, Bash, Write

Agent Body Structure

The markdown body contains the agent’s complete instructions:
agent-name.md

Agent Design Patterns

Read-Only Analysis Agent

For agents that only read and analyze code:

Builder Agent

For agents that create or modify artifacts:

Validator Agent

For agents that verify work from other agents:

Real Examples

Performs ultra-granular per-function analysis for security audit context. Produces understanding, not conclusions.Per-Function Checklist:
  • Purpose and role
  • Inputs and assumptions (minimum 5)
  • Outputs and effects (minimum 3)
  • Block-by-block analysis
  • Cross-function dependencies (minimum 3 relationships)
Quality Thresholds: Minimum 3 invariants and 5 assumptions per function, all claims cite line numbers.
Runs Semgrep static analysis with appropriate rules for the target codebase.Workflow:
  1. Detect languages in the codebase
  2. Select appropriate Semgrep rules (p/security-audit, p/owasp-top-ten, etc.)
  3. Run Semgrep and capture results
  4. Process results - parse SARIF, group by severity, filter false positives
  5. Generate report with statistics and high-priority findings
Verifies code compliance against formal specifications through a 7-phase workflow.You verify that code implementation matches formal specifications.

Phase 1: Specification Analysis

  1. Read the formal specification document
  2. Extract requirements into structured format
  3. Identify testable assertions
  4. Categorize by priority (MUST, SHOULD, MAY)

Phase 2: Code Analysis

  1. Map specification requirements to code sections
  2. For each requirement:
    • Find implementing code
    • Verify correctness
    • Check edge cases
    • Document gaps

Phase 3: Compliance Report

Generate report with:
  • Compliance matrix (requirement → implementation → status)
  • Non-compliant items with severity
  • Missing implementations
  • Partial implementations needing review
  • Recommendations
Output: Compliance matrix showing requirement status, non-compliant items with severity, and recommendations.
Performs security-focused review of git diffs between branches.Workflow:
  1. Analyze the diff using git
  2. Categorize changes (authentication, crypto, input validation, network, data storage)
  3. For each security-relevant change: identify what changed, why it’s security-relevant, risks, and testing needs
  4. Generate prioritized review report
Focus: New attack surface, removed security checks, authentication changes, crypto modifications, database query changes.

Agent Constraints

Define clear boundaries for what the agent can and cannot do:

What Agents Should Do

What Agents Should NOT Do

Quality Gates

Build verification into agent workflows:

Output Formats

Specify exact output structure:

Anti-Hallucination Techniques

Prevent agents from making unsupported claims:

Invoking Agents

From Commands

Commands launch agents with parsed arguments:

From Skills

Skills can delegate to agents for complex sub-tasks:

From Other Agents

Agents can launch sub-agents for specialized work:

Testing Agents

1

Test with minimal input

Verify the agent handles simple cases correctly.
2

Test with complex input

Verify the agent handles edge cases and complex scenarios.
3

Test error handling

Verify the agent gracefully handles invalid input and errors.
4

Verify quality gates

Confirm the agent meets its own quality thresholds.
5

Check output format

Ensure output matches the specified format exactly.

Best Practices

Single Responsibility

Each agent should do one thing well. Split complex workflows across multiple agents.

Clear Constraints

Define exactly what the agent can and cannot do. Prevent scope creep.

Quality Gates

Build verification into the workflow. Don’t return until quality thresholds are met.

Structured Output

Specify exact output format. Make it easy to parse and process results.

Tool Restrictions

Only grant tools the agent actually needs. Fewer tools = more focused behavior.

Anti-Hallucination

Require evidence for all claims. Cite line numbers. Mark unknowns explicitly.

Common Patterns

Sequential Pipeline

Agents that run in sequence, each building on previous results:

Parallel Workers

Multiple agents running simultaneously on different parts:

Validator Pattern

Agent produces output, validator verifies correctness:

Next Steps

Skills

Learn how skills provide guidance agents can use

Commands

Create commands that launch agents

Create an Agent

Learn how to author your own agents

Agent Examples

Browse real agent implementations