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
- 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 theagents/ directory with YAML frontmatter:
Frontmatter Format
agent-name.md
Frontmatter Fields
Agent name in kebab-case. Must be unique within the plugin.
Third-person description of the agent’s purpose and when to invoke it.Be specific about the agent’s specialized role.
Comma-separated list of allowed tools (no YAML array, just comma-separated string).Example:
Read, Grep, Glob, Bash, WriteAgent 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
function-analyzer (Read-Only Deep Analysis)
function-analyzer (Read-Only Deep Analysis)
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)
semgrep-scanner (Tool Integration)
semgrep-scanner (Tool Integration)
Runs Semgrep static analysis with appropriate rules for the target codebase.Workflow:
- Detect languages in the codebase
- Select appropriate Semgrep rules (p/security-audit, p/owasp-top-ten, etc.)
- Run Semgrep and capture results
- Process results - parse SARIF, group by severity, filter false positives
- Generate report with statistics and high-priority findings
spec-compliance-checker (Multi-Phase Workflow)
spec-compliance-checker (Multi-Phase Workflow)
Verifies code compliance against formal specifications through a 7-phase workflow.You verify that code implementation matches formal specifications.
Phase 1: Specification Analysis
- Read the formal specification document
- Extract requirements into structured format
- Identify testable assertions
- Categorize by priority (MUST, SHOULD, MAY)
Phase 2: Code Analysis
- Map specification requirements to code sections
- 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
differential-reviewer (Git Integration)
differential-reviewer (Git Integration)
Performs security-focused review of git diffs between branches.Workflow:
- Analyze the diff using git
- Categorize changes (authentication, crypto, input validation, network, data storage)
- For each security-relevant change: identify what changed, why it’s security-relevant, risks, and testing needs
- Generate prioritized review report
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:- Structured Markdown
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
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