Skip to content

@tank/opencode-agent-creator

0.1.0

Create specialized OpenCode agents that assume specific roles. Covers agent anatomy, role design, prompt engineering, skill-to-agent conversion, and oh-my-opencode integration.


name: "@tank/opencode-agent-creator" description: | Create specialized OpenCode agents that assume specific roles — frontend architect, DevOps SRE, database specialist, code reviewer, or any domain expert. Covers agent anatomy (markdown and JSON formats), role design (persona, expertise, behavioral directives), system prompt engineering, tool permissions, oh-my-opencode integration (categories, skill injection, delegation wiring), and converting existing Tank skills into standalone agents. Synthesizes OpenCode source (sst/opencode), oh-my-opencode v3.x agent system, and production agent analysis.

Trigger phrases: "create agent", "opencode agent", "new agent", "convert skill to agent", "make an agent", "agent from skill", "custom agent", "specialized agent", "agent template", "agent for", "agent configuration", "agent role", "create a specialist", "build agent", ".opencode/agent"

OpenCode Agent Creator

Core Philosophy

  1. Role-first, not prompt-first — Define WHO the agent is before WHAT it says. Identity drives behavior.
  2. Agents have opinions — Effective agents push back, refuse out-of-scope work, and have strong preferences. Bland agents waste tokens.
  3. Minimum viable agent — Start with 20 lines. Add complexity only when the agent fails at real tasks. Over-engineered prompts confuse models.
  4. Skills supplement, agents act — Skills inject knowledge. Agents assume roles. Use both together for maximum effectiveness.

Quick-Start: Create an Agent

"I need a specialist agent for [DOMAIN]"

  1. Determine the role archetype: → See references/role-design.md for archetypes table

  2. Choose agent properties:

    • Mode: all for versatile, subagent for delegation-only
    • Model: Match complexity to role (see model selection guide)
    • Temperature: 0.0-0.3 for precision, 0.3-0.5 for creative
    • Permissions: Restrict tools based on role
  3. Write the agent file: → Use assets/agent-template.md as starter → See references/prompt-engineering.md for prompt structure

  4. Deploy:

    • Global: ~/.config/opencode/agent/<name>.md
    • Project: .opencode/agent/<name>.md
  5. Test with 5 patterns:

    • In-domain task → competent response
    • Out-of-scope request → polite refusal
    • Ambiguous request → asks clarifying question
    • Anti-pattern proposal → pushes back
    • Complex multi-step task → structured approach

"I want to convert a skill into an agent"

  1. Read the skill's SKILL.md and references
  2. Extract: domain scope, decision frameworks, anti-patterns, workflows
  3. Transform passive knowledge into active role directives
  4. Add personality, boundaries, and tool restrictions → See references/skill-to-agent-conversion.md

"Agent exists but isn't working well"

ProblemLikely CauseFix
Too generic/blandNo personality definedAdd opinions and preferences
Does things it shouldn'tNo boundary sectionAdd "Outside Your Scope"
Asks too many questionsNo decision frameworkAdd conditional directives
Ignores its restrictionsPrompt contradicts permissionsAlign prompt with frontmatter
Doesn't appear in @ menuWrong file locationMove to ~/.config/opencode/agent/
Sisyphus doesn't delegate to itPoor descriptionAdd <example> tags to description

Agent File Format

Markdown file with YAML frontmatter. Filename = agent name.

---
description: >-
  Use this agent when [TRIGGER CONDITION].
  Includes [TASK 1], [TASK 2], [TASK 3].
  
  <example>
  user: "[request]"
  assistant: "I'll use [agent] to [action]."
  </example>
mode: all
model: provider/model-id
temperature: 0.1
color: "#HEX"
permission:
  edit: allow|ask|deny
  bash:
    "*": ask
    "specific command": allow
---

[System prompt — the agent's role, expertise, and behavioral rules]

→ See references/agent-anatomy.md for complete property reference.

Decision Trees

Archetype Selection

NeedArchetypeKey Config
Writes code in a domainSpecialistedit: allow, low temp
Reviews but doesn't modifyRevieweredit: deny, read-only bash
Gathers informationResearcheredit: deny, bash: deny, webfetch: allow
Creates plans, not codePlanneredit: ask, read-only bash
Coordinates other agentsOrchestratorFull permissions, task tool

Model Tier Selection

Role ComplexityModel TierExamples
Deep reasoning / architectureOpus / GPT-5.2+Solution architect, security auditor
Code generation / editingSonnet / GPT-5.2Frontend engineer, API developer
Fast search / simple tasksHaiku / FlashExplorer, formatter, triage

Where to Deploy

ScopePathWhen
All projects~/.config/opencode/agent/Personal workflow agents
One project.opencode/agent/Project-specific specialists
omo overrideoh-my-opencode.jsonagentsModify built-in omo agents

Anti-Patterns

PatternProblemFix
"Be helpful and thorough"Vacuous instructionsSpecific behavioral directives
Agent does everythingNo focus, mediocre at all tasksNarrow to 1-2 domains
200+ line promptModel loses focusUnder 150 lines, use skills for knowledge
No NEVER rulesAgent makes domain-specific mistakesAdd 3-5 hard constraints
Copying skill text verbatimPassive knowledge, no agencyTransform into behavioral directives
No description examplesPrimary agents can't route to itAdd 3-5 <example> tags

Reference Files

FileContents
references/agent-anatomy.mdFull OpenCode agent schema, both formats, all properties, permission system, file locations
references/role-design.mdRole archetypes, persona construction, behavioral directives, decision frameworks, common mistakes
references/prompt-engineering.mdSystem prompt structure, directive patterns, tool restrictions, testing strategies, anti-patterns
references/skill-to-agent-conversion.mdWhen to convert, transformation process, patterns (specialist, reviewer, planner), verification
references/omo-integration.mdoh-my-opencode overrides, category system, skill injection, multi-model orchestration, deployment

Command Palette

Search skills, docs, and navigate Tank