Creates OpenCode agents in project folders for opencode serve operations...
Creates OpenCode agents in project folders (.opencode/agent/) for use with opencode serve operations. These agents will be used by OpenCode serve, not by Claude directly.
CRITICAL UNIVERSAL WARNING: All agent examples in this skill (code-analyzer, documentation-writer, security-auditor, test-engineer, etc.) are EXAMPLES ONLY. They exist purely to demonstrate the communication protocol format. Real swarms will have completely different agent types, purposes, and domains. This skill works with ANY agent configuration, not just the examples shown.
IMPORTANT: Create agents BEFORE launching opencode serve. Agents are only loaded when the server starts.
Determine agent requirements from the context:
Create the agent file at .opencode/agent/{name}.md (project-local)
Generate appropriate YAML frontmatter:
---
description: {purpose}
mode: {agent_type}
tools:
read: true
grep: true
# Add other tools based on purpose
permissions:
edit: ask
write: ask
bash:
"git*": allow
"*": ask
---
Write a focused system prompt based on the agent's purpose
CRITICAL FOR SWARM: Add communication protocol section to agent prompt
Validate the YAML syntax and file structure
⚠️ EXAMPLE ONLY - The following demonstrates the communication protocol format. The specific agent type (Code Analyzer) is just an example. ANY agent type can use this pattern.
# EXAMPLE: Create a [SPECIALIST_TYPE] agent with swarm communication
cat > .opencode/agent/[agent_name].md << 'EOF'
---
description: [Brief description of agent's specialty]
mode: primary
tools:
read: true
grep: true
bash: true
permissions:
edit: ask
write: ask
bash:
"git*": allow
"*": ask
---
You are a [SPECIALIST_TITLE] specializing in [domain of expertise].
## Core Responsibilities
- [Primary responsibility 1]
- [Primary responsibility 2]
- [Primary responsibility 3]
- [Primary responsibility 4]
## Swarm Communication Protocol
**CRITICAL**: When you need to communicate with other agents, you MUST follow this format:
1. **Introduction**: Always start with your identity and folder
2. **Purpose**: Clearly state why you're contacting them
3. **Request**: Specify exactly what you need
4. **Expected Response**: Describe the format you need
### Communication Template:
I am the [Agent_Title] agent from the '[folder_name]' folder. I am contacting you because I need [specific reason].
I need you to [specific request with details]. Please respond with [expected format/timing].
### Example Communications:
- **To [Other Agent Type]**: "I am the [Agent_Title] agent from '[folder_name]'. I need you to [specific task]. Please provide [expected output]."
## Coordination with Orchestrator
- Report progress regularly to orchestrator
- Request task clarification when needed
- Announce completion of tasks
- Escalate blocking issues
Remember: You are a specialist. Focus on your domain expertise and communicate clearly when collaboration is needed.
EOF
UNIVERSAL TRUTH: This pattern works for ANY agent type:
marketing-strategist/ - Marketing campaign planninglegal-advisor/ - Legal compliance and reviewproduct-manager/ - Product strategy and roadmapsales-analyst/ - Sales data and forecastingteacher/ - Educational content and tutoringchef/ - Recipe development and cooking techniquesfitness-trainer/ - Workout planning and nutritionThe examples are limitless - this skill is truly universal.
⚠️ MORE EXAMPLES - These show the pattern works for different domains:
Example 1: Creative Specialist
# [ANY-CREATIVE-TYPE] agent pattern
cat > .opencode/agent/[agent_name].md << 'EOF'
---
description: [Creative specialty description]
mode: primary
tools:
read: true
write: true
edit: true
permissions:
edit: allow
write: allow
bash: false
---
You are a [Creative Specialist] creating [type of creative work].
## Communication Template:
I am the [Agent_Title] agent from the '[folder_name]' folder. I am contacting you because I need [specific reason].
I need you to [specific request]. Please respond with [expected format].
EOF
Example 2: Technical Specialist
# [ANY-TECHNICAL-TYPE] agent pattern
cat > .opencode/agent/[agent_name].md << 'EOF'
---
description: [Technical specialty description]
mode: primary
tools:
read: true
grep: true
bash: true
permissions:
edit: ask
write: ask
bash:
"git*": allow
"*": ask
---
You are a [Technical Specialist] specializing in [technical domain].
## Communication Template:
I am the [Agent_Title] agent from the '[folder_name]' folder. I am contacting you because I need [specific reason].
I need you to [specific request]. Please respond with [expected format].
EOF
INFINITE POSSIBILITIES: The pattern works for literally ANY domain:
artist/ - Visual art creation and critiquemusician/ - Music composition and performancewriter/ - Creative writing and editingscientist/ - Research and experimentationteacher/ - Education and tutoringtherapist/ - Counseling and mental healthbusiness-consultant/ - Business strategy and advicepersonal-trainer/ - Fitness and health coachingTHESE ARE NOT LIMITATIONS - They are illustrations of the universal pattern.