published fresh until

OpenCode: define reusable custom prompt commands

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.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

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:

Review $ARGUMENTS for bugs and missing tests.

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

ItemValue / behavior
Project directory.opencode/commands/; only .md files are discovered
Legacy directorySingular command/ is still read; use commands/ for new files
Nested name.opencode/commands/team/review.md becomes /team/review
JSON / JSONCcommands object in opencode.jsonc; each entry requires template
Markdown promptTrimmed body supplies the template; do not add template to frontmatter
Optional metadatadescription for discovery; agent selects a profile; model accepts provider/model or provider/model#variant
$ARGUMENTSComplete argument string exactly as entered
$1, $2, higher positionsParsed arguments; quotes group words and are removed; highest position consumes the remainder; missing positions become empty
No placeholderNon-empty arguments append after a blank line
subagent: trueAlways use a background child, even for a primary-mode agent
subagent: falseAlways use the current session, even for a subagent-mode agent
Omitted subagentChild only if selected agent has mode: subagent; otherwise current session
Deprecated fieldsubtask 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

Checked

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

Started from a post by @Anomaly, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenCode: define reusable custom prompt commands
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`.
Copy for agent
get the whatworks thread opencode-define-reusable-custom-prompt-commands and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread opencode-define-reusable-custom-prompt-commands
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks