Commands
Define custom command templates in OpenCode.
Configuration
{
"command": {
"test": {
"template": "Run full test suite with coverage report.",
"description": "Run tests with coverage",
"agent": "build",
"model": "anthropic/claude-haiku-4-5"
},
"component": {
"template": "Create a new React component named $ARGUMENTS with TypeScript.",
"description": "Create a new component"
}
}
}Markdown Commands
Commands can also be defined as markdown files in:
~/.config/opencode/command/.opencode/command/
Usage
Invoke custom commands with /command-name in the TUI.
Variables
Use $ARGUMENTS to pass arguments to templates.