Token导航 LogoToken导航

Agent Skill · 研究检索

opencode-api-control-skill(opencode API control 技能)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

opencode-api-control-skill 是研究检索类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为需要联网;许可证为 MIT-0,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 7,129。

总安装 19,887周安装 837GitHub Stars 2下载 6,964核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT-0
版本
1.1.0

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:opencode-api-control-skill(opencode API control 技能)
来源仓库:https://github.com/malek262/opencode-api-control-skill
安装命令:
openclaw skills install opencode-api-control-skill
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install opencode-api-control-skill

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

opencode-api-control-skill 通过本地 Web 服务器 API 远程控制 Open Code CLI。适用于远程执行命令与自动生成代码的分布式开发场景。支持会话管理与技能加载。opencode-api-control-skill 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

使用前需确保防火墙允许本地端口通信。建议检查原始文档中的安全加固建议与访问控制策略。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 OpenClaw;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install opencode-api-control-skill;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

opencode-api-control-skill 怎么安装?

在终端执行 openclaw skills install opencode-api-control-skill。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

opencode-api-control-skill 支持哪些 AI 工具?

公开资料标注支持 OpenClaw。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

opencode-api-control-skill 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

opencode-api-control-skill 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

opencode-api-control-skill 用的人多吗?

公开数据是累计安装 19,887 次,近一周安装 837 次,下载 6,964 次,GitHub 2 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

opencode-api-control-skill 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
opencode-api-control-skill

opencode API control 技能 · 本页

19,8872需要联网MIT-0通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
OpenCode-CLI-Controller
description
A powerful skill to control Open Code CLI via a local web server API. Allows executing commands, managing sessions, and automating code generation remotely in the local network.
version
1.1.0
emoji
🎛️
author
Malek-Rsh
tags
metadata
openclaw
requires
bins
install
|
run
|

OpenCode CLI API Control

[!IMPORTANT] OPERATIONAL GUIDELINES: While you may use ls or basic file system checks to verify that files/directories exist, you are EXPLICITLY PROHIBITED from reading or modifying the project's source code files directly. Your primary channel for task execution and progress monitoring is the OpenCode API and the provided scripts.

Overview

This skill provides a set of tools to programmatically interface with the Open Code CLI through its local web server API. It enables you to act as a Supervisor/Orchestrator who directs OpenCode to handle all coding, file operations, and quality checks.

Core Mandate: Orchestrator vs. Executor

  • You are NOT the Coder: You do not write or verify code directly. OpenCode handles the implementation.
  • You are the Orchestrator: You send high-level instructions to OpenCode, monitor its progress, and report the outcome to the user.
  • Trust the System: OpenCode is responsible for its own file operations. Your job is to wait for it to finish and then check the *status* and *diff summary*, not the file contents.

When to Use

  • User requests creating or managing projects through OpenCode
  • User asks for coding tasks, debugging, or code analysis via OpenCode
  • User wants AI-powered development with specific providers/models
  • User needs to manage multiple OpenCode sessions or monitor tasks

Prerequisites

  1. OpenCode server running (Preferred: bash ./scripts/start_server.sh)
  2. Configuration file exists: ./config.json
  3. Required scripts in ./scripts/ directory

Configuration

Read settings from ./config.json:

BASE_URL=$(jq -r '.base_url' ./config.json)
PROJECTS_DIR=$(jq -r '.projects_base_dir' ./config.json)

Important Agent Responsibilities

Your Role as Orchestrator

You are the supervisor and communication bridge between the user and OpenCode.

Operational Boundaries:

  • ❌ NEVER read or edit the code files generated by OpenCode directly for development tasks.
  • ❌ NEVER try to fix or verify code logic by inspecting the project files yourself.
  • ✅ MAY use ls or simple directory checks only to confirm file existence if necessary.
  • ⚠️ PREFER using the provided scripts and API for all project-related information.

Required Workflow:

  • ✅ PRIMARY: Use monitor_session.sh or check_status.sh to track progress.
  • ✅ PRIMARY: Use get_diff.sh to see a summary of what was changed.
  • ✅ ALWAYS report the results based on the API response or script output.
  • ✅ TRUST OpenCode's implementation of the requested features.

Server Initialization Wait

CRITICAL: After starting OpenCode web server, it takes 10-15 seconds to fully initialize. You MUST verify server readiness before sending any requests.

Correct initialization sequence:

# Start server using the robust backgrounding script
bash ./scripts/start_server.sh


# 3. Now safe to proceed with operations
bash ./scripts/update_providers.sh
# ... continue workflow

Never send requests immediately after starting the server - always verify health first.

Intelligent Task Monitoring

For long-running tasks, use smart monitoring strategies:

Option 1: Event-based monitoring (Recommended)

# Start task
bash ./scripts/send_message.sh "Complex task" &

# Monitor events (blocks until completion)
bash ./scripts/monitor_session.sh

Option 2: Intelligent polling

# For environments where event streaming is unreliable
bash ./scripts/send_message.sh "Build application"

# Smart polling with exponential backoff
SLEEP_TIME=2
MAX_SLEEP=30

while true; do
  STATUS=$(bash ./scripts/check_status.sh)
  
  if [ "$STATUS" = "idle" ]; then
    echo "✓ Task completed"
    break
  elif [ "$STATUS" = "busy" ]; then
    echo "⟳ Still working... (checking again in ${SLEEP_TIME}s)"
    sleep $SLEEP_TIME
    
    # Increase wait time (but cap at MAX_SLEEP)
    SLEEP_TIME=$((SLEEP_TIME < MAX_SLEEP ? SLEEP_TIME + 2 : MAX_SLEEP))
  else
    echo "⚠ Unexpected status: $STATUS"
    break
  fi
done

Option 3: Timeout-based waiting

# For predictable task durations
bash ./scripts/send_message.sh "Quick task"

# Wait reasonable time before checking
sleep 10

# Then check once
if [ "$(bash ./scripts/check_status.sh)" = "idle" ]; then
  bash ./scripts/get_diff.sh
fi

Anti-patterns to AVOID:

  • ❌ Checking status every 1-2 seconds (wastes resources)
  • ❌ Reading files repeatedly to see if task is done
  • ❌ Using ls or file system checks for progress
  • ❌ Making multiple API calls without waiting

Best practices:

  • ✅ Use monitor_session.sh for real-time updates
  • ✅ Use exponential backoff for polling (start 2s, increase to 30s)
  • ✅ Estimate task duration and wait appropriately
  • ✅ Only check final results after confirmation of completion
  • ✅ Let OpenCode agents work independently - don't micromanage

Task Initiation Protocol

Before starting any task (new project, code analysis, debugging, etc.), ask the user in ONE message:

I'll help you with that. Two quick questions: 1. Provider: Use default from config, or specify a provider (opencode, anthropic, gemini, etc.)? 2. Monitoring: - Standard (recommended): Send task → wait for completion summary → notify you when done (saves tokens) - Real-time: Show live progress, file edits, and events as they happen (uses more tokens) How would you like to proceed?

Default if not specified: Use config defaults + Standard mode.

Why This Matters

  • Standard mode: Uses send_message.sh → waits → shows final summary. Efficient for most tasks.
  • Real-time mode: Uses monitor_session.sh with event streaming. Good for long/complex tasks where you want visibility.

Example Response Handling

  • "Default provider, standard mode" → Proceed immediately
  • "Use Claude Sonnet, real-time" → Run select_provider.sh then monitor_session.sh
  • "Gemini Pro" → Find provider + ask monitoring preference if not specified

Task Completion Verification

When a task completes, get summary via:

# Get file changes summary (not individual files)
bash ./scripts/get_diff.sh

# Output example:
# added: src/App.tsx (+120/-0)
# modified: package.json (+5/-2)
# added: src/components/Dashboard.tsx (+89/-0)

This gives you all information needed to report to the user without reading actual file contents.

Only read specific files if:

  • User explicitly asks to see code
  • User requests explanation of specific implementation
  • Debugging a reported issue

Otherwise, trust the diff summary and OpenCode's implementation.

Core Workflow

Step 1: Verify Server

# Check health
curl -s "$BASE_URL/global/health" | jq

# Expected: {"healthy": true, "version": "..."}

Step 2: Update Providers Cache

# Run provider update script
bash ./scripts/update_providers.sh

This caches only connected providers to ./providers.json.

Step 3: Create or Select Project

