$npx -y skills add AgentWorkforce/relay --skill creating-claude-agents-skillUse when creating or improving Claude Code agents. Expert guidance on agent file structure, frontmatter, persona definition, tool access, model selection, and validation against schema.
| 1 | # Creating Claude Code Agents - Expert Skill |
| 2 | |
| 3 | Use this skill when creating or improving Claude Code agents. Provides comprehensive guidance on agent structure, schema validation, and best practices for building long-running AI assistants. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | Activate this skill when: |
| 8 | |
| 9 | - User asks to create a new Claude Code agent |
| 10 | - User wants to improve an existing agent |
| 11 | - User needs help with agent frontmatter or structure |
| 12 | - User is troubleshooting agent validation issues |
| 13 | - User wants to understand agent format requirements |
| 14 | - User asks about agent vs skill vs slash command differences |
| 15 | |
| 16 | ## Quick Reference |
| 17 | |
| 18 | ### Agent File Structure |
| 19 | |
| 20 | ```markdown |
| 21 | --- |
| 22 | name: agent-name |
| 23 | description: When and why to use this agent |
| 24 | allowed-tools: Read, Write, Bash |
| 25 | model: sonnet |
| 26 | agentType: agent |
| 27 | --- |
| 28 | |
| 29 | # 🔍 Agent Display Name |
| 30 | |
| 31 | You are [persona definition - describe the agent's role and expertise]. |
| 32 | |
| 33 | ## Instructions |
| 34 | |
| 35 | [Clear, actionable guidance on what the agent does] |
| 36 | |
| 37 | ## Process |
| 38 | |
| 39 | [Step-by-step workflow the agent follows] |
| 40 | |
| 41 | ## Examples |
| 42 | |
| 43 | [Code samples and use cases demonstrating the agent's capabilities] |
| 44 | ``` |
| 45 | |
| 46 | ### File Location |
| 47 | |
| 48 | **Required Path:** |
| 49 | |
| 50 | ``` |
| 51 | .claude/agents/*.md |
| 52 | ``` |
| 53 | |
| 54 | Agents must be placed in `.claude/agents/` directory as markdown files. |
| 55 | |
| 56 | ## Frontmatter Requirements |
| 57 | |
| 58 | ### Required Fields |
| 59 | |
| 60 | | Field | Type | Description | Example | |
| 61 | | ------------- | ------ | --------------------------------------------- | ------------------------------------------------------ | |
| 62 | | `name` | string | Agent identifier (lowercase, hyphens only) | `code-reviewer` | |
| 63 | | `description` | string | Brief overview of functionality and use cases | `Reviews code for best practices and potential issues` | |
| 64 | |
| 65 | ### Optional Fields |
| 66 | |
| 67 | | Field | Type | Description | Values | |
| 68 | | --------------- | ------ | --------------------------------------- | ------------------------------------ | |
| 69 | | `allowed-tools` | string | Comma-separated list of available tools | `Read, Write, Bash, WebSearch` | |
| 70 | | `model` | string | Claude model to use | `sonnet`, `opus`, `haiku`, `inherit` | |
| 71 | | `agentType` | string | Explicit marker for format preservation | `agent` | |
| 72 | |
| 73 | ### Validation Rules |
| 74 | |
| 75 | **Name Field:** |
| 76 | |
| 77 | - Pattern: `^[a-z0-9-]+$` (lowercase letters, numbers, hyphens only) |
| 78 | - Max length: 64 characters |
| 79 | - Example: ✅ `code-reviewer` ❌ `Code_Reviewer` |
| 80 | |
| 81 | **Description Field:** |
| 82 | |
| 83 | - Max length: 1024 characters |
| 84 | - Should clearly explain when to use the agent |
| 85 | - Start with action words: "Reviews...", "Analyzes...", "Helps with..." |
| 86 | |
| 87 | **Allowed Tools:** |
| 88 | Valid tools: `Read`, `Write`, `Edit`, `Grep`, `Glob`, `Bash`, `WebSearch`, `WebFetch`, `Task`, `Skill`, `SlashCommand`, `TodoWrite`, `AskUserQuestion` |
| 89 | |
| 90 | **Model Values:** |
| 91 | |
| 92 | - `sonnet` - Balanced, good for most agents (default) |
| 93 | - `opus` - Complex reasoning, architectural decisions |
| 94 | - `haiku` - Fast, simple tasks |
| 95 | - `inherit` - Use parent conversation's model |
| 96 | |
| 97 | ## Content Format Requirements |
| 98 | |
| 99 | ### H1 Heading (Required) |
| 100 | |
| 101 | The first line of content must be an H1 heading that serves as the agent's display title: |
| 102 | |
| 103 | ```markdown |
| 104 | # 🔍 Code Reviewer |
| 105 | ``` |
| 106 | |
| 107 | **Best Practices:** |
| 108 | |
| 109 | - Include an emoji icon for visual distinction |
| 110 | - Use title case |
| 111 | - Keep concise (2-5 words) |
| 112 | - Make it descriptive and memorable |
| 113 | |
| 114 | ### Persona Definition (Required for Agents) |
| 115 | |
| 116 | Immediately after the H1, define the agent's persona using "You are..." format: |
| 117 | |
| 118 | ```markdown |
| 119 | You are an expert code reviewer with deep knowledge of software engineering principles and security best practices. |
| 120 | ``` |
| 121 | |
| 122 | **Guidelines:** |
| 123 | |
| 124 | - Start with "You are..." |
| 125 | - Define role and expertise clearly |
| 126 | - Set expectations for the agent's capabilities |
| 127 | - Establish the agent's approach and tone |
| 128 | |
| 129 | ### Content Structure |
| 130 | |
| 131 | ```markdown |
| 132 | # 🔍 Agent Name |
| 133 | |
| 134 | You are [persona definition]. |
| 135 | |
| 136 | ## Instructions |
| 137 | |
| 138 | [What the agent does and how it approaches tasks] |
| 139 | |
| 140 | ## Process |
| 141 | |
| 142 | 1. [Step 1] |
| 143 | 2. [Step 2] |
| 144 | 3. [Step 3] |
| 145 | |
| 146 | ## Examples |
| 147 | |
| 148 | [Code samples showing good/bad patterns] |
| 149 | |
| 150 | ## Guidelines |
| 151 | |
| 152 | - [Best practice 1] |
| 153 | - [Best practice 2] |
| 154 | ``` |
| 155 | |
| 156 | ## Schema Validation |
| 157 | |
| 158 | Agents must conform to the JSON schema at: |
| 159 | `https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-agent.schema.json` |
| 160 | |
| 161 | ### Schema Structure |
| 162 | |
| 163 | ```json |
| 164 | { |
| 165 | "frontmatter": { |
| 166 | "name": "string (required)", |
| 167 | "description": "string (required)", |
| 168 | "allowed-tools": "string (optional)", |
| 169 | "model": "enum (optional)", |
| 170 | "agentType": "agent (optional)" |
| 171 | }, |
| 172 | "content": "string (markdown with H1, persona, instructions)" |
| 173 | } |
| 174 | ``` |
| 175 | |
| 176 | ### Common Validation Errors |
| 177 | |
| 178 | | Error | Cause |