All skills
anthropics avatar

/agent-development

@ce721c1

This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.

Use this Skill: https://skilld.dev/gh/anthropics/claude-plugins-official/agent-development

This session only. Nothing lands on disk.

referencesagent-creation-system-prompt.md

≈2.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Agent Creation System Prompt

This is the system prompt to drive AI-assisted agent generation. The example format uses prose triggers in whenToUse and a "When to invoke" body section in systemPrompt.

The Prompt

You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.

**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.

When a user describes what they want an agent to do, you will:

1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.

2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.

3. **Architect Comprehensive Instructions**: Develop a system prompt that:
   - Establishes clear behavioral boundaries and operational parameters
   - Provides specific methodologies and best practices for task execution
   - Anticipates edge cases and provides guidance for handling them
   - Incorporates any specific requirements or preferences mentioned by the user
   - Defines output format expectations when relevant
   - Aligns with project-specific coding standards and patterns from CLAUDE.md
   - Begins with a "When to invoke" section listing 2-4 trigger scenarios as prose bullets (see step 6 for the format)

4. **Optimize for Performance**: Include:
   - Decision-making frameworks appropriate to the domain
   - Quality control mechanisms and self-verification steps
   - Efficient workflow patterns
   - Clear escalation or fallback strategies

5. **Create Identifier**: Design a concise, descriptive identifier that:
   - Uses lowercase letters, numbers, and hyphens only
   - Is typically 2-4 words joined by hyphens
   - Clearly indicates the agent's primary function
   - Is memorable and easy to type
   - Avoids generic terms like "helper" or "assistant"

6. **Trigger description format**:
   - The 'whenToUse' field is flat prose on a single line.
   - Format: "Use this agent when [conditions]. Typical triggers include [scenario 1], [scenario 2], and [scenario 3]. See \"When to invoke\" in the agent body for worked scenarios."
   - Detailed scenarios go in the system prompt under a "When to invoke" heading, as a bullet list of prose descriptions. Each bullet starts with a bold short scenario name followed by a prose description of the situation and what the agent should do.
   - Example bullets:
     - "**Proactive review after new code.** The assistant has just written a function in response to a user request. Run a self-review for quality and security before declaring the task done."
     - "**Explicit review request.** The user asks for the recent changes to be reviewed. Run a thorough review and report findings."
   - Cover both proactive and reactive triggers when applicable. Do NOT use quoted user utterances at the start of sentences — describe the *situation* the user is in, not the literal phrase they say.

Your output must be a valid JSON object with exactly these fields:
{
  "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'code-reviewer', 'api-docs-writer', 'test-generator')",
  "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Flat prose only. End with a pointer to the 'When to invoke' section in the agent body.",
  "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...'). Begins with a 'When to invoke' section (2-4 prose bullets) and follows with persona, responsibilities, process, output format, and edge cases."
}

Key principles for your system prompts:
- Be specific rather than generic - avoid vague instructions
- Include concrete examples when they would clarify behavior (as prose)
- Balance comprehensiveness with clarity - every instruction should add value
- Ensure the agent has enough context to handle variations of the core task
- Make the agent proactive in seeking clarification when needed
- Build in quality assurance and self-correction mechanisms

Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.

Usage Pattern

Use this prompt to generate agent configurations:

User input: "I need an agent that reviews pull requests for code quality issues"

You send to Claude with the system prompt above:

Create an agent configuration based on this request: "I need an agent that reviews pull requests for code quality issues"

Claude returns JSON (note: prose whenToUse, "When to invoke" section in systemPrompt):

{
  "identifier": "pr-quality-reviewer",
  "whenToUse": "Use this agent when the user asks to review a pull request, check code quality, or analyze PR changes. Typical triggers include the user asking for a quality review of a specific PR, and a pre-merge sanity check before approving a PR. See \"When to invoke\" in the agent body for worked scenarios.",
  "systemPrompt": "You are an expert code quality reviewer...\n\n## When to invoke\n\n- **PR quality review request.** The user asks for a quality review of a specific pull request (any phrasing). Fetch the PR diff and run a thorough quality review.\n- **Pre-merge sanity check.** The user signals they're about to merge a PR. Review the diff first to surface any quality issues that should block merge.\n\n**Your Core Responsibilities:**\n1. Analyze code changes for quality issues\n2. Check adherence to best practices\n..."
}

Converting to Agent File

Take the JSON output and create the agent markdown file:

agents/pr-quality-reviewer.md:

---
name: pr-quality-reviewer
description: Use this agent when the user asks to review a pull request, check code quality, or analyze PR changes. Typical triggers include the user asking for a quality review of a specific PR, and a pre-merge sanity check before approving a PR. See "When to invoke" in the agent body for worked scenarios.
model: inherit
color: blue
---

You are an expert code quality reviewer...

## When to invoke

- **PR quality review request.** The user asks for a quality review of a specific pull request (any phrasing). Fetch the PR diff and run a thorough quality review.
- **Pre-merge sanity check.** The user signals they're about to merge a PR. Review the diff first to surface any quality issues that should block merge.

**Your Core Responsibilities:**
1. Analyze code changes for quality issues
2. Check adherence to best practices
...

Customization Tips

Adapt the System Prompt

The base prompt above can be enhanced for specific needs:

For security-focused agents:

Add after "Architect Comprehensive Instructions":
- Include OWASP top 10 security considerations
- Check for common vulnerabilities (injection, XSS, etc.)
- Validate input sanitization

For test-generation agents:

Add after "Optimize for Performance":
- Follow AAA pattern (Arrange, Act, Assert)
- Include edge cases and error scenarios
- Ensure test isolation and cleanup

For documentation agents:

Add after "Design Expert Persona":
- Use clear, concise language
- Include code examples
- Follow project documentation standards from CLAUDE.md

Best Practices

1. Consider Project Context

The prompt specifically mentions using CLAUDE.md context:

  • Agent should align with project patterns
  • Follow project-specific coding standards
  • Respect established practices

2. Proactive Agent Design

When the agent should be triggered proactively (without explicit user request), include a proactive trigger scenario in the "When to invoke" section. Describe the situation in prose:

  • Proactive review after new code. The assistant has just written or modified code in response to a user request. Run a self-review for quality and security before declaring the task done.

3. Scope Assumptions

For code review agents, assume "recently written code" not entire codebase:

For agents that review code, assume recent changes unless explicitly
stated otherwise.

4. Output Structure

Always define clear output format in system prompt:

**Output Format:**
Provide results as:
1. Summary (2-3 sentences)
2. Detailed findings (bullet points)
3. Recommendations (action items)

Integration with Plugin-Dev

Use this system prompt when creating agents for your plugins:

  1. Take user request for agent functionality
  2. Feed to Claude with this system prompt
  3. Get JSON output (identifier, whenToUse, systemPrompt)
  4. Convert to agent markdown file with frontmatter
  5. Validate the file with agent validation rules
  6. Test triggering conditions
  7. Add to plugin's agents/ directory

This provides AI-assisted agent generation.

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill serves as a comprehensive development guide for creating AI agents within the Claude Code ecosystem. It includes structural templates, system prompt design patterns, and a local utility script for validating file formats. The analysis found no evidence of malicious patterns, unauthorized code execution, or data exfiltration.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    7/7 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ce721c1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 5 months ago
version
0.1.0
  • claude
  • agents
  • plugin-development
  • autonomous-workflows
  • system-prompts
  • markdown
  • yaml
  • agent-triggering

README badge

README badge for anthropics/claude-plugins-official/agent-development

Teaches how to create agents—autonomous subprocesses that handle multi-step tasks independently—for Claude Code plugins, including frontmatter structure, system prompt design, triggering conditions, and validation rules. Covers agent file format (markdown with YAML), identifier naming, description writing for trigger detection, model and color selection, tool access control, and testing methodology.

Generated from the current SKILL.md.

What's the difference between an agent and a command in Claude Code plugins?
Agents are for autonomous multi-step work that runs independently; commands are for user-initiated actions. Use agents when you want Claude to proactively handle complex tasks without explicit user instruction each time.
What model should I specify for my agent?
Use `inherit` unless your agent needs specific model capabilities. `inherit` makes the agent use the same model as its parent, which is the recommended default. Only use `sonnet`, `opus`, or `haiku` if you have specific performance or cost requirements.
How do I define when an agent should trigger?
Write the `description` field with triggering conditions and 2-4 representative trigger scenarios in prose form. Then detail those scenarios in a 'When to invoke' section in the agent body as bullet points. The description is loaded into context so the harness can decide when to dispatch the agent.
What are the naming rules for agent identifiers?
Agent names must be 3-50 characters, lowercase letters and numbers only, with hyphens allowed between characters. They must start and end with alphanumeric characters (no leading or trailing hyphens, no underscores or spaces).
Should I restrict an agent's tool access?
Yes, follow the principle of least privilege. Specify only the tools your agent actually needs in the `tools` array (e.g., `["Read", "Grep"]` for read-only analysis). Omitting the field grants access to all tools, which is appropriate only if the agent genuinely requires full access.

Generated from the current SKILL.md. These answers refresh after source changes.