Wang Lei

OpenCode AI

開発v1.2.2
作者:Wang Lei更新日 2026-05-11全 5 バージョン · 最新版の公開日 2026-04-16opencode@clawhub_csuwl/opencode
コード生成コードレビュースクリプトツール#Coding

AlphaMoatによると、2026-09時点でOpenCode AIのダウンロード数は4,493、スター数は4で、AIスキル全体5,078件中2,146位、開発では577件中271位です。

インストール数
124
ダウンロード数
4493
スター数
4
総合順位
#2,146
全体の上位 43% · 開発の上位 47%
プラットフォームインストール数ダウンロード数スター数コメント
ClawHub ↗12444934-
SkillHub ↗12244484—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

AI 支援コーディング、複雑なリファクタリング、PR のレビューや修正、複数ファイル編集、セッション型のコーディングを想定しています。単純な一行編集やファイル読み取りには基本ツールを使うよう、ソースで明示されています。 添付コードは設定された AI サービスへ送られる場合があります。提供元設定と導入先を確認し、ネットワーク公開時はアクセスを保護してください。

資料公開日 2026-10-29

できること

  • ターミナルで AI 支援のコーディング作業を行う
  • 複雑なリファクタリングや複数ファイルの変更に取り組む
  • GitHub PR をレビューまたは修正する

使う場面

  • リポジトリの文脈、複数ファイル編集、複雑なリファクタリング、PR レビューが必要なとき

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

複数ファイルにわたる変更計画を分析し、確認するファイルと手順を挙げてください。まだ編集はしないでください。

月次の推移

ダウンロード数4493
1836326346902026-03 · ダウンロード数 20332026-05 · ダウンロード数 32412026-06 · ダウンロード数 35292026-07 · ダウンロード数 40802026-08 · ダウンロード数 43542026-09 · ダウンロード数 449326-0326-09
スター数4
3442026-03 · スター数 32026-05 · スター数 42026-06 · スター数 42026-07 · スター数 42026-08 · スター数 42026-09 · スター数 426-0326-09

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。

月ダウンロード数前月比スター数
2026-094493—4
2026-084354+6.7%4
2026-074080+15.6%4
2026-063529+8.9%4
2026-053241—4
2026-032033—3

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 2026-10-23。

6.7 KB・ClawHub v1.2.2
---
name: opencode
description: "OpenCode AI - AI-driven code editor/IDE (CLI/TUI version of Cursor/Windsurf). Use when: (1) AI-assisted coding tasks, (2) Code refactoring with AI, (3) GitHub PR review/fixes, (4) Multi-file edits requiring context, (5) Running AI agents on codebases. NOT for: simple one-line edits (use edit tool), reading files (use read tool)."
metadata:
  openclaw:
    emoji: "🤖"
    requires:
      bins:
        - opencode
---
すべて表示(全 230 行)

# OpenCode AI - AI Code Editor

OpenCode is an AI-native code editor that runs in your terminal (CLI/TUI). Think Cursor/Windsurf but in the terminal.

**Version**: 1.3.9 | **Platform**: macOS Darwin x64

## Prerequisites

OpenCode requires `sysctl` for architecture detection. Ensure `/usr/sbin` is in PATH:

```bash
export PATH="/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
# Add to ~/.zshrc for permanence
```

---

## When to Use

✅ **Use for:** Complex refactoring, AI-assisted features, PR review/fixes, codebase exploration, multi-file edits, session-based coding
❌ **Don't use for:** Simple one-line edits (use `edit` tool), reading files (use `read` tool)

---

## Core Commands

### Quick Tasks (One-Shot)

```bash
# Run a single task
opencode run "Add input validation to the login form"
opencode run --dir ~/project "Refactor to use async/await"
opencode run -m anthropic/claude-sonnet-4 "Optimize queries"

# Attach files for context
opencode run -f src/auth.js -f src/db.js "Fix the auth bug"

# Continue previous session
opencode run --continue
opencode run --session abc123 --fork

# Share session (creates shareable link)
opencode run --share "Implement feature X"

# Model variant (reasoning effort)
opencode run --variant high "Solve this complex problem"
```

### Key Options

| Option | Description |
|--------|-------------|
| `-m, --model` | Model (`provider/model`, e.g. `anthropic/claude-sonnet-4`) |
| `-c, --continue` | Continue last session |
| `-s, --session` | Continue specific session |
| `--fork` | Fork session when continuing |
| `--share` | Share the session |
| `-f, --file` | Attach files to message |
| `--agent` | Use specific agent |
| `--dir` | Directory to run in |
| `--format` | Output format: `default` or `json` |
| `--variant` | Reasoning effort: `high`, `max`, `minimal` |
| `--thinking` | Show thinking blocks |
| `--title` | Set session title |
| `--attach` | Attach to running server (e.g. `http://localhost:4096`) |
| `--pure` | Run without external plugins |
| `--command` | Run a specific command (use message for args) |
| `-p, --password` | Basic auth password for server mode |

### Interactive TUI

```bash
opencode              # Start in current directory
opencode ~/project    # Start in specific project
```

#### TUI Slash Commands

- `/sessions` — Session selector (continue existing or create new)
- `/agents` — Switch agent (see agents below)
- `/models` — Model selector
- `/title` — Change session title
- `/summary` — Generate session summary
- `/compaction` — Compact conversation history

#### Available Agents

| Agent | Type | Purpose |
|-------|------|---------|
| **plan** | primary | Analyze & design (no code edits) |
| **build** | primary | Implement & code |
| **explore** | subagent | Understand codebase, read-only exploration |
| **general** | subagent | General assistance |
| **compaction** | primary | Compress/summarize session context |
| **summary** | primary | Generate session summaries |
| **title** | primary | Generate session titles |
| **memory-automation** | subagent | Automated memory management |
| **memory-consolidate** | subagent | Consolidate memory entries |

> ⚠️ `--agent` flag in `opencode run` always falls back to default agent. Agent switching only works in TUI via `/agents` slash command.

#### Recommended Workflow: Plan → Build

1. Select **plan** agent (`/agents`)
2. Describe task → review/approve the plan
3. Switch to **build** agent (`/agents`)
4. Implement → iterate

---

## Other Commands

```bash
# Providers & Auth
opencode providers              # Manage AI providers/credentials (alias: auth)
opencode providers login [url] # Login to a provider

# Models
opencode models                 # List all models
opencode models --verbose       # With cost info
opencode models --refresh       # Refresh cache

# Sessions
opencode session list            # List sessions
opencode export [sessionID]      # Export as JSON
opencode import <file>           # Import session

# GitHub
opencode pr 123                  # Checkout PR + run OpenCode
opencode github --help           # GitHub agent options

# MCP Servers
opencode mcp list                # List MCP servers
opencode mcp add                 # Add MCP server
opencode mcp auth [name]         # OAuth for MCP server

# Agents
opencode agent list              # List agents
opencode agent create            # Create custom agent

# Plugins
opencode plugin <module>        # Install plugin (alias: plug)

# Server Mode
opencode serve                   # Headless server
opencode web                     # Server + open browser

# ACP (Agent Client Protocol)
opencode acp                     # Start ACP server

# Attach to Remote
opencode attach <url>            # Attach to running instance

# Utilities
opencode stats                   # Token usage & costs
opencode debug                   # Debug/troubleshooting tools
opencode upgrade [target]       # Upgrade opencode
opencode uninstall               # Remove opencode
opencode db                      # Database tools
```

---

## Integration with OpenClaw

**You are the orchestrator. OpenCode is your worker.**

### When to Delegate
- Multi-file refactoring
- Complex feature implementation
- PR review and fixes
- Code exploration requiring sustained context

### When to Do It Yourself
- Simple one-line edits
- Reading files
- Quick commands

### Pattern: Delegate via exec

```bash
# Simple task (foreground, wait for result)
opencode run "Add error handling to auth module"

# Complex task (background, check later)
# Use exec with background:true

# With file context
opencode run -f src/auth.js -f src/db.js "Fix the auth bug"

# Continue previous work
opencode run --continue
```

### Multi-Agent Pattern

```bash
# Agent 1: Analyze
opencode run --session analyze "Explore codebase structure"
# Agent 2: Implement
opencode run --session implement "Implement feature based on analysis"
# Agent 3: Test
opencode run --session test "Write tests for the implementation"
```

---

## Troubleshooting

| Problem | Solution |
|---------|----------|
| `sysctl not found` | `export PATH="/usr/sbin:/usr/bin:/sbin:/bin:$PATH"` |
| `Failed to change directory` | Use `--version` or `run` subcommand explicitly |
| Freezes/hangs | `Ctrl+C` to exit; use `run` mode for non-interactive tasks |
| Permission denied | `chmod +w ./path/to/file` |

---

*Last updated: 2026-04-16 | OpenCode v1.3.9*

開発の人気スキル

データ月:2026-09 · ダウンロード数、スター数、インストール数は公開スキルレジストリ(ClawHub、SkillHub)から月単位で集計しています。詳しくはデータの方法論をご覧ください。