agentleFS
eprouvezeeprouveze/claude-skills/skills/second-opinion/SKILL.md

second-opinion

Skill0 starsChanged 5 months agoMITView on GitHub

Get a second opinion from OpenAI's Codex CLI. Default model is gpt-5.5. Three modes: review (pass/fail code review on the current diff), challenge (adversarial pass — try to break it), consult (multi-turn Q&A with session persistence). Uses ChatGPT subscription auth, not an API key. Use when asked for "second opinion", "codex review", "adversarial review", "challenge this code", "cross-model review", or "/second-opinion".

  • Installs packages

45 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use insecure-defaults, variant-analysis and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • allanninalSkill

    insecure-defaults

    Detects fail-open insecure defaults (hardcoded secrets, weak auth, permissive security) that allow apps to run insecurely in production. Use when auditing security, reviewing config management, or analyzing environment variable handling.

    Also in 3 projects that use this

  • allanninalSkill

    variant-analysis

    Find similar vulnerabilities and bugs across codebases using pattern-based analysis. Use when hunting bug variants, building CodeQL/Semgrep queries, analyzing security vulnerabilities, or performing systematic code audits after finding an initial issue.

    Also in 3 projects that use this

  • shmehroSkill

    ux-audit

    Perform a heuristic UX audit on a UI screen, flow, or component description

    Also in 3 projects that use this

  • sunnyclinches44Skill

    explain

    Explains code using real-world analogies and ASCII diagrams

    Also in 5 projects that use this

  • photon-groveSkill

    unslop

    Detects and rewrites generic, overly polished, or AI-sounding prose while preserving meaning. Use when the user asks to "unslop", humanize, de-AI, tighten, or review whether writing sounds generated.

    Also in 4 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 6 projects that use this

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 5 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 38 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If not authenticated, tell the user to run !

    line 35
  2. Very specific:

    Look for [P1] markers in the output — these are critical findings

    line 64
  3. Distinctive:

    If P1 found: verdict is FAIL with list of critical issues

    line 65
  4. Distinctive:

    If no P1: verdict is PASS

    line 66
  5. Very specific:

    Add token count and comparison note if Claude's /review already ran

    line 67
  6. Very specific:

    If the user specifies a focus domain (e.g., /second-opinion challenge security):

    line 84
  7. Distinctive:

    Ask Codex anything with session persistence for follow-ups.

    line 99
  8. Very specific:

    Never use API key auth: Always verify chatgpt auth mode before running.

    line 144
  9. Distinctive:

    Compare, don't compete: If Claude already reviewed the same code, note where Codex agrees or disagrees — both perspectives are valuable.

    line 148
  10. Distinctive:

    When authenticated against ChatGPT subscription, there is no per-token API cost — calls draw from the subscription quota.

    line 162
  11. Very specific:

    Sandbox mode matters: Always use -s read-only for challenge and consult modes.

    line 171
  12. Very specific:

    Session resume can fail silently: If the saved session ID is stale, codex exec resume returns nothing.

    line 173

“Common” is measured: kept by at least 6 in 10 of the 38 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/second-opinion — Cross-LLM Review via Codex CLI

Get an independent review from OpenAI via the Codex CLI. Three modes for different needs: quick pass/fail review, adversarial break-it pass, or multi-turn consultation.

Authentication

Codex CLI uses chatgpt auth mode (ChatGPT subscription), not an API key. API-key auth also works but burns tokens against your OpenAI bill; the subscription path is free at the margin and is what this skill assumes. Verify before running:

grep -q '"auth_mode": "chatgpt"' ~/.codex/auth.json && echo "OK: Using ChatGPT subscription" || echo "ERROR: Not using ChatGPT auth"

If not authenticated, tell the user to run ! codex login (interactive).

Mode Detection

Parse user input to determine mode:

InputMode
/second-opinion reviewReview
/second-opinion challenge or /second-opinion challenge securityChallenge
/second-opinion <any question>Consult
/second-opinion (no args)Auto-detect: if uncommitted changes exist → Review, else → Consult

Mode 1: Review (pass/fail code review)

Reviews the current diff against the base branch.

cd <project-root>
codex review --base HEAD~1 -c 'model_reasoning_effort="xhigh"' 2>/dev/null

Or against a specific base:

codex review --base main -c 'model_reasoning_effort="xhigh"' 2>/dev/null

Output handling:

  • Present Codex's output verbatim inside a ### CODEX SAYS section
  • Look for [P1] markers in the output — these are critical findings
  • If P1 found: verdict is FAIL with list of critical issues
  • If no P1: verdict is PASS
  • Add token count and comparison note if Claude's /review already ran

Timeout: 300 seconds (5 minutes). If it times out, say "Diff may be too large or API is slow."

Mode 2: Challenge (adversarial)

Try to break the code. Finds edge cases, race conditions, security holes.

cd <project-root>
DIFF=$(git diff HEAD~1)
codex exec "You are an adversarial code reviewer. Your job is to BREAK this code. Find edge cases, race conditions, security vulnerabilities, error handling gaps, and failure modes. Be aggressive and thorough. Here is the diff:\n\n$DIFF" \
  -s read-only \
  -c 'model_reasoning_effort="xhigh"' \
  --json 2>/dev/null

If the user specifies a focus domain (e.g., /second-opinion challenge security):

codex exec "You are a security auditor. Find injection vectors, auth bypasses, SSRF, XSS, CSRF, and data exposure in this diff:\n\n$DIFF" \
  -s read-only \
  -c 'model_reasoning_effort="xhigh"' \
  --json 2>/dev/null

Output handling:

  • Parse JSONL output: extract agent_message and reasoning fields
  • Present ALL findings verbatim — never summarize or editorialize
  • Group by severity if Codex provides severity markers

Mode 3: Consult (multi-turn Q&A)

Ask Codex anything with session persistence for follow-ups.

First question:

cd <project-root>
RESULT=$(codex exec "<user's question>" \
  -s read-only \
  -c 'model_reasoning_effort="xhigh"' \
  --json 2>/dev/null)
echo "$RESULT"

Save session ID for follow-ups:

SESSION_ID=$(echo "$RESULT" | python3 -c "
import sys,json
for line in sys.stdin:
    try:
        d=json.loads(line)
        if 'session_id' in d: print(d['session_id']); break
    except: pass
" 2>/dev/null)
if [[ -n "$SESSION_ID" ]]; then
  mkdir -p .context
  echo "$SESSION_ID" > .context/codex-session-id
fi

Follow-up questions:

SESSION_ID=$(cat .context/codex-session-id 2>/dev/null)
if [[ -n "$SESSION_ID" ]]; then
  codex exec resume "$SESSION_ID" "<follow-up question>" \
    -s read-only \
    -c 'model_reasoning_effort="xhigh"' \
    --json 2>/dev/null
else
  # No session — start fresh
  codex exec "<question>" -s read-only -c 'model_reasoning_effort="xhigh"' --json 2>/dev/null
fi

Golden Rules

  1. Never editorialize Codex's output. Show it verbatim in a ### CODEX SAYS block.
  2. Never use API key auth. Always verify chatgpt auth mode before running.
  3. Always use -s read-only for challenge and consult modes (sandbox).
  4. Always use model_reasoning_effort="xhigh" for maximum reasoning depth.
  5. Timeout is 300s on all Bash calls to Codex.
  6. Compare, don't compete. If Claude already reviewed the same code, note where Codex agrees or disagrees — both perspectives are valuable.

Error Handling

ErrorFix
codex: command not foundnpm install -g @openai/codex
Auth failure / token expiredUser runs ! codex login
Timeout (300s)Diff too large or API slow — try with smaller scope
Empty responseCheck stderr: codex exec "test" 2>&1
Session resume failsDelete .context/codex-session-id, start fresh

Cost

When authenticated against ChatGPT subscription, there is no per-token API cost — calls draw from the subscription quota. If you are on API-key auth, expect normal token billing (xhigh reasoning is roughly 2× the cost of medium).

Known gotchas

  • Editorializing Codex's output buries the point. The whole value of a second opinion is that it disagrees with the first. Show Codex's output verbatim inside a ### CODEX SAYS block and let the human read both.
  • Sandbox mode matters. Always use -s read-only for challenge and consult modes. Without it, Codex can write to the working tree.
  • Session resume can fail silently. If the saved session ID is stale, codex exec resume returns nothing. Detect "no output" and fall back to a fresh session.

Anti-patterns

  • Running /second-opinion and ignoring the result when it disagrees with Claude. The purpose of the skill is to surface disagreement. If both models are going to be filtered through the same hand, you might as well not run it.
  • Using --model gpt-5.5 (the heavier model) on trivial questions. The slower path is worth it for hard prompts — for everything else, the default is fine.

Validated patterns

  • For diff review, running codex review --base <baseline> and grepping for [P1] markers is a reliable pass/fail signal.
  • For challenge mode, naming a domain (challenge security, challenge concurrency) gives much sharper output than the generic prompt.

Self-improvement

This skill ships with a lightweight feedback loop. Adopt or ignore — the skill works without it.

Trigger a review when:

  • The user explicitly disagrees with the review or challenge output (strongest signal — log immediately; 2–3 corrections on the same theme → promote to body).
  • A novel input category recurs across sessions.
  • learnings.md crosses ~100 bullets (consolidation time).
  • The skill mis-triggers or fails to trigger.
  • The Codex CLI ships a breaking change.

Consolidation pass (5–10 min, weekly or threshold-driven):

  • Each entry gets one fate: apply, capture, or dismiss.
  • Apply = merge into Known gotchas / Anti-patterns / Validated patterns.
  • Capture = leave in learnings.md for now.
  • Dismiss = delete.
  • Bump last-consolidated: in frontmatter.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.