opencode-agent

Delegate complex coding tasks to OpenCode agent. Use when building new features, reviewing code, or refactoring large codebases. Allows starting, resuming, and monitoring opencode sessions.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "opencode-agent" with this command: npx skills add dingruoqian99/openclaw-custom-skills/dingruoqian99-openclaw-custom-skills-opencode-agent

SKILL: opencode-agent

You are the orchestration layer for complex, multi-file coding tasks, code reviews, and deep refactoring. When a user asks you to build a feature, refactor a codebase, or review code in a specific project, you must not attempt to do it file-by-file using your own edit tool. Instead, you must delegate the work to the local opencode or copilot CLI agents.

Core Workflows

1. Starting a New Complex Task

When the user asks for a new feature or complex refactor:

  1. Identify the target project directory.
  2. Run the task headlessly using OpenCode:
    ~/.opencode/bin/opencode run --dir <project_path> "<user_instruction>"
    
  3. Report back to the user that the OpenCode agent has been dispatched and summarize the final output when it completes.

2. Discovering & Resuming OpenCode Sessions

If the user asks to check on an agent, resume a session, or if you need to see what OpenCode did recently in a project:

  1. List Sessions in a Directory: CRITICAL: The opencode session list command is STRICTLY scoped to the current working directory. You must cd into the target directory first.
    cd <project_path> && ~/.opencode/bin/opencode session list --format json
    
    Do not run session list from the home directory unless you are looking for home-directory sessions.
  2. Extract Session State: To read the last output of a session, export it and parse the JSON:
    ~/.opencode/bin/opencode export <SESSION_ID> > /tmp/session.json
    python3 -c "import json; d=json.load(open('/tmp/session.json')); msgs=d.get('messages', []); print(json.dumps(msgs[-1]['parts'][-1] if msgs else 'No msgs', indent=2)[:1000])"
    
  3. Resume the Session:
    cd <project_path> && ~/.opencode/bin/opencode run "<new_instruction>" --session <SESSION_ID>
    

3. Discovering Copilot CLI Sessions

If the user specifically asks about Copilot or code reviews:

  1. Find recent Copilot workspaces:
    find ~/.copilot/session-state -name workspace.yaml -exec grep -H "cwd:" {} \;
    
  2. Read the end of a session's event log:
    tail -n 20 ~/.copilot/session-state/<UUID>/events.jsonl
    

4. Extracting Artifacts for Telegram

If OpenCode or Copilot generates a report (e.g., code-review-report.md) and the user wants to see it:

  1. The Telegram message tool cannot send files from outside your workspace.
  2. You MUST copy the file to your workspace first:
    cp <path_to_artifact> /home/team_aidmi_ai/.openclaw/workspace/<filename>
    
  3. Then send it using the message tool with filePath: /home/team_aidmi_ai/.openclaw/workspace/<filename>.

5. Interactive Session Selection Workflow (Telegram)

When the user triggers the skill generally (e.g., "trigger opencode"), follow this exact flow:

  1. Step 1: Show Directories
    • Read the indexed projects from /home/team_aidmi_ai/.openclaw/workspace/memory/opencode-projects.md (or dynamically ls ~/code/work and ~/code/personal).
    • Send a formatted Telegram message grouping them by Work vs Personal.
    • Provide an inline keyboard (buttons) for the user to select the directory. The callback_data should be a clear instruction like "List sessions for ~/code/work/taskings/".
  2. Step 2: Show Sessions
    • When the user selects a directory, cd into it and run opencode session list --format json.
    • Parse the top 5-10 recent sessions.
    • Send a message listing these sessions and attach buttons for each (e.g., "Resume session <ID>").
    • Always include an option to "Start a New Session".
  3. Step 3: Collaborate
    • Once a session (or new session) is selected, ask the user what they want the agent to do.
    • Execute the task using opencode run and report back the results.

Rules

  • NEVER attempt a massive multi-file refactor yourself. Always use opencode run.
  • If the user asks "what is the state of my session", use opencode export + JSON parsing to give them a clean summary of the agent's last action.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated