/second-opinion:second-opinion [--backend codex|gemini|copilot|claude] review staged | review <file> | <question>from second-opinion
Gets a read-only second opinion from Codex, Gemini, Copilot, or Claude on code, architecture, or staged changes. Useful for external code review or AI cross-checking.
Ships in second-opinion. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are gathering context and asking an external AI for a second opinion.
Enabled backends (plugin userConfig; change them with /plugin configure second-opinion):
| Backend | Enabled |
|---|---|
| codex | ${user_config.enable_codex} |
| gemini | ${user_config.enable_gemini} |
| copilot | ${user_config.enable_copilot} |
| claude | ${user_config.enable_claude} |
A backend is disabled only when its value reads false. Any other value, including an unsubstituted placeholder, means enabled.
Parse $ARGUMENTS for --backend <name> or infer from context:
| Flag / keyword | Script |
|---|---|
--backend codex or mentions "codex" or "openai" | ${CLAUDE_PLUGIN_ROOT}/scripts/ask-codex.sh |
--backend gemini or mentions "gemini" or "google" | ${CLAUDE_PLUGIN_ROOT}/scripts/ask-gemini.sh |
--backend copilot or mentions "copilot" or "github" | ${CLAUDE_PLUGIN_ROOT}/scripts/ask-copilot.sh |
--backend claude or mentions "claude" or "anthropic" | ${CLAUDE_PLUGIN_ROOT}/scripts/ask-claude.sh |
| No preference specified | The first enabled backend in the order codex, gemini, copilot, claude |
If the requested backend is disabled, do not run its script: say it is disabled in the plugin config and name the enabled ones. If none is enabled, stop and point to /plugin configure second-opinion.
Remove the --backend flag from arguments before continuing to Step 1.
Parse remaining arguments to determine what the user wants reviewed:
| Pattern | Action |
|---|---|
review staged or staged | Review staged git changes |
review <filepath> | Review a specific file |
review branch or branch | Review all changes on current branch vs base |
| Any other text | Treat as a free-form question — still gather relevant code context if possible |
Based on the review type, gather the minimum necessary context:
git diff --cached to get the staged diffgit rev-parse --verify origin/main — if it exists, use mainorigin/mastergit diff <base>...HEADContext budget: Keep total context under 8000 characters. If a diff or file is larger:
git diff --cached --stat to summarize, then include only the most relevant hunksSecurity: Before constructing the prompt, scan gathered context for secrets. NEVER include:
sk-, ghp_, AKIA, Bearer )If secrets are detected, redact them with [REDACTED] and warn the user.
Pass the prompt directly to the script using a heredoc via stdin:
${CLAUDE_PLUGIN_ROOT}/scripts/ask-{backend}.sh - --timeout 300 <<'PROMPT'
... constructed prompt here ...
PROMPT
Do NOT use temp files. Always use heredoc to pipe the prompt directly.
You are reviewing code in a [language] project.
## Context
[branch name, recent commits, project description if relevant]
## Code to review
[diff or file contents]
## Request
[What the user wants: code review, architecture feedback, specific question, etc.]
Focus on:
- Bugs or logic errors
- Security concerns
- Performance issues
- Better approaches or patterns
- Things that look correct and well-done
Be concise. Prioritize actionable feedback.
Present the response clearly, noting which AI provided it (e.g. "Codex opinion:", "Gemini opinion:").
External AIs vary widely in how grounded their feedback is. Apply this rubric to every concern, recommendation, or claim in the response:
| Level | Meaning |
|---|---|
| HIGH | The external AI cited specific code, named a function or line, or pointed to evidence visible in the diff/file you sent it |
| MEDIUM | The AI made a defensible argument from general principles or framework behavior, but didn't cite specifics from your code |
| LOW | The AI was hedging, speculating, or applying generic best practices without grounding in the actual code under review |
Format each point as:
[CONFIDENCE] external AI's claim — Your assessment: agree / partial / disagree, with one-line reason
A LOW-confidence external opinion is a starting point for investigation, not a conclusion. A HIGH-confidence external opinion that contradicts your own analysis warrants a closer look at the actual code rather than dismissing it.
--timeout 300 for larger reviews.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub juanmhidalgo/claude-plugins --plugin second-opinion