🎯 OpenCode插件系列: 项目预设指南
快速选择合适的插件,适用于各种项目类型
📑 快速目录
根据你的项目类型,从下表选择相应的预设,直接复制配置:
| 预设 | 使用场景
— | — | — 1️⃣ | 大型完整项目,从零开始 | 需要从头构建完整的 product/app,预计耗时数周/数月 2️⃣ | 快速任务或简单 Bug 修复 | 有简单修改、小脚本或需要快速解决的 bug 3️⃣ | 现有项目的重构 | 修改现有 codebase、进行迁移或大规模清理 4️⃣ | 探索新项目代码库 | 刚接触新项目,想在开始前理解其结构 5️⃣ | 有 Specs 和 Plans 的规范工作 | 需要为 feature 提供正式文档、团队协作或客户交付
🚀 使用方法
每个预设都是一个 opencode.json 文件,放置在项目根目录(非全局)。
your-project/
├── opencode.json ← 放在这里
├── package.json
├── src/
└── ...
一次性设置(针对整个设备):
opencode auth login
# 选择:Google → OAuth with Google (Antigravity)
之后,你的所有项目都可以免费使用 Gemini 3 Pro 和 Claude Opus/Sonnet。
1️⃣ 预设 #1 — 大型完整项目,从零开始
📌 何时使用?
- 从头开始构建完整的 product/app
- 项目预计耗时数周或数月
- 需要所有功能:orchestration + multi-agents + 精确的编辑工具 + context management + 通知
- 示例:
🎁 包含什么?
oh-my-opencode(OmO)**: 全面的 harness,提供:opencode-google-antigravity-auth*: 免费使用 Gemini 3 Pro + Claude
📄 配置
<project-root>/opencode.json****:
{
"$schema": "<https://opencode.ai/config.json>",
"plugin": [
"oh-my-opencode",
"opencode-google-antigravity-auth"
]
}
💻 日常使用
# 在 OpenCode 内,无需复杂命令,只需输入:
ulw build a dashboard with auth and dark mode
2️⃣ 预设 #2 — 快速任务或简单 Bug 修复
📌 何时使用?
- 耗时 1-2 小时 以内的任务
- 特定的 bug fix
- 小脚本或工具
- 修改现有 component
- 不需要复杂的 orchestration 或 multi-agents
- 示例:
🎁 包含什么?
opencode-google-antigravity-auth*: 免费使用 Gemini 3 Pro@tarquinen/opencode-dcp*: 智能节省 tokens (deduplication + error pruning)@mohak34/opencode-notifier*: 任务完成或需要权限时发送通知
📄 配置
<project-root>/opencode.json****:
{
"$schema": "<https://opencode.ai/config.json>",
"plugin": [
"opencode-google-antigravity-auth",
"@tarquinen/opencode-dcp@latest",
"@mohak34/opencode-notifier@latest"
]
}
💻 日常使用
# 正常使用,无需特殊命令
opencode
3️⃣ 预设 #3 — 现有项目的重构
📌 何时使用?
- 修改现有的 codebase
- 进行迁移(从一个技术栈到另一个)
- 对旧代码进行清理
- 进行代码重组重构
- 示例:
🎁 包含什么?
oh-my-opencode(OmO)**: 对重构至关重要,因为它提供:opencode-google-antigravity-auth*: 免费使用 Gemini 3 Pro
📄 配置
<project-root>/opencode.json****:
{
"$schema": "<https://opencode.ai/config.json>",
"plugin": [
"oh-my-opencode",
"opencode-google-antigravity-auth"
]
}
💻 日常使用
ulw refactor the auth module to use composition API
4️⃣ 预设 #4 — 探索新项目代码库
📌 何时使用?
- 首次接触项目(新工作、开源贡献)
- 需要在修改前理解架构
- 项目文档不全,需要从代码生成文档
- 对旧 codebase 进行深度代码审查
- 示例:
🎁 包含什么?
oh-my-opencode* (OmO)*— 关键命令: */init-deep*- Librarian agent 和 Explore agent: 专门用于理解代码库
- Built-in MCPs: Context7 (库文档) + Grep.app (GitHub 搜索)
opencode-google-antigravity-auth*: 免费使用 Gemini 3 Pro (1M context window — 非常适合大型文件)
📄 配置
<project-root>/opencode.json****:
{
"$schema": "<https://opencode.ai/config.json>",
"plugin": [
"oh-my-opencode",
"opencode-google-antigravity-auth"
]
}
💻 日常使用
# 在新项目中的第一步:
opencode
# 在 OpenCode 内,执行以下命令:
/init-deep
# 完成后,运行:
ulw explain the architecture and main flows
5️⃣ 预设 #5 — 有 Specs 和 Plans 的规范工作
📌 何时使用?
- 与团队协作,需要统一文档
- 为客户工作,需要在实现前提供 specs
- 进行敏感任务,需要前期规划
- 喜欢结构化工作流 (Specify → Plan → Implement)
- 需要智能回滚到功能级别,而非 commit 级别
- 示例:
🎁 包含什么?
opencode-conductor-plugin*: 强制实施严格的工作流:@tarquinen/opencode-dcp*: 节省 tokens (planning 会消耗大量 context)@mohak34/opencode-notifier*: 权限和完成通知opencode-google-antigravity-auth*: 为 Conductor 使用 Gemini 3 Flash (快速且经济)
📄 配置
<project-root>/opencode.json****:
{
"$schema": "<https://opencode.ai/config.json>",
"plugin": [
"opencode-google-antigravity-auth",
"opencode-conductor-plugin",
"@tarquinen/opencode-dcp@latest",
"@mohak34/opencode-notifier@latest"
],
"agent": {
"conductor": {
"model": "google/gemini-3-flash"
}
}
}
💻 日常使用
# 每个新项目运行一次:
/conductor:setup
# 针对每个 feature 或 bug:
/conductor:newTrack "Add JWT authentication to API"
# 它会询问 3-5 个问题,然后生成 spec.md 和 plan.md
# 当 plan 准备就绪时:
/conductor:implement
# 如果需要查看进度:
/conductor:status
# 如果出现问题需要回滚:
/conductor:revert
📊 快速对比表
| 插件 | 预设 1 | 预设 2 | 预设 3 | 预设 4 | 预设 5 |
|---|---|---|---|---|---|
opencode-google-antigravity-auth |
✅ | ✅ | ✅ | ✅ | ✅ |
oh-my-opencode |
✅ | ❌ | ✅ | ✅ | ❌ |
@tarquinen/opencode-dcp |
❌ | ✅ | ❌ | ❌ | ✅ |
@mohak34/opencode-notifier |
❌ | ✅ | ❌ | ❌ | ✅ |
opencode-conductor-plugin |
❌ | ❌ | ❌ | ❌ | ✅ |