OpenCode Essentials
Setup, workflow, and interview-relevant habits for OpenCode, the open source AI coding agent for the terminal.
OpenCode is an open source AI coding agent — a terminal-based interface, desktop app, and IDE extension used by over 7.5M developers a month. It's notable for its privacy posture (it doesn't store your code or context data) and its model flexibility: 75+ LLM providers through Models.dev, including local models, plus your existing GitHub Copilot or ChatGPT Plus/Pro account.
Setup
The easiest install:
curl -fsSL https://opencode.ai/install | bashOr via npm/Homebrew:
npm install -g opencode-ai
brew install anomalyco/tap/opencodeThen configure a provider. The /connect command walks you through it — you can sign in with an OpenAI or GitHub account, use OpenCode Zen (a curated set of models tested for coding agents), or add your own API keys.
Initialize
In your project, run /init. OpenCode analyzes the project and creates an AGENTS.md file in the root. Commit that file — it helps OpenCode (and other agents) understand the project structure and coding patterns.
cd your-project
opencode
/initThe core workflow
The workflow that maps almost 1:1 onto interview best practices:
- Ask questions — use
@to fuzzy-search files and reference them directly in a prompt:How is authentication handled in @packages/functions/src/api/index.ts - Create a plan — hit Tab to enter Plan mode (the agent proposes how it'll implement without changing anything):
Iterate on the plan — you can drag and drop images, add detail, ask for changes.
When a user deletes a note, flag it as deleted in the database. Then create a screen that shows recently deleted notes where a user can undelete or permanently delete. - Build the feature — hit Tab again to switch to Build mode, and approve execution:
Sounds good! Go ahead and make the changes.
Give OpenCode plenty of context and examples — the docs recommend talking to it like a junior developer on your team, which is exactly the framing interviewers use.
Undo and share
/undoreverts the last change and restores your original message. You can undo multiple times;/redoreplays them. This is your rollback discipline — when the agent goes off the rails, a clean undo beats manual repair./sharecreates a link to the current conversation (conversations aren't shared by default). For practice, exporting your session this way is a tidy transcript to review or submit.
Interview-relevant habits
Quick check · In OpenCode, what does pressing Tab do?
Premium
Unlock the rest of this guide
Premium unlocks every pattern deep-dive, every problem breakdown and solution, the practice sandbox, and verdict feedback on your practice runs.
- OpenCode is an open source agent (160K+ stars) for terminal, desktop, and IDE.
- /init generates an AGENTS.md that grounds the agent in your project.
- Plan mode (Tab) proposes without changing; Build mode executes.
- @-file references and /undo make it easy to direct and roll back.
- The full article, complete and uninterrupted
- All pattern deep-dives and problem breakdowns
- Practice sandbox and verdict feedback