opencode-config by igorwarzocha/opencode-workflows
npx skills add https://github.com/igorwarzocha/opencode-workflows --skill opencode-config帮助用户通过引导式设置配置文件和规则来配置 OpenCode。
<question_tool>
批处理规则: 仅用于 2 个及以上相关问题;单个问题使用纯文本。
语法约束: 标题最多 12 个字符,标签 1-5 个单词,用 (Recommended) 标记默认值。
目的: 明确配置范围(模型/权限/规则),验证方法,并处理多个有效选项。
</question_tool>
| 类型 | 全局 | 项目 |
|---|---|---|
| 配置 | ~/.config/opencode/opencode.json | ./opencode.json |
| 规则 | ~/.config/opencode/AGENTS.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
./AGENTS.md |
优先级: 项目 > 全局。配置是合并的,而非替换。
批处理: 对 2 个及以上相关问题使用 question 工具。单个问题 → 纯文本。
语法: header ≤12 个字符,label 1-5 个单词,为默认值添加 "(Recommended)"。
何时询问:请求模糊(如"配置 opencode")、权限/安全变更,或存在多个有效选项时。
询问用户想要配置什么:
然后引导他们完成下面的相关部分。
<config_file>
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"theme": "opencode",
"autoupdate": true
}
| 选项 | 目的 | 示例 |
|---|---|---|
model | 默认模型 | "anthropic/claude-sonnet-4-20250514" |
small_model | 轻量级任务 | "anthropic/claude-3-5-haiku-20241022" |
theme | UI 主题 | "opencode", "catppuccin", "dracula" |
autoupdate | 自动更新 OpenCode | true / false |
share | 会话共享 | "manual" / "auto" / "disabled" |
使用 permission 字段控制需要批准的操作。
{
"permission": {
"edit": "allow", // "allow" | "ask" | "deny"
"bash": {
"npm *": "allow", // 模式匹配
"git *": "allow",
"rm *": "ask",
"*": "ask" // 此工具的默认值
},
"webfetch": "allow",
"skill": {
"*": "allow",
"dangerous-*": "deny"
}
}
}
代理有时可能需要处理使用过时配置字段(例如 tools、maxSteps)的旧项目。遇到此类情况时,您必须将其更正为现代的 permission 和 steps 字段。
包含额外的说明文件:
{
"instructions": [
"CONTRIBUTING.md",
"docs/guidelines.md",
".cursor/rules/*.md"
]
}
完整模式参考: 参见 references/config-schema.md
</config_file>
<rules_file>
适用于所有代理的项目说明。类似于 CLAUDE.md 或 Cursor 规则。
在 OpenCode 中运行 /init 以基于项目分析自动生成。
# 项目名称
这是一个使用 [语言] 的 [框架] 项目。
## 项目结构
- `src/` - 源代码
- `tests/` - 测试文件
## 代码标准
- 使用 TypeScript 严格模式
- 优先使用函数式模式
- 为所有功能编写测试
## 命令
- `npm run build` - 构建项目
- `npm test` - 运行测试
</rules_file>
<config_tips>
OpenCode 支持 JSONC(带注释的 JSON)。应该注释掉未使用的配置,而不是删除:
{
"plugin": [
"opencode-openai-codex-auth@latest",
//"@tarquinen/opencode-dcp@latest", // 暂时禁用
//"@howaboua/pickle-thinker@0.4.0", // 仅用于 GLM-4.6
"@ramtinj95/opencode-tokenscope@latest"
]
}
原因: 您以后可能想重新启用。保留您尝试过的记录。
编辑 opencode.json 后,您必须运行此验证(不仅仅是建议):
opencode run "test"
在告诉用户更改完成之前,请自行使用 Bash 工具执行它。
如果配置损坏,您将看到带有行号的清晰错误:
Error: Config file at ~/.config/opencode/opencode.json is not valid JSON(C):
--- Errors ---
CommaExpected at line 464, column 5
Line 464: "explore": {
^
--- End ---
常见的 JSONC 错误:
} 前的尾随逗号</config_tips>
<common_configurations>
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"permission": {
"edit": "ask",
"bash": "ask"
}
}
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"autoupdate": true,
"permission": {
"edit": "allow",
"bash": {
"*": "allow",
"rm -rf *": "deny",
"sudo *": "ask"
}
},
"instructions": ["CONTRIBUTING.md"]
}
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"share": "auto",
"instructions": [
"docs/development.md",
"docs/api-guidelines.md"
]
}
</common_configurations>
| 问题 | 解决方案 |
|---|---|
| 配置未加载 | 检查 JSON 语法,确保路径有效 |
| 未找到技能 | 验证 SKILL.md(大写),检查 frontmatter |
| 意外权限被拒 | 检查全局与项目配置的优先级 |
references/config-schema.md - 完整的配置选项每周安装数
73
仓库
GitHub 星标数
97
首次出现
2026年1月24日
安全审计
安装于
opencode71
gemini-cli62
codex59
github-copilot55
cursor52
kimi-cli49
Help users configure OpenCode through guided setup of config files and rules.
<question_tool>
Batching Rule: Use only for 2+ related questions; single questions use plain text.
Syntax Constraints: header max 12 chars, labels 1-5 words, mark defaults with (Recommended).
Purpose: Clarify config scope (models/permissions/rules), validate approach, and handle multiple valid options.
</question_tool>
| Type | Global | Project |
|---|---|---|
| Config | ~/.config/opencode/opencode.json | ./opencode.json |
| Rules | ~/.config/opencode/AGENTS.md | ./AGENTS.md |
Precedence: Project > Global. Configs are merged, not replaced.
Batching: Use the question tool for 2+ related questions. Single questions → plain text.
Syntax: header ≤12 chars, label 1-5 words, add "(Recommended)" to default.
When to ask: Vague request ("configure opencode"), permission/security changes, or multiple valid options exist.
Ask the user what they want to configure:
Then guide them through the relevant section below.
<config_file>
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"theme": "opencode",
"autoupdate": true
}
| Option | Purpose | Example |
|---|---|---|
model | Default model | "anthropic/claude-sonnet-4-20250514" |
small_model | Lightweight tasks | "anthropic/claude-3-5-haiku-20241022" |
theme | UI theme | "opencode", "catppuccin", |
Control what requires approval using the permission field.
{
"permission": {
"edit": "allow", // "allow" | "ask" | "deny"
"bash": {
"npm *": "allow", // pattern matching
"git *": "allow",
"rm *": "ask",
"*": "ask" // default for this tool
},
"webfetch": "allow",
"skill": {
"*": "allow",
"dangerous-*": "deny"
}
}
}
Agents may occasionally work on legacy projects using outdated configuration fields (e.g., tools, maxSteps). You MUST correct these to the modern permission and steps fields when encountered.
Include additional instruction files:
{
"instructions": [
"CONTRIBUTING.md",
"docs/guidelines.md",
".cursor/rules/*.md"
]
}
Full schema reference: See references/config-schema.md
</config_file>
<rules_file>
Project instructions for all agents. Similar to CLAUDE.md or Cursor rules.
Run /init in OpenCode to auto-generate based on project analysis.
# Project Name
This is a [framework] project using [language].
## Project Structure
- `src/` - Source code
- `tests/` - Test files
## Code Standards
- Use TypeScript strict mode
- Prefer functional patterns
- Write tests for all features
## Commands
- `npm run build` - Build project
- `npm test` - Run tests
</rules_file>
<config_tips>
OpenCode supports JSONC (JSON with comments). SHOULD comment out unused configs instead of deleting:
{
"plugin": [
"opencode-openai-codex-auth@latest",
//"@tarquinen/opencode-dcp@latest", // disabled for now
//"@howaboua/pickle-thinker@0.4.0", // only for GLM-4.6
"@ramtinj95/opencode-tokenscope@latest"
]
}
Why: You might want to re-enable later. Keeps a record of what you've tried.
After editing opencode.json, you MUST run this validation (not just suggest it):
opencode run "test"
Execute it yourself using the Bash tool before telling the user the change is complete.
If broken, you'll see a clear error with line number:
Error: Config file at ~/.config/opencode/opencode.json is not valid JSON(C):
--- Errors ---
CommaExpected at line 464, column 5
Line 464: "explore": {
^
--- End ---
Common JSONC mistakes:
}</config_tips>
<common_configurations>
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"permission": {
"edit": "ask",
"bash": "ask"
}
}
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"autoupdate": true,
"permission": {
"edit": "allow",
"bash": {
"*": "allow",
"rm -rf *": "deny",
"sudo *": "ask"
}
},
"instructions": ["CONTRIBUTING.md"]
}
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"share": "auto",
"instructions": [
"docs/development.md",
"docs/api-guidelines.md"
]
}
</common_configurations>
| Issue | Solution |
|---|---|
| Config not loading | Check JSON syntax, ensure valid path |
| Skill not found | Verify SKILL.md (uppercase), check frontmatter |
| Permission denied unexpectedly | Check global vs project config precedence |
references/config-schema.md - Full config optionsWeekly Installs
73
Repository
GitHub Stars
97
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
opencode71
gemini-cli62
codex59
github-copilot55
cursor52
kimi-cli49
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
163,300 周安装
"dracula"autoupdate | Auto-update OpenCode | true / false |
share | Session sharing | "manual" / "auto" / "disabled" |