Skip to content

OpenCode 安装指南

前置要求

安装步骤

方式一:让 OpenCode 自动安装(推荐)

在 OpenCode 中输入:

Clone https://github.com/obra/superpowers to ~/.config/opencode/superpowers, then create directory ~/.config/opencode/plugins, then symlink ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js to ~/.config/opencode/plugins/superpowers.js, then symlink ~/.config/opencode/superpowers/skills to ~/.config/opencode/skills/superpowers, then restart opencode.

方式二:手动安装(macOS / Linux)

bash
# 1. 克隆仓库
git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers

# 2. 创建目录
mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills

# 3. 创建插件符号链接
ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js

# 4. 创建技能符号链接
ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers

# 5. 重启 OpenCode

手动安装(Windows PowerShell)

前置条件: 需要开启开发者模式或以管理员身份运行

powershell
# 1. 克隆仓库
git clone https://github.com/obra/superpowers.git "$env:USERPROFILE\.config\opencode\superpowers"

# 2. 创建目录
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\plugins"
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\skills"

# 3. 创建插件符号链接(需要管理员权限或开发者模式)
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.config\opencode\plugins\superpowers.js" -Target "$env:USERPROFILE\.config\opencode\superpowers\.opencode\plugins\superpowers.js"

# 4. 创建技能目录连接(无需特殊权限)
New-Item -ItemType Junction -Path "$env:USERPROFILE\.config\opencode\skills\superpowers" -Target "$env:USERPROFILE\.config\opencode\superpowers\skills"

# 5. 重启 OpenCode

工作原理

OpenCode 有原生技能发现功能,启动时扫描以下位置:

  1. 项目技能 (.opencode/skills/) - 最高优先级
  2. 个人技能 (~/.config/opencode/skills/)
  3. Superpowers 技能 (~/.config/opencode/skills/superpowers/) - 通过符号链接

插件会自动注入 Superpowers 上下文到系统提示中。

验证安装

macOS / Linux:

bash
ls -l ~/.config/opencode/plugins/superpowers.js
ls -l ~/.config/opencode/skills/superpowers

Windows:

powershell
Get-ChildItem "$env:USERPROFILE\.config\opencode\plugins" | Where-Object { $_.LinkType }
Get-ChildItem "$env:USERPROFILE\.config\opencode\skills" | Where-Object { $_.LinkType }

或询问 OpenCode:"do you have superpowers?"

使用方法

查看可用技能

use skill tool to list skills

加载特定技能

use skill tool to load superpowers/brainstorming

配置文件位置

  • Superpowers 目录:~/.config/opencode/superpowers/
  • 插件链接:~/.config/opencode/plugins/superpowers.js
  • 技能链接:~/.config/opencode/skills/superpowers/
  • 个人技能:~/.config/opencode/skills/
  • 项目技能:.opencode/skills/

更新

bash
cd ~/.config/opencode/superpowers && git pull

重启 OpenCode 加载更新。

常见问题

插件未加载

  1. 检查插件符号链接是否正确
  2. 检查源文件是否存在:ls ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js
  3. 重启 OpenCode

技能未发现

  1. 检查技能符号链接:ls -l ~/.config/opencode/skills/superpowers
  2. 使用 skill 工具列出可用技能

Windows 权限问题

  • 开启开发者模式:设置 → 更新和安全 → 开发者选项
  • 或以管理员身份运行终端

工具映射

当技能引用 Claude Code 工具时:

  • TodoWritetodowrite
  • Task 子代理 → OpenCode 的 @mention 语法
  • Skill 工具 → OpenCode 原生 skill 工具