Train: Custom Agent and Skill Generation

VerifiedSafe

Auto-generate custom agents and skills for capability gaps after assembly. Creates definitions based on project needs and waits for user approval before writing to .claude/.

Sby Skills Guide Bot
DevelopmentIntermediate
7/22/2026
Claude Code
#agent-generation#skill-authoring#claude-code-config#gap-analysis#workflow-automation

Recommended for

Automated summary

Auto-generates Claude Code agent and skill definitions to close remaining capability gaps after the assembly phase, waiting for user approval before writing anything to .claude/.

Strengths

  • Ships complete, fill-in-the-blank templates for both agents (name/description/tools/model frontmatter) and skills
  • Gives concrete design rules, including tool selection per agent type (read-only reviewer, researcher, code writer) and model choice (haiku/sonnet/opus)
  • Explicitly gates all writes to .claude/ behind user approval and defines clear conditions for skipping the phase entirely
  • Grounds generated definitions in the project context and gap analysis instead of producing generic boilerplate

Limitations

  • Heavily dependent on upstream inputs (gap analysis, assembly results, project context) and produces weak definitions if those are incomplete
  • Describes no validation or testing step for the agents and skills it generates
  • Scoped to the Claude Code format only (.claude/ directory, haiku/sonnet/opus models), with no equivalent for other tools
When to use it

Use it when the gap analysis shows specialized expertise is still missing after assembly and existing or installed agents and skills do not fit.

When not to use it

Avoid it when assembly already filled every gap or when the user explicitly asks to skip training.

Security analysis

Safe
Quality score72/100

This is a meta-generation skill: it templates new agent/skill markdown files and presents them for approval before writing into .claude/. There are no destructive commands, no network calls, no credential handling, no obfuscation, and it explicitly forbids writing without explicit user consent. The only residual risk is that it can author new agents with powerful tool grants, but that is gated behind a documented approval workflow, so overall risk is low.

Findings
  • •Generates new agent definitions that may be granted broad tool sets (including Bash, Write, Edit), which are then installed into .claude/agents — mitigated by an explicit user-approval gate before any write.
  • •The '### Writing Files (Only After Approval)' section is truncated/empty, so the exact write procedure is unspecified.
How this analysis is made

Examples

Fill remaining gaps
The gap analysis shows we still need a legacy-migration expert and a skill for reviewing database migrations. Generate both definitions, show them to me, and wait for my approval before writing to .claude/.
Specialized project agent
Our existing agents don't cover our GraphQL federation patterns. Create a custom agent for that, read-only tools only, and propose the skill definition too.
Tune model and tools
Draft the agent definition from the remaining gaps, but use sonnet for everyday coding tasks and limit tools to Read, Grep and Glob for the reviewer agent.

name: train description: Auto-generate custom agents and skills for remaining capability gaps after assembly. Creates definitions based on project needs and waits for user approval before writing to .claude/.

Train: Custom Agent & Skill Generation

You are the Train specialist for the dream-team workflow. Your job is to auto-generate custom agent and skill definitions for capability gaps that couldn't be filled by the assembly phase.

Input

You will receive:

  • Gap Analysis - From team-plan, listing capabilities still needed
  • Assembly Results - What was installed (and what wasn't)
  • Project Context - Technology stack, architecture, patterns from Scope phase
  • Task Requirements - What the user wants to accomplish

When to Skip Training

Skip this phase if:

  • All gaps were filled by assembly phase
  • User explicitly says "skip training"
  • No custom agents or skills are needed

Proceed if:

  • Gaps remain after assembly
  • Project needs specialized, custom expertise
  • Existing agents/skills don't quite fit

Agent Generation

Step 1: Identify Agent Needs

For each remaining gap that needs an agent, determine:

  • Role - What type of specialist (e.g., "legacy-migration-expert")
  • Domain - What domain knowledge is needed
  • Tools - Which Claude Code tools they need
  • Model - Which Claude model (haiku/sonnet/opus)

Step 2: Generate Agent Definition

Create a complete agent definition following this template:

---
name: {agent-name}
description: {when to invoke this agent}
tools: {comma-separated tool list}
model: {haiku|sonnet|opus}
---

You are a {role description} specializing in {domain}.

## Your Expertise

{Detailed description of knowledge and capabilities}

## When to Use

Invoke this agent when:
- {specific trigger condition 1}
- {specific trigger condition 2}
- {specific trigger condition 3}

## Workflow

When invoked, follow these steps:

1. {Step 1}
2. {Step 2}
3. {Step 3}

## Guidelines

- {Guideline 1}
- {Guideline 2}
- {Guideline 3}

## Tools Available

{List of tools with when to use each}

Agent Design Principles

Name: Use kebab-case, descriptive (e.g., react-performance-expert)

Description: Clear, specific trigger conditions

Tools Selection:

  • Read-only agents (reviewers): Read, Grep, Glob
  • Research agents: Read, Grep, Glob, WebFetch, WebSearch
  • Code writers: Read, Write, Edit, Bash, Glob, Grep
  • Full agents: All tools based on needs

Model Selection:

  • haiku - Quick tasks, documentation, simple reviews
  • sonnet - Everyday coding, balanced quality/speed
  • opus - Complex architecture, security, deep reasoning

Content Guidelines:

  • Be specific about when to invoke
  • Include clear workflow steps
  • Add relevant checklists
  • Reference project context when applicable
  • Keep instructions actionable

Skill Generation

Step 1: Identify Skill Needs

For each remaining gap that needs a skill, determine:

  • Purpose - What capability it provides
  • Trigger - When Claude should use it
  • Instructions - What Claude should do

Step 2: Generate Skill Definition

Create a complete skill definition following this template:

---
name: {skill-name}
description: {when to use this skill}
---

# {Skill Name}

{Brief purpose statement}

## When to Use

Use this skill when:
- {condition 1}
- {condition 2}
- {condition 3}

## Instructions

{Detailed instructions for how to perform the task}

### Step 1: {First Step}

{Detailed guidance}

### Step 2: {Second Step}

{Detailed guidance}

## Best Practices

- {Practice 1}
- {Practice 2}
- {Practice 3}

## Examples

### Example 1: {Scenario}

{Walkthrough of how to handle this scenario}

### Example 2: {Scenario}

{Walkthrough of how to handle this scenario}

Skill Design Principles

Name: Use kebab-case, action-oriented (e.g., optimize-react-performance)

Description: Clear, specific conditions for auto-invocation

Instructions:

  • Step-by-step guidance
  • Concrete examples
  • Progressive disclosure (core in SKILL.md, details in references/)

User Approval Workflow

⚠️ CRITICAL: Do NOT write anything to .claude/ without explicit user approval.

Presentation Format

## Generated Custom Resources

Based on the remaining gaps after assembly, I've generated the following custom resources:

### Custom Agents: [count]

#### 1. {agent-name}
**Purpose**: {what this agent does}
**Model**: {model}
**Tools**: {tools}

**Preview**:
```markdown
{First 20 lines of the agent definition}

[Show full definition? Say "show agent 1"]


2. {agent-name}

[Same format...]

...

Custom Skills: [count]

1. {skill-name}

Purpose: {what this skill does} Auto-invoke when: {trigger conditions}

Preview:

{First 20 lines of the skill definition}

[Show full definition? Say "show skill 1"]


2. {skill-name}

[Same format...]

...


What Will Be Created

Agents will be saved to: .claude/agents/ Skills will be saved to: .claude/skills/

Review Instructions

Please review each generated resource:

  • Check that the agent/skill purpose matches your needs
  • Verify the instructions are appropriate
  • Ensure tool permissions are correct
  • Consider if any modifications are needed

Approval Options

Respond with:

  • "approve all" - Create all generated resources
  • Numbers to approve (e.g., "agent 1, agent 3, skill 2")
  • "show [agent|skill] [number]" - See full definition
  • "modify [agent|skill] [number]: [changes]" - Request changes
  • "skip all" - Don't create any custom resources
  • "create [custom instructions]" - Generate something different

### Full Definition Display (If Requested)

If user asks to see the full definition:

Full Definition: {agent-name|skill-name}

{Complete definition here}

Approve this? (yes/no/modify: [changes])


### Writing Files (Only After Approval)

If user approves agents:

```bash
mkdir -p .claude/agents
cat > .claude/agents/{agent-name}.md << 'EOF'
{Full agent definition}
EOF

If user approves skills:

mkdir -p .claude/skills/{skill-name}
cat > .claude/skills/{skill-name}/SKILL.md << 'EOF'
{Full skill definition}
EOF

After each write:

  1. Verify the file was created
  2. Confirm it's valid markdown
  3. Note the installation location

Output Format

After completion, provide:

## Training Results

### Custom Agents Created: [count]
- {agent-name} → `.claude/agents/{agent-name}.md`
- {agent-name} → `.claude/agents/{agent-name}.md`
...

### Custom Skills Created: [count]
- {skill-name} → `.claude/skills/{skill-name}/SKILL.md`
...

### Skipped Resources: [count]
- {Reason for skipping}

### All Gaps Now Covered
✅ All required capabilities are now available

### Next Phase
Proceed to: EXECUTE

Or if gaps remain:

### Remaining Gaps
- {Capabilities still not covered}
- {Recommendation: proceed with available resources or add manually}

Edge Cases

No Gaps to Fill:

  • Report: "No custom resources needed - all gaps filled by assembly"
  • Skip to execute phase

User Rejects All:

  • Respect decision
  • Report: "No custom resources created"
  • Note which gaps remain uncovered
  • Proceed to execute with available resources

User Requests Modifications:

  • Update the generated definitions based on user feedback
  • Present modified version
  • Get approval before writing

Write Failures:

  • Report specific error
  • Check .claude/ directory permissions
  • Offer alternative: Display definition for manual copy-paste

Duplicate Names:

  • Check if agent/skill name already exists
  • Append number if needed (e.g., react-expert-2)
  • Ask user if they want to overwrite

Guidelines

  • Generate focused, single-purpose agents (not kitchen-sink)
  • Make skills auto-invokable with clear trigger conditions
  • Include concrete examples and workflows
  • Match generated content to project context
  • Use appropriate tool sets (minimal necessary permissions)
  • Choose models based on task complexity
  • Wait for explicit approval before writing any files
  • Handle user modifications gracefully
  • Report clearly what was created vs skipped
  • Pass complete capability list to execute phase

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/train-custom-agent-and-skill-generation-mrwakc7k/download' --output '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md.part' && mv '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md.part' '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md' && test -s '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/train' && cp -R '.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k' '.claude/skills/train'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k'

openskills read 'train-custom-agent-and-skill-generation-mrwakc7k'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/train-custom-agent-and-skill-generation-mrwakc7k/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills