Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

opencode — Claude Code skill: delegate coding to AI agent

Skill to run OpenCode CLI from Claude Code, Cursor, and other IDEs. Delegates refactoring, feature development, and PR review to a separate AI agent with its own session and model choice.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add NousResearch/hermes-agent --skill opencode -a claude-code
Open on GitHub

What opencode does

OpenCode is an autonomous AI coder with TUI and CLI that works across multiple providers (OpenRouter, Anthropic, and others). The skill supports two modes: one-shot tasks via opencode run 'prompt' or interactive background sessions that accept follow-up prompts. For bounded work (add feature, fix bug), use opencode run without PTY — it executes and exits quickly. For iterative work, start opencode with background=true, pty=true, get a session_id, and send additional prompts via process(action="submit"). The skill includes built-in PR review via opencode pr or isolated analysis in a temporary clone.

Required: OpenCode installed (npm i -g opencode-ai@latest or brew install), auth configured (opencode auth login or env vars like OPENROUTER_API_KEY), a Git repository. Critical: /exit does not work in the TUI—exit via Ctrl+C (\x03) or process(action="kill"). If OpenCode seems stuck, check logs before terminating.

What it helps with

  • Run a separate AI coder for refactoring without interrupting the main session
  • Get a PR review with security, test, and style analysis
  • Execute multiple tasks in parallel across isolated working directories
  • Send a follow-up prompt and inspect model thinking with --thinking

Example prompts for the agent

  • opencode run 'Add retry logic to API calls and update tests'
  • opencode run 'Review config.yaml for security issues' -f config.yaml
  • opencode -c in workdir=~/project with background=true to resume the last session

How to install opencode

1Skills CLI (Vercel)

npx skills add NousResearch/hermes-agent --skill opencode -a claude-code

2Manually: put the files in place

~/.claude/skills/opencode/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/opencode/

From the same set42

The whole set →
dogfood Teknium (teknium1), Hermes Agent A skill for exploratory QA of a web app: it walks the pages, captures console errors and screenshots, then writes a bug report. Claude Code CX Codex Cursor +1 6,400installs humanizer Siqi Chen (@blader, https://github.com/blader/humanizer), ported by Hermes Agent This skill removes common AI writing patterns and gives drafts a more natural voice. Use it for docs, posts, emails, and other text. Claude Code CX Codex Cursor +1 1,300installs popular-web-designs Hermes Agent + Teknium (design systems sourced from VoltAgent/awesome-design-md) 54 real-world design systems (Stripe, Linear, Vercel, Claude) with CSS tokens, typography, and components for building pages styled after known brands. Claude Code CX Codex Cursor +1 914installs powerpoint Nous Research Creates, reads, and edits .pptx presentations with python-pptx. Use it for slide decks, extracting presentation content, and template-based updates. Claude Code CX Codex Cursor +1 751installs claude-design BadTechBandit Skill for building HTML artifacts — landing pages, prototypes, decks — in Claude Code, Codex and Cursor. Reads project context and produces a self-contained file with markup and styles. Claude Code CX Codex Cursor +1 645installs llm-wiki Hermes Agent A skill for building a persistent knowledge base from interlinked markdown files. The agent summarizes sources, cross-references pages, and maintains consistency while you curate and direct the analysis. Claude Code CX Codex Cursor +1 603installs yuanbao Teknium (teknium1), Hermes Agent Connects agents to Yuanbao groups to query members, send mentions using @nickname, and deliver direct messages with attachments. Claude Code CX Codex Cursor +1 564installs songwriting-and-ai-music Teknium (teknium1), Hermes Agent Provides songwriting structures, prosody techniques, and Suno AI prompt formulas that rely on sound details rather than artist names. Claude Code CX Codex Cursor +1 563installs

Similar

geo-sleuth Oldcircle This skill estimates where and when a photo was taken using metadata, OCR, maps, and image search. Use it when visual clues need checking. Claude Code CX Codex Cursor +1 3,000installs meme-maker openclaw Searches meme templates from a curated registry, suggests formats for your joke, and renders images locally (SVG or PNG) or via Imgflip. Claude Code CX Codex Cursor +1 336installs supermemory supermemoryai Connects long-term memory infrastructure to AI agents. It stores user profiles, learns facts across chat sessions, and runs multi-modal RAG. Claude Code CX Codex Cursor +1 546installs plan-design-review garrytan Senior product designer review for plans before implementation begins. It spots missing UX decisions and updates the plan document directly. Claude Code CX Codex Cursor +1 474installs ai-video-generation prime-skills This skill routes video requests to suitable models and produces clips via the runcomfy CLI. It helps create animations from text prompts or still frames directly inside your agent chat. Claude Code CX Codex Cursor +1 382,500installs printing-press-score mvanhorn Scores a generated CLI against the Steinberger bar and compares two CLIs. Use it when checking output from cli-printing-press. Claude Code CX Codex Cursor +1 6,400installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs

Questions about opencode

How do I install opencode for Claude Code?

Run npx skills add NousResearch/hermes-agent --skill opencode -a claude-code. The skill installs to ~/.claude/skills/opencode/. Make sure OpenCode is globally installed: npm i -g opencode-ai@latest or brew install anomalyco/tap/opencode.

What does opencode do?

It is a skill to run OpenCode CLI, a separate AI agent for coding. You can execute a one-shot task (opencode run) or start an interactive session with follow-up prompts. It supports PR review, parallel execution in different directories, and model selection.

What is the difference between `opencode run` and an interactive session?

opencode run is one-shot: the command executes the prompt and exits, no PTY needed. An interactive session (with background=true, pty=true) runs in the background; you send follow-ups via process(action="submit") and check progress with poll and log.

Source text

SKILL.md · MIT
---
name: opencode
description: "Delegate coding to OpenCode CLI (features, PR review)."
version: 1.2.0
author: Hermes Agent
license: MIT
platforms: [linux, macos, windows]
metadata:
  hermes:
    tags: [Coding-Agent, OpenCode, Autonomous, Refactoring, Code-Review]
    related_skills: [claude-code, codex, hermes-agent]
---

# OpenCode CLI

Use [OpenCode](https://opencode.ai) as an autonomous coding worker orchestrated by Hermes terminal/process tools. OpenCode is a provider-agnostic, open-source AI coding agent with a TUI and CLI.

## When to Use

- User explicitly asks to use OpenCode
- You want an external coding agent to implement/refactor/review code
- You need long-running coding sessions with progress checks
- You want parallel task execution in isolated workdirs/worktrees

## Prerequisites

- OpenCode installed: `npm i -g opencode-ai@latest` or `brew install anomalyco/tap/opencode`
- Auth configured: `opencode auth login` or set provider env vars (OPENROUTER_API_KEY, etc.)
- Verify: `opencode auth list` should show at least one provider
- Git repository for code tasks (recommended)
- `pty=true` for interactive TUI sessions

## Binary Resolution (Important)

Shell environments may resolve different OpenCode binaries. If behavior differs between your terminal and Hermes, check:

```
terminal(command="which -a opencode")
terminal(command="opencode --version")
```

If needed, pin an explicit binary path:

```
terminal(command="$HOME/.opencode/bin/opencode run '...'", workdir="~/project", pty=true)
```

## One-Shot Tasks

Use `opencode run` for bounded, non-interactive tasks:

```
terminal(command="opencode run 'Add retry logic to API calls and update tests'", workdir="~/project")
```

Attach context files with `-f`:

```
terminal(command="opencode run 'Review this config for security issues' -f config.yaml -f .env.example", workdir="~/project")
```

Show model thinking with `--thinking`:

```
terminal(command="opencode run 'Debug why tests fail in CI' --thinking", workdir="~/project")
```

Force a specific model:

```
terminal(command="opencode run 'Refactor auth module' --model openrouter/anthropic/claude-sonnet-4", workdir="~/project")
```

## Interactive Sessions (Background)

For iterative work requiring multiple exchanges, start the TUI in background:

```
terminal(command="opencode", workdir="~/project", background=true, pty=true)
# Returns session_id

# Send a prompt
process(action="submit", session_id="<id>", data="Implement OAuth refresh flow and add tests")

# Monitor progress
process(action="poll", session_id="<id>")
process(action="log", session_id="<id>")

# Send follow-up input
process(action="submit", session_id="<id>", data="Now add error handling for token expiry")

# Exit cleanly — Ctrl+C
process(action="write", session_id="<id>", data="\x03")
# Or just kill the process
process(action="kill", session_id="<id>")
```

**Important:** Do NOT use `/exit` — it is not a valid OpenCode command and will open an agent selector dialog instead. Use Ctrl+C (`\x03`) or `process(action="kill")` to exit.

### TUI Keybindings

| Key | Action |
|-----|--------|
| `Enter` | Submit message (press twice if needed) |
| `Tab` | Switch between agents (build/plan) |
| `Ctrl+P` | Open command palette |
| `Ctrl+X L` | Switch session |
| `Ctrl+X M` | Switch model |
| `Ctrl+X N` | New session |
| `Ctrl+X E` | Open editor |
| `Ctrl+C` | Exit OpenCode |

### Resuming Sessions

After exiting, OpenCode prints a session ID. Resume with:

```
terminal(command="opencode -c", workdir="~/project", background=true, pty=true)  # Continue last session
terminal(command="opencode -s ses_abc123", workdir="~/project", background=true, pty=true)  # Specific session
```

## Common Flags

| Flag | Use |
|------|-----|
| `run 'prompt'` | One-shot execution and exit |
| `--continue` / `-c` | Continue the last OpenCode session |
| `--session <id>` / `-s` | Continue a specific session |
| `--agent <name>` | Choose OpenCode agent (build or plan) |
| `--model provider/model` | Force specific model |
| `--format json` | Machine-readable output/events |
| `--file <path>` / `-f` | Attach file(s) to the message |
| `--thinking` | Show model thinking blocks |
| `--variant <level>` | Reasoning effort (high, max, minimal) |
| `--title <name>` | Name the session |
| `--attach <url>` | Connect to a running opencode server |

## Procedure

1. Verify tool readiness:
   - `terminal(command="opencode --version")`
   - `terminal(command="opencode auth list")`
2. For bounded tasks, use `opencode run '...'` (no pty needed).
3. For iterative tasks, start `opencode` with `background=true, pty=true`.
4. Monitor long tasks with `process(action="poll"|"log")`.
5. If OpenCode asks for input, respond via `process(action="submit", ...)`.
6. Exit with `process(action="write", data="\x03")` or `process(action="kill")`.
7. Summarize file changes, test results, and next steps back to user.

## PR Review Workflow

OpenCode has a built-in PR command:

```
terminal(command="opencode pr 42", workdir="~/project", pty=true)
```

Or review in a temporary clone for isolation:

```
terminal(command="REVIEW=$(mktemp -d) && git clone https://github.com/user/repo.git $REVIEW && cd $REVIEW && opencode run 'Review this PR vs main. Report bugs, security risks, test gaps, and style issues.' -f $(git diff origin/main --name-only | head -20 | tr '\n' ' ')", pty=true)
```

## Parallel Work Pattern

Use separate workdirs/worktrees to avoid collisions:

```
terminal(command="opencode run 'Fix issue #101 and commit'", workdir="~/.hermes/cache/scratch/issue-101", background=true, pty=true)
terminal(command="opencode run 'Add parser regression tests and commit'", workdir="~/.hermes/cache/scratch/issue-102", background=true, pty=true)
process(action="list")
```

## Session & Cost Management

List past sessions:

```
terminal(command="opencode session list")
```

Check token usage and costs:

```
terminal(command="opencode stats")
terminal(command="opencode stats --days 7 --models anthropic/claude-sonnet-4")
```

## Pitfalls

- Interactive `opencode` (TUI) sessions require `pty=true`. The `opencode run` command does NOT need pty.
- `/exit` is NOT a valid command — it opens an agent selector. Use Ctrl+C to exit the TUI.
- PATH mismatch can select the wrong OpenCode binary/model config.
- If OpenCode appears stuck, inspect logs before killing:
  - `process(action="log", session_id="<id>")`
- Avoid sharing one working directory across parallel OpenCode sessions.
- Enter may need to be pressed twice to submit in the TUI (once to finalize text, once to send).

## Verification

Smoke test:

```
terminal(command="opencode run 'Respond with exactly: OPENCODE_SMOKE_OK'")
```

Success criteria:
- Output includes `OPENCODE_SMOKE_OK`
- Command exits without provider/model errors
- For code tasks: expected files changed and tests pass

## Rules

1. Prefer `opencode run` for one-shot automation — it's simpler and doesn't need pty.
2. Use interactive background mode only when iteration is needed.
3. Always scope OpenCode sessions to a single repo/workdir.
4. For long tasks, provide progress updates from `process` logs.
5. Report concrete outcomes (files changed, tests, remaining risks).
6. Exit interactive sessions with Ctrl+C or kill, never `/exit`.

© Hermes Agent · MIT · NousResearch/hermes-agent

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor