| name | moai-cc-agents |
| description | Creating and Managing Sub-agents in Claude Code. Design agent personas, define proactive triggers, set tool permissions, structure agent files. Use when building specialized agents for code review, debugging, architecture, or domain-specific tasks. |
| allowed-tools | Read, Write, Edit, Glob, Bash |
Skill Metadata
| Field | Value |
|---|
| Version | 1.0.0 |
| Tier | Ops |
| Auto-load | When creating or managing sub-agents |
What It Does
Sub-agent ์์ฑ ๋ฐ ๊ด๋ฆฌ๋ฅผ ์ํ ์ ์ฒด ๊ฐ์ด๋๋ฅผ ์ ๊ณตํฉ๋๋ค. Agent persona ์ค๊ณ, proactive trigger ์ ์, tool ๊ถํ ์ค์ , agent ํ์ผ ๊ตฌ์กฐํ ๋ฐฉ๋ฒ์ ๋ค๋ฃน๋๋ค.
When to Use
- Sub-agent๋ฅผ ์๋ก ์์ฑํ ๋
- ๊ธฐ์กด agent์ ๊ถํ์ด๋ trigger ์กฐ๊ฑด์ ์์ ํ ๋
- Agent ๊ฐ ํ์
ํจํด์ ์ค๊ณํ ๋
- Tool access ์ต์ํ ์์น์ ์ ์ฉํ ๋
Creating and Managing Sub-agents
Sub-agents are specialized Claude instances with independent context, custom prompts, and restricted tool access. They handle deep analysis, parallel work, and autonomous tasks.
Agent File Structure
Location: .claude/agents/
---
name: agent-name
description: Use PROACTIVELY for [specific trigger conditions]
tools: Read, Write, Edit, Glob, Grep, Bash(git:*)
model: sonnet
---
Brief description of agent expertise.
- Primary responsibility
- Scope boundaries
- Success criteria
- When to activate automatically
- Specific conditions for invocation
- Integration with workflow
1. Input validation
2. Task execution
3. Output verification
4. Handoff to next agent (if applicable)
- What NOT to do
- Delegation rules
- Quality gates
Agent Persona Design Pattern
---
name: code-reviewer
description: Use PROACTIVELY for code review requests, PR analysis, or quality checks
tools: Read, Glob, Grep, Bash(git:*)
model: sonnet
---
# Code Reviewer โ Quality Expert
Specialized in identifying code quality issues, security risks, and architecture concerns.
## Core Mission
- Review code for SOLID principles
- Identify code smells and anti-patterns
- Verify security best practices
- Suggest improvements with rationale
## Proactive Triggers
- When user mentions "review", "quality", "audit"
- After significant code changes
- Before PR merge
## Workflow Steps
1. **Analyze**: Read changed files, understand context
2. **Evaluate**: Check against TRUST 5 principles
3. **Report**: List findings with severity & fix suggestions
4. **Recommend**: Suggest refactoring or architectural improvements
## Constraints
- No direct edits (only suggestions)
- Focus on maintainability, not style
- Respect existing architecture decisions
High-Freedom: Agent Principles
Autonomy & Expertise
- Each agent owns 1 specialization (not 3+)
- Define clear "when to activate" triggers
- Agents should make decisions independently
Tool Access Minimization
- Grant only necessary tools per role
- Restrict Bash to specific commands:
Bash(git:*), Bash(python:*)
- Never grant
Bash(*); always specify pattern
Handoff & Collaboration
- Agent A completes โ hands off to Agent B
- Use clear "next agent" instructions
- No circular dependencies
Medium-Freedom: Common Agent Patterns
Pattern 1: Debugger Agent
name: debugger
description: Use PROACTIVELY for error diagnosis, test failures, exception analysis
tools: Read, Grep, Glob, Bash(pytest:*), Bash(git:*)
model: sonnet
Mission: Diagnose errors, provide fix-forward guidance
Triggers: error, failed, exception, debug
Output: Root cause + suggested fixes
Pattern 2: Architect Agent
name: architect
description: Use PROACTIVELY for system design, refactoring, scalability concerns
tools: Read, Glob, Grep, Bash(ls:*), Bash(find:*)
model: sonnet
Mission: Design systems, propose architectures
Triggers: architecture, refactor, design, scalability
Output: Design document + implementation roadmap
Pattern 3: Security Agent
name: security-auditor
description: Use PROACTIVELY for vulnerability assessment, OWASP checks, secrets detection
tools: Read, Glob, Grep
model: sonnet
Mission: Find security issues, verify OWASP compliance
Triggers: security, audit, vulnerability, secrets
Output: Risk assessment + remediation steps
Low-Freedom: Tool Permission Patterns
Principle of Least Privilege
tools: Read, Write, Edit, Bash(*)
tools: Read, Glob, Grep
tools: Read, Edit, Bash(black:*), Bash(pytest:*)
Bash Command Restrictions
Bash(git:*)
Bash(npm run:*)
Bash(python:*)
Bash(pytest:*)
Bash(rm:*)
Bash(sudo:*)
Bash(curl:*)
Agent Execution Modes
Mode 1: Inline (main context)
/role security
"Check this project for vulnerabilities"
Mode 2: Sub-agent (isolated context)
/role security --agent
"Perform comprehensive security audit"
Mode 3: Parallel Multi-role
/multi-role security,performance,qa --agent
"Analyze security, performance, and quality"
Agent Registration & Discovery
/agents
/agents create
/agents view security-auditor
/agents edit security-auditor
/agents delete security-auditor
Agent Validation Checklist
Best Practices
โ
DO:
- Design agents around specific expertise
- Use
--agent flag for large analyses
- Combine multiple agents for complex tasks
- Name agents descriptively
โ DON'T:
- Create overpowered agents with all tools
- Allow direct file modifications without approval
- Overlap agent responsibilities
- Use
Bash(*) without specific patterns
Reference: Claude Code Sub-agents documentation
Version: 1.0.0