🗂️ OpenCode provides various files (skills, commands, agents, etc.) to build and run agentic flows, primarily using opencode, but also adaptable for other platforms.
💡 While opencode is the main focus, most resources here are also suitable for Claude Code and, with minor tweaks, for Copilot and others.
java/
|
springboot/
|
template/- 📦 java: Prompts and .opencode (skills, commands, context, agents) for Java projects
- 🌱 springboot: Prompts and .opencode (skills, commands, context, agents) for Spring Boot projects
- 📝 template: Template files
The basic execution flow:
Raw Spec
⬇️
spec-normalizer
⬇️
feature-planner
⬇️
task-breaker
⬇️
java-executor
Use spec-normalizer on:
"Users should be able to transfer money between wallets. It must not duplicate transactions. Add logging.".opencode/
├── agents/
│ ├── feature-planner.md
│ ├── task-breaker.md
│ └── java-executor.md
├── commands/
│ └── plan-feature.md
└── context/
└── project-context.mdHaving a feature normalize it:
.opencode/agents/spec-normalizer.mdPrompt
Use spec-normalizer on:
"Users should be able to transfer money between wallets. It must not duplicate transactions. Add logging."
Not having a pre written feature write one:
feature-spec-template.mdValide it:
.opencode/agents/spec-validator.md
This agent reads a feature and creates a technical plan, not tasks.
.opencode/agents/feature-planner.mdThis forces architectural thinking first.
Now convert the plan into actionable tasks.
.opencode/agents/task-breaker.mdNo fluff. No vague items like “implement feature”.
Only now code.
.opencode/agents/java-executor.mdThis prevents architectural drift.
Using a reusable pipeline command.
.opencode/commands/plan-feature.mdNow you can run:
/plan-feature "Implement wallet transfer with idempotency and audit logging"And get structured tasks.
Step 1 — Write feature using this template
Do NOT skip sections. Missing sections create hallucinations.
Step 2 — Run Planner Agent, prompt:
Use feature-planner on this spec.Planner now has structured input.
Step 3 — Run Task Breaker
Use task-breaker on planner output.Now tasks are grounded in architecture and constraints.
Context stabilizes decisions.
Planner thinks architecture.
Task breaker enforces engineering discipline.
Executor focuses on precision.
Each agent has a single responsibility.
If you let one agent do everything, you get average code.
If you split responsibility, you get senior-level output.
Firtlly have a
"Users should be able to transfer money between wallets. It must not duplicate transactions. Add logging."
In OpenCode, agents are specialized AI assistants that handle coding tasks.
You can use primary agents for main chat, cycle between them using Tab, or configure custom behaviors using AGENTS.md files.
Agents can be defined for specific tasks, and subagents can be triggered for specialized actions within a project, enabling collaborative, automated development workflows.
Key Ways to Use Agents in OpenCode:
Switching Agents: Use Tab to cycle between active agents in the terminal user interface (TUI).
Custom Instructions (AGENTS.md): Create an AGENTS.md file in your project root to define specific rules for the AI, similar to Cursor's rules. Run /init in OpenCode to generate this automatically.
Agent Configuration: Define specialized agents in ~/.config/opencode/agents/ or .opencode/agents/ to handle specific tasks.
Subagent Invocation: Use Agent configuration in commands to specify which agent executes a task, allowing a main agent to delegate work to specialized subagents.
Agent Skills: Use SKILL.md files in your repository to allow agents to discover and utilize reusable instructions.
GitHub Integration: Set up the OpenCode GitHub app to run agents on pull requests and comments by including /oc or /opencode.
Common Agent Commands:
/init: Initializes a new AGENTS.md file.
opencode --agent : Starts a session directly with a specific agent.
Ensure you have the required API keys (e.g., Anthropic) set up in your environment for the agents to function.