skills/agentic-harness/opencode-toolkit/configure/SKILL.md
Configure OpenCode via opencode.json and AGENTS.md with deterministic provider setup, model selection, permission policies, formatter behavior, and environment variable handling; use when editing opencode configuration, setting model/provider defaults, tightening agent permissions, or troubleshooting OpenCode config behavior.
npx skillsauth add pantheon-org/tekhne opencode-configureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Navigation hub for OpenCode configuration tasks.
Add a provider — create/edit opencode.json in your project root:
{
"providers": [
{
"id": "anthropic",
"baseEnv": "ANTHROPIC_API_KEY",
"models": [
{ "id": "claude-sonnet-4-5", "default": true }
]
}
]
}
Add project instructions — create AGENTS.md in project root:
## Workflow Rules
- Run `npm test` after every code change.
- Never modify `package.json` without user confirmation.
Validate config:
jq . opencode.json && opencode run "test"
opencode.json.AGENTS.md instructions.| File | Purpose |
| --- | --- |
| opencode.json | Main OpenCode runtime configuration |
| AGENTS.md | Project-level behavior and workflow rules |
| .env/shell env | Provider keys and environment-backed configuration |
| references/*.md | Deep configuration guidance |
Out of scope: plugin authoring and custom tool SDK development.
jq . opencode.json >/dev/null && rg -n "API_KEY|baseEnv|permission" opencode.json .env*opencode run "test"rg -n "model|provider|permission|instructions" opencode.json AGENTS.md
opencode run "test"
jq . opencode.json >/dev/null
rg -n "API_KEY|baseEnv|permission" opencode.json .env*
opencode.json — provider with baseEnv pattern{
"providers": [
{
"id": "openai",
"baseEnv": "OPENAI_API_KEY",
"models": [
{ "id": "gpt-4o-2024-08-06", "default": true }
]
}
],
"permissions": {
"filesystem": { "read": ["./src", "./docs"], "write": ["./src"] },
"shell": { "allow": ["npm test", "jq"] }
},
"formatter": { "enabled": true }
}
AGENTS.md template# Project Agent Instructions
## Scope
- Work only within `src/` and `docs/` unless explicitly told otherwise.
## Workflow Rules
- Run `npm test` after every code change.
- Never modify `opencode.json` directly; propose changes for human review.
## Constraints
- Do not execute destructive shell commands (rm -rf, git push --force).
- Prefer read operations before any write or delete action.
"apiKey": "sk-..."."baseEnv": "OPENAI_API_KEY"."model": "gpt-4".opencode run "test" and validate behavior.opencode.json is runtime config (providers, permissions, tools). AGENTS.md is behavioral guidance for the agent. Mixing them causes ignored instructions or broken config parsing.instructions: blocks inside opencode.json, or adding JSON config snippets inside AGENTS.md.opencode.json; workflow rules, constraints, conventions → AGENTS.md.~/.config/opencode/opencode.json) bleeds into unrelated projects, causing unexpected behavior across your entire environment.npm test to the global shell allowlist, or setting a project-specific model globally.opencode.json. Reserve global config for cross-project defaults (personal API keys via baseEnv, editor preferences).models with only default: true and no IDdefault: true without a model id field is silently ignored or resolves to provider defaults, which may change between releases.{ "default": true } with no id key.default: true with a fully-qualified id: { "id": "claude-sonnet-4-5", "default": true }..env loader > project opencode.json > global opencode.json. Debugging config mismatches without knowing this order leads to wasted time.opencode.json to fix an issue caused by a shell env override.echo $OPENAI_API_KEY), then work downward.tools
A skill that produces warnings but no errors.
testing
A well-formed example skill for testing the validator.
development
A skill with code blocks and imperative instructions for testing content and contamination analysis.
tools