opencode 安装 superpowers 技能
软件地址: https://github.com/obra/superpowers?tab=coc-ov-file
superpowers 是 opencode 生态中最强大的工程化 ai 编程技能库,能让 ai 严格遵循 tdd(测试驱动开发)、代码规范、工程流程,输出可直接上线的工业级代码,彻底解决 ai 编码 “堆屎山” 问题。本文提供 macos/linux/windows 全平台安装、验证、使用、避坑 完整文档,可直接发布。
一、superpowers 核心介绍
1.1 是什么
- 定位:ai 编程「工程化规范引擎」,给 opencode 装上14+ 专业开发技能
- 核心能力:tdd 测试驱动、系统化调试、代码审查、分支管理、并行代理、需求澄清
- 工作原理:通过插件注入系统提示 + 技能目录链接,让 ai 自动遵守开发铁律
- 适用场景:后端 / 前端 / 小程序 / 数据库项目,追求零 bug、可维护、工程规范的开发
1.2 技能清单(14 个核心)
表格
| 类别 | 技能 | 功能 |
|---|---|---|
| 🧪 测试 | test-driven-development | 先写测试→再写代码→重构(red-green-refactor) |
| verification-before-completion | 完成前必须提供验证证据 | |
| 🐞 调试 | systematic-debugging | 四阶段调试:根因→分析→验证→修复 |
| 🤝 协作 | requesting-code-review | 主动发起代码审查 |
| receiving-code-review | 合理响应审查意见 | |
| finishing-a-development-branch | 分支合并 / pr / 丢弃规范流程 | |
| dispatching-parallel-agents | 多任务并行代理调度 | |
| brainstorming | 需求澄清、苏格拉底式对话 | |
| writing-plans | 生成精确开发计划(文件路径 + 代码 + 验证) | |
| executing-plans | 批量执行开发计划 | |
| code-structure | 项目结构规范 | |
| naming-conventions | 命名规范 | |
| error-handling | 错误处理规范 | |
| 🧩 元技能 | using-superpowers | superpowers 使用指南 |
| writing-skills | 自定义技能开发 |
二、环境准备(必看)
2.1 前提条件
- 已安装 opencode.ai(最新版)
- 已安装 git(克隆仓库用)
- windows:开启 开发者模式 或 管理员权限(创建符号链接)
2.2 安装方式(2 种)
- 方式 a(推荐・新版):
opencode.json配置自动安装(1 行配置) - 方式 b(兼容・旧版):手动克隆 + 符号链接(全平台通用)
三、方式 a:自动安装(推荐・2026 最新)
3.1 步骤 1:编辑配置文件
找到 opencode 配置文件:
- macos/linux:
~/.config/opencode/opencode.json - windows:
%userprofile%\.config\opencode\opencode.json
添加 plugin 字段(无则新增,有则追加):
{
"plugin": [
"superpowers@git+https://github.com/obra/superpowers.git"
]
}3.2 步骤 2:重启 opencode
- 完全退出 opencode(进程结束)
- 重新启动 → 自动下载、安装、注册所有技能
3.3 步骤 3:验证安装
在 opencode 聊天框输入:
tell me about your superpowers
✅ 成功:返回 superpowers 技能列表、功能说明❌ 失败:重启 opencode 或检查配置文件格式
四、方式 b:手动安装(全平台通用・旧版兼容)
4.1 macos / linux 手动安装
步骤 1:克隆 superpowers 仓库
# 克隆(已存在则更新) if [ -d ~/.config/opencode/superpowers ]; then cd ~/.config/opencode/superpowers && git pull else git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers fi
步骤 2:创建目录(不存在则新建)
mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills
步骤 3:清理旧链接(避免冲突)
rm -f ~/.config/opencode/plugins/superpowers.js rm -rf ~/.config/opencode/skills/superpowers
步骤 4:创建符号链接(核心)
# 插件链接 ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js # 技能目录链接 ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers
步骤 5:重启 opencode → 完成
4.2 windows 手动安装(cmd/powershell)
步骤 1:克隆仓库
git clone https://github.com/obra/superpowers.git %userprofile%\.config\opencode\superpowers
步骤 2:创建目录
mkdir "%userprofile%\.config\opencode\plugins" 2>nul mkdir "%userprofile%\.config\opencode\skills" 2>nul
步骤 3:清理旧链接
del "%userprofile%\.config\opencode\plugins\superpowers.js" 2>nul rmdir "%userprofile%\.config\opencode\skills\superpowers" 2>nul
步骤 4:创建链接(管理员权限)
# 插件链接 mklink "%userprofile%\.config\opencode\plugins\superpowers.js" ^ "%userprofile%\.config\opencode\superpowers\.opencode\plugins\superpowers.js" # 技能目录链接( junction,无需开发者模式) mklink /j "%userprofile%\.config\opencode\skills\superpowers" ^ "%userprofile%\.config\opencode\superpowers\skills"
步骤 5:重启 opencode → 完成
五、安装验证(必做)
5.1 命令验证
# 检查插件链接 ls -l ~/.config/opencode/plugins/superpowers.js # 检查技能链接 ls -l ~/.config/opencode/skills/superpowers
✅ 成功:显示 -> 指向 superpowers 目录
5.2 opencode 内验证
- 输入
/skills list→ 看到superpowers/xxx技能列表 - 输入
/brainstorm→ 触发需求澄清对话 - 输入
/write-plan→ 生成开发计划 - 输入
/execute-plan→ 批量执行代码
六、基础使用(3 步上手)
6.1 核心命令(斜杠快捷)
/brainstorm # 需求澄清(苏格拉底式对话) /write-plan # 生成开发计划(文件+代码+测试) /execute-plan # 执行计划(自动写代码+跑测试) /skill list # 查看所有 superpowers 技能 /skill superpowers/test-driven-development # 调用tdd技能
6.2 标准工作流(tdd)
- 需求阶段:
/brainstorm→ 明确功能、技术栈、边界 - 计划阶段:
/write-plan→ 生成精确任务清单 - 开发阶段:
/execute-plan→ ai 自动写测试→代码→重构 - 验收阶段:自动验证、代码审查、分支管理
6.3 示例:生成登录模块
# 1. 需求 /brainstorm 开发用户登录模块:手机号+密码、jwt 认证、错误处理、测试用例 # 2. 计划 /write-plan 基于上述需求,生成 tdd 开发计划 # 3. 执行 /execute-plan 按计划编写代码、单元测试、集成测试
七、常见问题 & 避坑指南
7.1 安装失败
- 问题:链接创建失败(windows)✅ 解决:以管理员身份运行 cmd/powershell
- 问题:克隆慢✅ 解决:用 gitee 镜像:
https://gitee.com/mirrors/superpowers.git - 问题:技能不显示✅ 解决:完全重启 opencode(结束进程)
7.2 使用异常
- 问题:ai 不遵守 tdd✅ 解决:开头必加
/brainstorm或/skill using-superpowers - 问题:命令无效✅ 解决:检查
/skills list是否有superpowers技能 - 问题:旧版本冲突✅ 解决:清理旧链接 → 重新安装
rm -rf ~/.config/opencode/superpowers rm -f ~/.config/opencode/plugins/superpowers.js rm -rf ~/.config/opencode/skills/superpowers
7.3 权限问题
- windows:必须管理员权限或开发者模式创建符号链接
- macos/linux:确保
~/.config/opencode目录有读写权限
八、更新与卸载
8.1 更新(手动版)
# macos/linux cd ~/.config/opencode/superpowers && git pull # windows cd %userprofile%\.config\opencode\superpowers && git pull
重启 opencode 生效
8.2 卸载
# macos/linux rm -rf ~/.config/opencode/superpowers rm -f ~/.config/opencode/plugins/superpowers.js rm -rf ~/.config/opencode/skills/superpowers # windows rmdir /s /q %userprofile%\.config\opencode\superpowers del %userprofile%\.config\opencode\plugins\superpowers.js rmdir /s /q %userprofile%\.config\opencode\skills\superpowers
九、总结
superpowers 是 opencode 必备的工程化增效插件,彻底解决 ai 编码不规范、难维护、bug 多的痛点。推荐优先用方式 a(自动安装),1 行配置搞定;windows / 旧版用方式 b(手动)。
下一步:安装后直接用 /brainstorm 启动你的第一个 tdd 项目,体验 ai 工业级编码!
🔔 本文说明
- 版本:2026.04 最新(适配 opencode 最新版)
- 平台:macos/linux/windows 全覆盖
- 来源:官方文档 + 实测验
扩展:open code教程(五)| skills 之 superpowers 安装
open code教程(五)| skills 之 superpowers 安装
官方安装方式
相关链接:https://github.com/obra/superpowers/blob/main/.opencode/install.md
// opencode.json
{
"plugin": ["superpowers@git+https://github.com/obra/superpowers.git"]
}重启 opencode 后自动安装。
为什么 windows 上用不了
bun 在 windows 上下载 git 包时存在 ssl 证书验证问题:
error: unable_to_verify_leaf_signature downloading tarball superpowers@github:obra/superpowers
macos/linux 正常,windows 失败。
windows 安装方式
安装步骤
# 1. 克隆仓库(删除旧的,重新克隆)
remove-item -path "$env:userprofile\.config\opencode\superpowers" -recurse -force -erroraction silentlycontinue
git clone --depth 1 https://github.com/obra/superpowers.git "$env:userprofile\.config\opencode\superpowers"
# 2. 创建目录(公共目录,不存在才创建)
if (-not (test-path "$env:userprofile\.config\opencode\plugins")) {
new-item -itemtype directory -path "$env:userprofile\.config\opencode\plugins" | out-null
}
if (-not (test-path "$env:userprofile\.config\opencode\skills")) {
new-item -itemtype directory -path "$env:userprofile\.config\opencode\skills" | out-null
}
# 3. 复制插件文件(直接覆盖,确保最新)
copy-item -path "$env:userprofile\.config\opencode\superpowers\.opencode\plugins\superpowers.js" -destination "$env:userprofile\.config\opencode\plugins\superpowers.js" -force
# 4. 创建链接(已存在则重建,确保指向正确)
if (test-path "$env:userprofile\.config\opencode\skills\superpowers") {
remove-item -path "$env:userprofile\.config\opencode\skills\superpowers" -force
}
new-item -itemtype junction -path "$env:userprofile\.config\opencode\skills\superpowers" -target "$env:userprofile\.config\opencode\superpowers\skills" | out-null更新
cd "$env:userprofile\.config\opencode\superpowers" git pull
卸载
# 删除插件文件 remove-item -path "$env:userprofile\.config\opencode\plugins\superpowers.js" -force -erroraction silentlycontinue # 删除 skills 链接 remove-item -path "$env:userprofile\.config\opencode\skills\superpowers" -force -erroraction silentlycontinue # 删除仓库 remove-item -path "$env:userprofile\.config\opencode\superpowers" -recurse -force -erroraction silentlycontinue
验证
重启 opencode,输入:
tell me about your superpowers
到此这篇关于opencode 安装 superpowers 完全攻略的文章就介绍到这了,更多相关opencode 安装 superpowers 内容请搜索代码网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持代码网!
到此这篇关于opencode 安装 superpowers 完全攻略的文章就介绍到这了,更多相关opencode 安装 superpowers 内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!
发表评论