Skip to content
Back to skills

Creating Subagents

ASecurity

Subagents are specialized AI instances with focused expertise, isolated context, and scoped tool access.

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
toolsgobashcode-reviewgitapisecurity

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill creating-subagents --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Creating Subagents?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Creating Subagents
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-creating-subagents/badge)](https://www.skillsdirectory.com/skills/majiayu000-creating-subagents)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: creating-subagents
description:
  Use when need to create specialized subagent for recurring tasks,
  domain-specific work, or pipeline automation
---

# Creating Subagents

Subagents are specialized AI instances with focused expertise, isolated context,
and scoped tool access.

## When to Create

- Task repeats across projects (code review, security audit)
- Domain expertise needed (data science, API design)
- Pipeline step requires isolation (PM → Architect → Implementer)
- Tool access must be restricted

Skip if: one-off task, no specialization needed.

## Quick Reference

| Field             | Required | Purpose                                |
| ----------------- | -------- | -------------------------------------- |
| `name`            | Yes      | Lowercase, hyphens only                |
| `description`     | Yes      | When to delegate (triggers)            |
| `tools`           | No       | Allowlist; omit = inherit all          |
| `disallowedTools` | No       | Denylist; removed from inherited       |
| `permissionMode`  | No       | `default`, `acceptEdits`, `plan`, etc. |
| `skills`          | No       | Preload skill content into context     |
| `hooks`           | No       | Lifecycle hooks (`PreToolUse`, `Stop`) |
| `color`           | No       | Background color for UI identification |

## Design Process

### 1. Define the Problem

Before writing code, answer:

- What task does this agent solve?
- What does success look like?
- What tools are absolutely required?
- What should the agent NOT do?

### 2. Write Description First

Description determines when agent is invoked. Write it before the prompt.

**Pattern:** `[Role]. [Trigger condition]. Use proactively [when].`

```yaml
# ❌ BAD: Vague, no trigger
description: Helps with code

# ❌ BAD: Describes process, not trigger
description: Reviews code and provides feedback

# ✅ GOOD: Clear role + trigger + proactive hint
description: Code quality reviewer. Use proactively after code changes.
```

### 3. Minimal Viable Prompt

Start with the smallest prompt that works:

```markdown
---
name: code-reviewer
description: Code quality reviewer. Use proactively after code changes.
tools: Read, Glob, Grep, Bash
color: blue
---

You are a code reviewer. When invoked:

1. Run git diff to see changes
2. Review modified files
3. Report: Critical → Warnings → Suggestions

Include fix examples.
```

### 4. Test Before Deploy

Run the agent on real tasks. Document:

- Did it activate when expected?
- Did it have the right tools?
- Was output useful and structured?
- Did it stay in scope?

### 5. Iterate Based on Failures

When agent fails, identify the gap:

| Symptom             | Fix                            |
| ------------------- | ------------------------------ |
| Doesn't activate    | Improve description triggers   |
| Wrong scope         | Add constraints to prompt      |
| Missing context     | Add required tools or skills   |
| Unstructured output | Define output format in prompt |
| Does too much       | Split into focused agents      |

## Tool Access by Role

| Role              | Tools                                 |
| ----------------- | ------------------------------------- |
| Read-only         | Read, Grep, Glob                      |
| Research          | Read, Grep, Glob, WebFetch, WebSearch |
| Code modification | Read, Write, Edit, Bash, Glob, Grep   |
| Full access       | (omit field — inherits all)           |

## Common Mistakes

| Mistake                     | Fix                                     |
| --------------------------- | --------------------------------------- |
| Vague description           | Specific triggers: "after code changes" |
| Tool inheritance by default | Explicit `tools` field for security     |
| No structured output        | Define format in prompt                 |
| Monolithic mega-agent       | Split into single-purpose agents        |
| Missing "Use proactively"   | Add to description for auto-delegation  |
| Prompt before description   | Write description first — it's the API  |

## Creation Checklist

- [ ] Problem clearly defined (what, success criteria, non-goals)
- [ ] Description written first with trigger conditions
- [ ] Tools explicitly listed (not inherited)
- [ ] Prompt is minimal and focused
- [ ] Output format defined
- [ ] Tested on real task
- [ ] Iterated based on failures

## Pipeline Pattern

Chain agents for multi-stage workflows:

```
pm-spec → architect-review → implementer-tester
```

Each agent:

- Has single responsibility
- Updates status on completion
- Hooks trigger next stage

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.