Skip to content

Instantly share code, notes, and snippets.

@NodarDavituri
Created February 9, 2026 19:30
Show Gist options
  • Select an option

  • Save NodarDavituri/d16ccfe234cda686babe2c24087e970f to your computer and use it in GitHub Desktop.

Select an option

Save NodarDavituri/d16ccfe234cda686babe2c24087e970f to your computer and use it in GitHub Desktop.
/consult-codex skill for Claude Code.
name description
consult-codex
Consult OpenAI Codex CLI for a second opinion or alternative perspective. Triggers on "consult codex", "ask codex", "check with codex", "codex opinion", "what does codex think".

Consult Codex

Get a second opinion from OpenAI's Codex CLI on the current topic, question, or task. Use the output to inform your next action based on the user's request.

When This Triggers

  • User explicitly says "consult codex", "ask codex", or similar
  • User wants a second opinion on debugging, architecture, or implementation
  • User instructs you to consider Codex's perspective before planning or acting

Core Workflow

  1. Formulate the prompt — Distill the current conversation context into a clear, actionable prompt for Codex. Include:

    • The specific question, bug, or task at hand
    • Relevant file paths or code snippets (keep it concise)
    • What kind of answer is needed (explanation, fix, alternatives, review)
    • If the user provided an explicit message for Codex, use that instead
  2. Run Codex — Execute via Bash using the non-interactive exec mode:

    codex exec --sandbox read-only "YOUR PROMPT HERE"
    • --sandbox read-only restricts Codex to read-only file access (no modifications)
    • Codex runs in the current working directory and can see project files
    • stdout contains the final answer; stderr has progress (ignore stderr)
    • For longer prompts, use a heredoc:
      codex exec --sandbox read-only "$(cat <<'EOF'
      Your multi-line prompt here.
      Include context, file paths, and what you need.
      EOF
      )"
  3. Interpret the output — Based on the user's request:

    • Debugging: Compare Codex's diagnosis with your own, highlight agreements and new insights
    • Planning: Incorporate Codex's suggestions into your plan, noting where approaches differ
    • Code review: Present Codex's feedback alongside your own assessment
    • General question: Summarize Codex's answer and add your own perspective if relevant
  4. Act on the result — Follow the user's intent:

    • If user asked to "consult then implement" → use the combined insights to write code
    • If user asked for a second opinion → present both perspectives and let the user decide
    • If user asked to debug with Codex → synthesize findings into a resolution

Prompting Tips

  • Be specific about scope: "Look at src/features/tags/queries.ts and explain why the cache isn't invalidating after mutation"
  • Include constraints: "This project uses TanStack Query v5 and Zustand — suggest solutions using these libraries"
  • Ask for concrete output: "Suggest a fix" rather than "What do you think about this code"
  • Keep prompts under ~500 words for best results

Do

  • Always use codex exec --sandbox read-only for read-only consultation (no file modifications)
  • Summarize Codex's response concisely for the user
  • Clearly distinguish between Codex's suggestions and your own
  • Mention when you and Codex agree — convergent opinions build confidence

Do NOT

  • Let Codex modify files — always use --sandbox read-only
  • Blindly follow Codex output — verify against project conventions in CLAUDE.md
  • Run Codex for trivial questions you can answer directly
  • Pass sensitive data (API keys, credentials) in the prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment