# OpenCode: define reusable custom prompt commands

> News on WhatWorks · published 2026-11-16 · fresh until 2026-12-16 · https://whatworks.dev/t/opencode-define-reusable-custom-prompt-commands
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, OpenCode turns `.opencode/commands/review.md` into `/review`. Put the prompt in the Markdown body and use `$ARGUMENTS` or `$1`, `$2` for input. Files reload automatically. Create the file, then invoke `/review`.

**Not for:** Claude Code slash command files.

Subjects: agent-workflows, opencode, prompting

Do first: Create `.opencode/commands/review.md`, write the prompt in its body, then invoke `/review` with the desired arguments.

## Short answer

As of November 2026, custom commands submit expanded user prompts. Markdown is enough for the basic case; JSON definitions require a `template`.

## What to do

Example file body:

```text
Review $ARGUMENTS for bugs and missing tests.
```

The page invokes it as `/review src/auth.ts`.

| Item | Value / behavior |
| --- | --- |
| Project directory | `.opencode/commands/`; only `.md` files are discovered |
| Legacy directory | Singular `command/` is still read; use `commands/` for new files |
| Nested name | `.opencode/commands/team/review.md` becomes `/team/review` |
| JSON / JSONC | `commands` object in `opencode.jsonc`; each entry requires `template` |
| Markdown prompt | Trimmed body supplies the template; do not add `template` to frontmatter |
| Optional metadata | `description` for discovery; `agent` selects a profile; `model` accepts `provider/model` or `provider/model#variant` |
| `$ARGUMENTS` | Complete argument string exactly as entered |
| `$1`, `$2`, higher positions | Parsed arguments; quotes group words and are removed; highest position consumes the remainder; missing positions become empty |
| No placeholder | Non-empty arguments append after a blank line |
| `subagent: true` | Always use a background child, even for a primary-mode agent |
| `subagent: false` | Always use the current session, even for a subagent-mode agent |
| Omitted `subagent` | Child only if selected agent has `mode: subagent`; otherwise current session |
| Deprecated field | `subtask` aliases `subagent`; `subagent` wins if both occur |

A command’s `model` overrides the selected agent’s configured model, which overrides the current/parent model. Child execution keeps the parent available and sends back the result or failure.

To insert shell output, use `!` followed by a backtick-enclosed command. The page’s example is `git diff --stat && git diff`. It runs in the active project with the configured shell, after argument expansion and before prompt submission. Shell blocks run outside the agent tool permission flow, so do not interpolate untrusted arguments.

Project sources override global ones; nearer project sources override ancestors. Later same-name definitions replace earlier ones, including earlier built-ins. Saves reload without restarting.

## Limits and open questions

Stored templates do not expand `@path`; use a composer attachment when invoking the command. No version number or release date is provided for the current command behavior.

Not for: Claude Code slash command files.

## Sources

- [OpenCode commands documentation](https://opencode.ai/docs/commands/), Anomaly.

## Checked

2026-11-16; read OpenCode commands documentation; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.