/ask-opencode:ask-opencodefrom ask-opencode
Invokes opencode for an independent review of designs, specs, plans, diffs, or code, then reconciles findings with your own analysis. Handles model selection and headless invocation details.
Ships in ask-opencode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Ask a different model, reached through opencode, to critique an artifact, then report where it and you agree, disagree, and what changed your mind. The value is independence: the reviewer has none of this conversation's context, so it catches assumptions you and the user share without noticing.
This skill handles the opencode invocation details (read-only agent, model resolution, timeout, session cleanup) that otherwise misbehave.
Do NOT use for generic requests for a second opinion, outside review, sanity check, or another model; handle those yourself or ask which reviewer they want. "Ask codex" belongs to the ask-codex skill.
Always go through the bundled script; never call opencode run directly.
scripts/ask-opencode.sh [-m MODEL] [-e EFFORT] [-t SECONDS] [-C DIR] PROMPT_FILE
scripts/ask-opencode.sh -r MODEL # resolve a model name only; no run
(scripts/ is relative to this skill's directory.)
The script exists because headless opencode has sharp edges:
plan agent denies edits but still allows shell. The script injects its
own agent through OPENCODE_CONFIG_CONTENT that allows only read, grep,
glob, and list inside the working directory, denies reading .env
files, and denies the question tool (nobody can answer it headless).
opencode checks grep permission against the search pattern rather than
the file, so grep can still return .env contents. The script prepends
an instruction to every prompt telling the reviewer to keep .env and
credential files out of its searches; that is a request, not
enforcement. Do not point -C at a directory where a leaked secret
would be serious without telling the user. This needs
--standalone, because the background service never sees a per-process
environment variable.timeout on macOS. The script bounds the run with perl alarm
(default 600s). Set the Bash tool's own timeout at least as high.Write the prompt to a file in the scratchpad directory and pass the path. A long prompt on the command line is fragile (quoting, ARG_MAX).
-C DIR sets the working root; default is the current directory. The
reviewer resolves relative paths against it and cannot read outside it, so
point it at the repo root when the artifact references other files.
Opencode takes --model provider/model#variant. Bare names like astra
are rejected, so the script resolves short names against opencode models:
/ passes through unchanged.-, and looks for
a model whose last path segment equals it, then for IDs containing it.
Exactly one hit wins.Map what the user said to -m:
A model name in the request ("ask opencode Astra ...", "opencode
with GLM", "have opencode opus look"): pass the name as -m
(-m astra, -m "gpt 6 luna"). Strip filler words like "the" or
"model". If the user names a family and a version ("Sol 6.1"), pass the
part most likely to be unique (-m 6.1-sol) or resolve first with -r.
No model named: omit -m. The user's opencode default is deliberate.
Ambiguous (exit 3): pick from the candidates only when one is clearly what the user meant:
gpt-6.1-sol
over gpt-5.6-sol).ai-gateway-* providers over direct fireworks-ai/... entries
for the same model.-priority, -spot, -fast, and
routers/... variants unless the user asked for one.If more than one candidate survives those rules (e.g. "kimi" covers both
kimi-k3 and kimi-k2.7-code), ask the user, listing the survivors.
Then rerun with the full ID.
No match: say so and show the closest entries from opencode models
(e.g. opencode models | rg -i <fragment>); do not guess.
Always tell the user the full model ID you used, especially when you picked it from candidates.
-e EFFORT sets the variant suffix (#low, #medium, #high, #xhigh,
#max on models that support reasoning effort). Use it only when the user
asks for an effort level ("ask opencode astra on max"); a #variant
already in -m wins. An unsupported variant fails with "Variant
unavailable"; report it rather than retrying with a different one.
The reviewer starts cold. The prompt is the whole briefing. Include:
git diff ... > scratch/change.diff and name
that file, which must sit under -C DIR. For code, name the files and
the entry points; do not make it guess where to look.docs/PRD.md) rather than paraphrasing a long one.-C on the repo).Tell it that it can only list, glob, grep, and read files (no
commands), so it does not spend steps trying. The script already adds
the .env instruction; do not repeat it.
Tell the user you are about to consult opencode, which model, and what you will ask; a one-line summary is enough. Runs take seconds to several minutes and bill the user's provider accounts.
Do not relay the output verbatim. You have the conversation context, so reconcile:
Name the model, and keep its severities and locations so the user can trace each item. If the user wants the raw output, the script printed it to stdout; save it to the scratchpad first when the run is long so you can quote it later.
-t or narrow the prompt.opencode auth), an unavailable
variant, or a provider outage. Report the error line; do not retry
blindly.-C DIR. Rerun with a wider -C or copy the
file under it.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub xdg/xdg-claude --plugin ask-opencodeOther plugins' skills for the same job