Practical Examples
These examples show typical Plan → Explore → Build workflows you can replay in your project.
Example 1: Design a New API Endpoint (Plan + Explore)
Goal: Add POST /users in an Express project.
-
Tab to Plan
-
Prompt:
-
@explore:
-
Review Plan output and confirm approach
-
Tab to Build, paste summary:
Takeaway: Plan avoids blind edits; Explore aligns with existing patterns quickly.
Example 2: Fix a Failing Test (Build + LSP)
Goal: One test fails in CI.
-
Build mode:
-
If TypeScript errors appear, ensure
typescript-language-serveris inopencode.json -
Agent iterates using LSP diagnostics
Permission tip: If bash is ask, allow pnpm test* in config to reduce prompts.
Example 3: Custom Code Review Subagent
-
Create
.opencode/agents/review.md(see Agents & Permissions) -
Plan mode:
-
Allow only
git diff*,git log*so review agent does not edit code
Example 4: Parallel Sessions in a Monorepo
Scenario: Frontend styling and backend API at once.
- Session 1 (Build): frontend task, @
apps/web/package.json - Session 2 (Build): API task in
packages/api - Separate context reduces confusion
Note: git pull before merge; avoid parallel edits to the same files.
Example 5: Headless CHANGELOG Draft
Polish before release. In CI, configure API keys, permissions, and token budget.
Example 6: MCP for Internal Docs
With read-only Confluence/Notion MCP:
Explore + read-only MCP, then Build—lower risk of writing to external systems.
Example 7: /init for New Contributors
- Clone repo
opencode→/init→ reviewAGENTS.md- Plan mode: “How do I run the first test in this project?”
- Self-serve onboarding in ~30 minutes