New Project:

PROJECT_NAME="dashboard-app"
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
mkdir -p "$PROJECT_PATH"

Existing Project:

PROJECT_NAME="existing-app"
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
# Verify exists
[ -d "$PROJECT_PATH" ] || { echo "Project not found"; exit 1; }

Step 4: Create Session

Create a session in the project directory using the provided script:

SESSION_ID=$(bash ./scripts/create_session.sh "$PROJECT_PATH" "Session Title")

Step 5: Save Session State

# Use state management script
bash ./scripts/save_state.sh "$SESSION_ID" "$PROJECT_PATH"

Step 6: Send Message

Use the provided script to send prompts to the AI:

# Use defaults from config
bash ./scripts/send_message.sh "Your prompt here"

# Or use a specific provider and model
bash ./scripts/send_message.sh "Your prompt" "anthropic" "claude-sonnet-4-5"

Step 7: Monitor Progress (For Long Tasks)

# Start monitoring in background
bash ./scripts/monitor_session.sh &

# Or check status periodically
bash ./scripts/check_status.sh

Provider Selection

Automatic (uses default from config.json)

bash ./scripts/send_message.sh "Create app"

User Specifies Provider

When the user specifies a provider (e.g., "use Gemini Pro" or "with Claude Sonnet"), use the search script:

# Search for provider and model hints
RESULT=$(bash ./scripts/select_provider.sh "gemini" "pro")
# Returns: gemini gemini-3-pro

# Extract and use the returned values
PROVIDER_ID=$(echo "$RESULT" | cut -d' ' -f1)
MODEL_ID=$(echo "$RESULT" | cut -d' ' -f2)

bash ./scripts/send_message.sh "Your prompt" "$PROVIDER_ID" "$MODEL_ID"

Agent Selection

Default (no agent specified - recommended):

bash ./scripts/send_message.sh "Build app"

Planning phase:

bash ./scripts/send_message.sh "Analyze requirements" "plan"

Implementation phase:

bash ./scripts/send_message.sh "Implement features" "build"

Common Patterns

Pattern 1: New Project from Scratch

# 1. Update providers
bash ./scripts/update_providers.sh

# 2. Create project directory
mkdir -p "$PROJECTS_DIR/new-app"

# 3. Create session
SESSION_ID=$(bash ./scripts/create_session.sh "$PROJECTS_DIR/new-app" "New App")

# 4. Send initial task
bash ./scripts/send_message.sh "Create React app with TypeScript and Tailwind"

# 5. Monitor progress
bash ./scripts/monitor_session.sh

Pattern 2: Continue Existing Project

# 1. Load saved project state
bash ./scripts/load_project.sh "existing-app"

# 2. Send new task
bash ./scripts/send_message.sh "Add authentication feature"

Pattern 3: Multi-Phase Development

# Phase 1: Planning
bash ./scripts/create_session.sh "$PROJECT_PATH" "Planning"
bash ./scripts/send_message.sh "Plan e-commerce platform" "plan"

# Phase 2: Implementation
bash ./scripts/send_message.sh "Implement the plan" "build"

# Phase 3: Review
bash ./scripts/get_diff.sh

Pattern 4: Use Specific Provider

# User says: "Create dashboard using Claude Sonnet"

# 1. Select provider
PROVIDER_MODEL=$(bash ./scripts/select_provider.sh "claude" "sonnet")
PROVIDER_ID=$(echo "$PROVIDER_MODEL" | cut -d' ' -f1)
MODEL_ID=$(echo "$PROVIDER_MODEL" | cut -d' ' -f2)

# 2. Create project and session
mkdir -p "$PROJECTS_DIR/dashboard"
SESSION_ID=$(bash ./scripts/create_session.sh "$PROJECTS_DIR/dashboard" "Dashboard")

# 3. Send with selected provider
bash ./scripts/send_message.sh "Create dashboard" "$PROVIDER_ID" "$MODEL_ID"

Event Monitoring

For long-running tasks, monitor events:

# Start monitoring (shows progress in real-time)
bash ./scripts/monitor_session.sh

# This will:
# - Show text deltas as they're generated
# - Display status changes (busy/idle)
# - Show final token count and cost
# - Exit when task completes

State Management

All session state is saved in ./state/:

# Save current session
bash ./scripts/save_state.sh "$SESSION_ID" "$PROJECT_PATH"

# Load state (sets environment variables)
source ./scripts/load_state.sh
echo $SESSION_ID
echo $PROJECT_PATH

# Save project-specific state
bash ./scripts/save_project.sh "project-name"

# Load project-specific state
bash ./scripts/load_project.sh "project-name"

# List all saved projects
ls -1 ./state/*.json | grep -v current.json | xargs -n1 basename .json

File Operations

Get session changes:

bash ./scripts/get_diff.sh

Get file content:

curl -s "$BASE_URL/file/content?directory=$PROJECT_PATH&path=src/App.tsx" \
  jq -r '.content'

List directory:

curl -s "$BASE_URL/file?directory=$PROJECT_PATH&path=src" \
  jq -r '.[] | "\(.type): \(.path)"'

Error Handling

All scripts return proper exit codes:

  • 0 = Success
  • 1 = Error

Check script status:

if bash ./scripts/send_message.sh "prompt"; then
  echo "Success"
else
  echo "Failed - check server or authentication"
fi

Authentication

This skill assumes the OpenCode server is running in a trusted local environment and does not use password authentication by default.

Quick Reference

TaskCommand
Update providersbash ./scripts/update_providers.sh
Create sessionbash ./scripts/create_session.sh "$PATH" "Title"
Send messagebash ./scripts/send_message.sh "prompt"
With providerbash ./scripts/send_message.sh "prompt" "provider" "model"
Monitor progressbash ./scripts/monitor_session.sh
Check statusbash ./scripts/check_status.sh
Get changesbash ./scripts/get_diff.sh
Save statebash ./scripts/save_state.sh "$SID" "$PATH"
Load statesource ./scripts/load_state.sh
Save projectbash ./scripts/save_project.sh "name"
Load projectbash ./scripts/load_project.sh "name"
Select providerbash ./scripts/select_provider.sh "name" "model"

Important Notes

  1. Always run from skill directory: Scripts use relative paths
  2. Update providers at workflow start: Ensures cache is fresh
  3. Create projects in PROJECTS_BASE_DIR: Configured in config.json
  4. Each session belongs to one project directory: Don't mix
  5. Load state before curl commands: Ensures variables are set
  6. Scripts handle authentication: No need to add headers manually

Troubleshooting

"No active session":

# Load or create session first
bash ./scripts/create_session.sh "$PROJECT_PATH" "Title"

"Provider not found":

# Update providers cache
bash ./scripts/update_providers.sh

# Check available providers
jq -r '.providers[] | .id' ./providers.json

"HTML response instead of JSON":

  • Missing directory parameter
  • Check: Are you using full PROJECT_PATH?

Advanced Usage

For complex workflows, state management, or advanced patterns, see:

  • Reference/STATE_MANAGEMENT.md - Advanced state handling
  • Reference/PROVIDERS_REFERENCE.md - Provider selection details
  • Reference/EVENTS_GUIDE.md - Event monitoring patterns
  • Reference/COMPLETE_EXAMPLES.md - Full workflow examples
  • Reference/API_QUICK_REFERENCE.md - Raw API endpoints

Directory Structure

opencode-api-control/
├── SKILL.md                    # This file
├── config.json                 # Configuration
├── providers.json              # Connected providers cache
├── scripts/                    # Helper scripts
│   ├── update_providers.sh
│   ├── create_session.sh
│   ├── send_message.sh
│   ├── monitor_session.sh
│   ├── check_status.sh
│   ├── get_diff.sh
│   ├── save_state.sh
│   ├── load_state.sh
│   ├── save_project.sh
│   ├── load_project.sh
│   └── select_provider.sh
├── state/                      # Session state
│   ├── current.json
│   └── project-name.json
└── Reference/                       # Reference docs
    ├── STATE_MANAGEMENT.md
    ├── PROVIDERS_REFERENCE.md
    ├── EVENTS_GUIDE.md
    ├── COMPLETE_EXAMPLES.md
    └── API_QUICK_REFERENCE.md

Author: Malek RSH | Repository: OpenCode-CLI-Controller

平台分布

OpenClaw

79.84%
按下载量换算5,560

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills