Skip to content

Opencode Primer

Master OpenCode, the open-source AI coding agent — setup, agents, skills, plugins, MCP, Zen & headless CI.

Install

$npm i -g opencode-ai@latest

Install command taken from the project's README or registry entry. Always review code before running it.

OpenCode Primer

Everything you need to know about OpenCode — from your first prompt to custom agents, skills, plugins, and MCP integrations. Clear mental models, real examples, every fact verified against the current release.

curl -fsSL https://opencode.ai/install | bash

Who this is for: Developers using (or about to use) OpenCode. Beginners get a guided path; power users get depth on Custom Commands, Skills, Plugins, MCP, and Agents.

⚖️ Not affiliated with the OpenCode team. This is a community-maintained guide. For canonical sources, check opencode.ai/docs and github.com/anomalyco/opencode.

💡 Pro Tip: If this guide saves you an afternoon, a ⭐ helps other developers find it.


🧭 Choose your path

You are… Start with Time
🚀 New to OpenCode What is it → Setup → Prompt Engineering ~15 min
⚡ Already using it Custom Commands · Skills · Plugins · MCP ~20 min each
🧠 Configuring or headless Agents · Headless & CI · Models & Providers varies

Getting started

What is OpenCode?

OpenCode is an open-source AI coding agent — a terminal app (TUI), desktop app, and IDE extension that reads your repo, runs commands, edits files, and talks to any LLM you point it at. Maintained by Anomaly, MIT-licensed — and as of July 2026 the most-starred coding agent on GitHub (182K+ stars), with 8M monthly users by the founder's count.

Three things it does that a chat UI can't:

  • Reads your actual repo — not pasted snippets. Greps your files, follows imports, grounds answers in real context using built-in read/grep/glob tools.
  • Edits in place and runs your stack — diff-aware edit/write/apply_patch, then bash to run your tests, linter, or build on the spot.
  • Composes with the rest of your toolchain — multi-provider models, custom slash commands, agent skills, JS/TS plugins, MCP servers, LSP, formatters, and an HTTP server for CI use.

Three interfaces:

Surface Command When
TUI (default) opencode Interactive day-to-day work in your terminal
CLI / headless opencode run "" Scripts, CI jobs, one-shot prompts
Server opencode serve or opencode web Headless API, web UI, or remote attach
opencode                                       # start TUI in the current repo
opencode run "fix the failing test in src/api.test.ts"
opencode serve --port 4096                     # headless server

OpenCode sits in the same space as Claude Code, Codex CLI, and Cursor — same problem, different trade-offs. None is universally better; pick the one whose model, surface, and ecosystem fit your workflow. (The field consolidated hard in 2026: Gemini CLI was retired in June in favor of the closed-source Antigravity CLI, and Roo Code shut down in May.)

Similar plugs

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local…

Why use many token when few token do trick. Viral skill + proxy for coding agents that cuts 65% of tokens by talking like a caveman.

The 1st Collaborative AI Design Agent Workspace. Local-first and open source. Create prototypes, websites, apps, dashboards, presentations, images, and videos with your team…

Explore related