/consult-codex
Consult OpenAI Codex (GPT 5.2) for repo-aware code analysis and OpenAI reasoning. Use when need general code review, refactoring suggestions, or different AI perspective.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/consult-codex
Context preview
What this command does when you run it.
Consult OpenAI Codex (GPT 5.2) for repo-aware code analysis and OpenAI reasoning. Use when need general code review, refactoring suggestions, or different AI perspective.
Command definition
consult-codex.mdname: multi-ai-consultant:consult-codex
description: Consult OpenAI Codex (GPT 5.2) for repo-aware code analysis and OpenAI reasoning. Use when need general code review, refactoring suggestions, or different AI perspective.
allowed-tools:
- Bash
Consult OpenAI Codex
You are being asked to consult OpenAI's GPT 5.2 via the Codex CLI for a second opinion on a coding problem or architectural decision.
Your Task
1. **Pre-flight Check**: Verify OpenAI API key is valid 2. **Navigate to Project**: Change to project directory (Codex is repo-aware) 3. **Build Prompt**: Create a clear, specific question 4. **Execute Consultation**: Call Codex with auto-approval flags 5. **Parse Response**: Read output from file 6. **Synthesize**: Compare Codex's analysis with your own reasoning 7. **Present**: Show 5-part synthesis to user 8. **Log Cost**: Track tokens and cost
---
Step 1: Pre-flight Check
# Test if OpenAI API key is valid
if ! command -v openai &>/dev/null; then
echo "⚠️ OpenAI CLI not installed (optional for pre-flight check)"
echo "Attempting Codex consultation anyway..."
else
if ! openai api models.list &>/dev/null 2>&1; then
echo "❌ OpenAI API key not working"
echo ""
echo "Possible issues:"
echo "1. API key not set: export OPENAI_API_KEY='sk-...'"
echo "2. API key invalid: Check https://platform.openai.com/api-keys"
echo ""
echo "After fixing, try the consultation again."
exit 1
fi
fi
# Check if Codex CLI is installed
if ! command -v codex &>/dev/null; then
echo "❌ Codex CLI not installed"
echo ""
echo "Install with: npm install -g codex"
echo "Docs: https://www.npmjs.com/package/codex"
echo ""
exit 1
fiIf pre-flight check fails, stop here and show the error message to the user.
---
Step 2: Navigate to Project
**Codex is repo-aware**: It automatically scans the current directory for context.
# Get current project directory
PROJECT_DIR=$(pwd)
# Ensure we're in the right place
echo "📂 Consulting on project: $PROJECT_DIR"
**Context behavior**:
- Codex reads all non-gitignored files in directory
- Respects `.gitignore` automatically
- No need for `@<path>` syntax
- Will warn if not in Git repo (can override with `--skip-git-repo-check`)
---
Step 3: Build Prompt
The prompt must include: 1. **Problem statement**: What's wrong or what decision is needed 2. **Question**: Specific question for Codex 3. **Your analysis**: What you've tried or considered 4. **Note about codebase access**: Remind Codex it has access
**Format**:
Problem: [Brief description]
Question: [Specific question]
I've tried: [Your attempts]
Current status: [What's happening now]
(You have access to the codebase in this directory.)
**Note**: No need to specify files - Codex automatically has access to the repo.
---
Step 4: Execute Consultation
**Required flags for non-interactive use**:
- `--yolo` OR `--dangerously-bypass-approvals-and-sandbox` OR `--full-auto`
- `--output-last-message /tmp/codex-response.txt`
**Recommended model**: `gpt-5.2` (latest)
**Full command pattern**:
PROMPT=$(cat <<'EOF'
[Your formatted prompt here]
EOF
)
# Create temp file for output
RESPONSE_FILE="/tmp/codex-response-$(date +%s).txt"
# Execute Codex (use --yolo to prevent hanging)
echo "$PROMPT" | codex exec - \
-m gpt-5.2 \
--yolo \
--output-last-message "$RESPONSE_FILE" \
--skip-git-repo-check
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "❌ Codex CLI failed (exit code: $EXIT_CODE)"
echo "Check your API key and internet connection"
exit 1
fi
# Read response
if [ ! -f "$RESPONSE_FILE" ] || [ ! -s "$RESPONSE_FILE" ]; then
echo "❌ Codex response file is empty or missing"
exit 1
fi
ANALYSIS=$(cat "$RESPONSE_FILE")
# Clean up
rm -f "$RESPONSE_FILE"
---
Step 5: Token Estimation
**Note**: Codex CLI doesn't return token counts in output. Estimate for logging.
# Rough estimation (4 chars = 1 token)
INPUT_TOKENS=$(echo "$PROMPT" | wc -c | awk '{print int($1/4)}')
OUTPUT_TOKENS=$(echo "$ANALYSIS" | wc -c | awk '{print int($1/4)}')
# Add codebase size estimate
CODEBASE_SIZE=$(find . -type f -not -path '*/\.*' -not -path '*/node_modules/*' | xargs wc -c 2>/dev/null | tail -1 | awk '{print int($1/4)}')
INPUT_TOKENS=$((INPUT_TOKENS + CODEBASE_SIZE))---
Step 6: Synthesize (5-Part Format)
You MUST compare Codex's analysis with your own reasoning. DO NOT just parrot Codex's response.
**Required sections**:
🤖 My Analysis
- Your original reasoning
- What you tried
- What you think the issue is
- Your proposed solution
🔷 Codex's Analysis
- Codex's complete response
- Include their reasoning
- Include specific file references if provided
- Note any code examples
🔍 Key Differences
- **Agreement**: Where you and Codex align
- **Divergence**: Where you disagree (explain why)
- **Codex's catch**: Things Codex found that you missed
- **Your edge**: Things you considered that Codex didn't
- **Repo-aware value**: What having full codebase access added
⚡ Synthesis
- Combine both perspectives
- Identify root cause (if bug)
- Weigh trade-offs (if architecture)
- Note any conflicting advice and why
✅ Recommended Action
- Specific, actionable next steps
- File paths and line numbers
- Expected outcome
- Risk assessment
**End with**: "Should I proceed with this approach?"
---
Step 7: Log Cost
# Calculate cost (GPT 5.2 pricing)
# Input: $0.00001/token, Output: $0.00003/token (example rates, verify current)
COST=$(echo "scale=4; ($INPUT_TOKENS * 0.00001) + ($OUTPUT_TOKENS * 0.00003)" | bc)
# Create log directory if needed
mkdir -p ~/.claude/ai-consultations
# Log consultation
echo "$(date -Iseconds),codex,gpt-5.2,$INPUT_TOKENS,$OUTPUT_TOKENS,$COST,$(pwd)" \
>> ~/.claude/ai-consultations/consultations.log
# Show cost to user
echo ""
echo "---"
echo "Cost: \$$COST (~$INPUT_TOKENS input + $OUTPUT_TOKENS output tokens, estimated)"
echo "Consu
Read more
name: multi-ai-consultant:consult-codex description: Consult OpenAI Codex (GPT 5.2) for repo-aware code analysis and OpenAI reasoning. Use when need general code review, refactoring suggestions, or different AI perspective. allowed-tools: - Bash
Consult OpenAI Codex
You are being asked to consult OpenAI's GPT 5.2 via the Codex CLI for a second opinion on a coding problem or architectural decision.
Your Task
1. **Pre-flight Check**: Verify OpenAI API key is valid 2. **Navigate to Project**: Change to project directory (Codex is repo-aware) 3. **Build Prompt**: Create a clear, specific question 4. **Execute Consultation**: Call Codex with auto-approval flags 5. **Parse Response**: Read output from file 6. **Synthesize**: Compare Codex's analysis with your own reasoning 7. **Present**: Show 5-part synthesis to user 8. **Log Cost**: Track tokens and cost
---
Step 1: Pre-flight Check
# Test if OpenAI API key is valid
if ! command -v openai &>/dev/null; then
echo "⚠️ OpenAI CLI not installed (optional for pre-flight check)"
echo "Attempting Codex consultation anyway..."
else
if ! openai api models.list &>/dev/null 2>&1; then
echo "❌ OpenAI API key not working"
echo ""
echo "Possible issues:"
echo "1. API key not set: export OPENAI_API_KEY='sk-...'"
echo "2. API key invalid: Check https://platform.openai.com/api-keys"
echo ""
echo "After fixing, try the consultation again."
exit 1
fi
fi
# Check if Codex CLI is installed
if ! command -v codex &>/dev/null; then
echo "❌ Codex CLI not installed"
echo ""
echo "Install with: npm install -g codex"
echo "Docs: https://www.npmjs.com/package/codex"
echo ""
exit 1
fiIf pre-flight check fails, stop here and show the error message to the user.
---
Step 2: Navigate to Project
**Codex is repo-aware**: It automatically scans the current directory for context.
# Get current project directory PROJECT_DIR=$(pwd) # Ensure we're in the right place echo "📂 Consulting on project: $PROJECT_DIR"
**Context behavior**:
- Codex reads all non-gitignored files in directory
- Respects `.gitignore` automatically
- No need for `@<path>` syntax
- Will warn if not in Git repo (can override with `--skip-git-repo-check`)
---
Step 3: Build Prompt
The prompt must include: 1. **Problem statement**: What's wrong or what decision is needed 2. **Question**: Specific question for Codex 3. **Your analysis**: What you've tried or considered 4. **Note about codebase access**: Remind Codex it has access
**Format**:
Problem: [Brief description] Question: [Specific question] I've tried: [Your attempts] Current status: [What's happening now] (You have access to the codebase in this directory.)
**Note**: No need to specify files - Codex automatically has access to the repo.
---
Step 4: Execute Consultation
**Required flags for non-interactive use**:
- `--yolo` OR `--dangerously-bypass-approvals-and-sandbox` OR `--full-auto`
- `--output-last-message /tmp/codex-response.txt`
**Recommended model**: `gpt-5.2` (latest)
**Full command pattern**:
PROMPT=$(cat <<'EOF' [Your formatted prompt here] EOF ) # Create temp file for output RESPONSE_FILE="/tmp/codex-response-$(date +%s).txt" # Execute Codex (use --yolo to prevent hanging) echo "$PROMPT" | codex exec - \ -m gpt-5.2 \ --yolo \ --output-last-message "$RESPONSE_FILE" \ --skip-git-repo-check EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then echo "❌ Codex CLI failed (exit code: $EXIT_CODE)" echo "Check your API key and internet connection" exit 1 fi # Read response if [ ! -f "$RESPONSE_FILE" ] || [ ! -s "$RESPONSE_FILE" ]; then echo "❌ Codex response file is empty or missing" exit 1 fi ANALYSIS=$(cat "$RESPONSE_FILE") # Clean up rm -f "$RESPONSE_FILE"
---
Step 5: Token Estimation
**Note**: Codex CLI doesn't return token counts in output. Estimate for logging.
# Rough estimation (4 chars = 1 token)
INPUT_TOKENS=$(echo "$PROMPT" | wc -c | awk '{print int($1/4)}')
OUTPUT_TOKENS=$(echo "$ANALYSIS" | wc -c | awk '{print int($1/4)}')
# Add codebase size estimate
CODEBASE_SIZE=$(find . -type f -not -path '*/\.*' -not -path '*/node_modules/*' | xargs wc -c 2>/dev/null | tail -1 | awk '{print int($1/4)}')
INPUT_TOKENS=$((INPUT_TOKENS + CODEBASE_SIZE))---
Step 6: Synthesize (5-Part Format)
You MUST compare Codex's analysis with your own reasoning. DO NOT just parrot Codex's response.
**Required sections**:
🤖 My Analysis
- Your original reasoning
- What you tried
- What you think the issue is
- Your proposed solution
🔷 Codex's Analysis
- Codex's complete response
- Include their reasoning
- Include specific file references if provided
- Note any code examples
🔍 Key Differences
- **Agreement**: Where you and Codex align
- **Divergence**: Where you disagree (explain why)
- **Codex's catch**: Things Codex found that you missed
- **Your edge**: Things you considered that Codex didn't
- **Repo-aware value**: What having full codebase access added
⚡ Synthesis
- Combine both perspectives
- Identify root cause (if bug)
- Weigh trade-offs (if architecture)
- Note any conflicting advice and why
✅ Recommended Action
- Specific, actionable next steps
- File paths and line numbers
- Expected outcome
- Risk assessment
**End with**: "Should I proceed with this approach?"
---
Step 7: Log Cost
# Calculate cost (GPT 5.2 pricing) # Input: $0.00001/token, Output: $0.00003/token (example rates, verify current) COST=$(echo "scale=4; ($INPUT_TOKENS * 0.00001) + ($OUTPUT_TOKENS * 0.00003)" | bc) # Create log directory if needed mkdir -p ~/.claude/ai-consultations # Log consultation echo "$(date -Iseconds),codex,gpt-5.2,$INPUT_TOKENS,$OUTPUT_TOKENS,$COST,$(pwd)" \ >> ~/.claude/ai-consultations/consultations.log # Show cost to user echo "" echo "---" echo "Cost: \$$COST (~$INPUT_TOKENS input + $OUTPUT_TOKENS output tokens, estimated)" echo "Consu
142 production-ready skills for Claude Code CLI 🔌 Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).
Repo: secondsky/claude-skills
Other commands on secondsky-claude-skills.
- /better-auth-add-plugin
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Open command - /better-auth-setup
Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
Open command - /explain-error
Explain Better Auth error codes and provide solutions with code examples
Open command - /providers
Display Better Auth available authentication providers and their configuration
Open command - /bun-debug
Type of issue to debug (runtime, test, build, memory, performance)
Open command - /bun-deploy
Target platform (docker, cloudflare, vercel, fly, railway)
Open command

