Skip to content
gpt-delegation logo

SKILL: GPT Delegation

gpt-delegation

Use when blocked, stuck, or needing fresh perspective. Consults GPT experts via Codex CLI with graceful fallback.

SKILL.md

Full skill instructions

SKILL: GPT Delegation

Purpose: Intelligent Codex/​GPT consultation for complex problems, escalation when stuck


Quick Start

When to Use

  • After 2+ failed attempts on same issue
  • Architecture decisions needed
  • Security concerns
  • Ambiguous requirements
  • Plan review for large plans (5+ SCs)
  • Proactive consultation: Before asking user when confidence < 0.5 (see rubric below)

Quick Reference

# Graceful fallback + delegation (see CRITICAL WARNING below for valid parameters)
if ! command -v codex &> /​dev/​null; then
  echo "Warning: Codex CLI not installed - falling back to Claude-only analysis"
  return 0
fi
codex exec -m gpt-5.2 -s workspace-write -c reasoning_effort=medium --json "TASK: [goal]
EXPECTED: [outcome], CONTEXT: [attempts, errors, iteration], MUST: Analyze failures, fresh approach, report files"

Core Concepts

Graceful Fallback (CRITICAL)

MANDATORY: All GPT delegation points MUST include graceful fallback.

if ! command -v codex &> /​dev/​null; then
  echo "Warning: Codex CLI not installed - falling back to Claude-only analysis"
  return 0  # NOT an error, continue with Claude
fi

Key Points:

  • Graceful fallback is NOT an error
  • Log warning message
  • Return success (exit 0) to allow continuation
  • Continue with Claude agents

CRITICAL WARNING: Codex CLI Parameters (READ CAREFULLY)

MANDATORY: Use EXACT values below - NO variations allowed

Valid -s modes: read-only | workspace-write | danger-full-access FORBIDDEN: workspace-read, read-write, write (Claude often creates invalid combinations) Valid -c value: reasoning_effort=medium ONLY (NOT high/​low) Required: -m gpt-5.2 --json "PROMPT"

Delegation Triggers

TriggerExpertModeWhen to Delegate
2+ failed attemptsArchitectworkspace-writeProgressive escalation
Stuck on taskArchitectworkspace-writeFresh perspective
Architecture decisionArchitectread-onlyDesign guidance
Security concernSecurity Analystread-onlyVulnerability assessment
Ambiguous planScope Analystread-onlyRequirements clarification
Large plan (5+ SCs)Plan Reviewerread-onlyPlan validation

Confidence Score Rubric (Centralized)

Formula:

confidence = 1.0 - (architecture_keywords * 0.3) - (multiple_approaches * 0.2) - (uncertainty_markers * 0.2)

Scale: 0.0 - 1.0

Thresholds:

  • 0.9-1.0: Proceed autonomously
  • 0.5-0.9: Consider consultation
  • < 0.5: MUST consult GPT (proactive)

Detection Patterns:

  • Architecture: architecture, tradeoff, design, scalability, pattern, choice
  • Multiple approaches: could, might, option A/​B, either
  • Uncertainty: not sure, unclear, depends

Progressive Escalation

Principle: Delegate ONLY after 2nd failure, not first

Attempt 1 (Claude) → Fail
     ↓
Attempt 2 (Claude) → Fail
     ↓
Attempt 3 (GPT Architect) → Success

Expert Mapping

ExpertPurposeWhenModeOutput
ArchitectFresh perspective on implementation2+ failures, stuck, architectureworkspace-writeRoot cause, fresh approach, files modified
Security AnalystVulnerability assessmentSecurity concerns, auth, sensitive dataread-onlyOWASP findings, severity, fixes
Plan ReviewerPlan validation5+ SCs, complex deps, high-riskread-onlyQuality (1-10), clarity, feasibility, risks
Scope AnalystRequirements clarificationAmbiguous requirements, edge casesread-onlyAmbiguities, assumptions, acceptance criteria
Code ReviewerCode quality assessmentExplicit review, quality concernsread-onlyQuality issues, violations, refactoring

Integration Pattern

Coder Agent (Ralph Loop)

# After 2nd failure
if [ $iteration -ge 2 ] && [ $TEST_RESULT -ne 0 ]; then
  PROMPT="TASK: Fix failing test ${TEST_NAME}
  EXPECTED OUTCOME: All tests pass
  CONTEXT: Previous attempts: ${ATTEMPT_SUMMARY}, Errors: $(cat /​tmp/​test.log | tail -20)"
  codex exec -m gpt-5.2 -s workspace-write -c reasoning_effort=medium --json "$PROMPT"
fi

/​00_plan Command

# Large plan review
if [ $(echo "$PLAN" | grep -c "SC-") -ge 5 ]; then
  PROMPT="Review plan: $PLAN (Clarity, Completeness, Feasibility, Dependencies, Risks)"
  codex exec -m gpt-5.2 -s read-only -c reasoning_effort=medium --json "$PROMPT"
fi

Troubleshooting

Codex CLI Not Installed

Symptom: Warning message about Codex CLI not installed

Solution: Expected behavior. Skill gracefully falls back to Claude-only analysis.

Delegation Not Triggering

Causes: 1) Trigger not met (< 2 failures) 2) Skill not loaded 3) Codex check failing

Debug: Check echo $iteration, verify grep -r "gpt-delegation" .claude/​skills/, test command -v codex

GPT Returns Same Approach

Solution: Document previous attempts clearly with errors and stack traces.

Best Practices

  • Always include graceful fallback: Codex CLI may not be installed
  • Document previous attempts clearly: Include errors, stack traces, code snippets
  • Specify expected outcome: What does success look like?
  • Use appropriate mode: workspace-write for code changes, read-only for analysis
  • Parse output carefully: GPT output format may vary
  • Verify suggestions: Don't blindly apply GPT recommendations

Further Reading

Internal: @.claude/​skills/​gpt-delegation/​REFERENCE.md - Complete prompt templates, integration examples, troubleshooting | @.claude/​skills/​ralph-loop/​SKILL.md - Ralph Loop integration with GPT delegation

External: Codex Documentation

More Security skills

supabase logo
Security

supabase

Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...

2.7K 308.9K
View

Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.

98 216.2K
View

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

462 163.8K
View

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

462 127.7K
View

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

462 125.1K
View

Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.

222 118.2K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View
cloudflare logo
Security

cloudflare

Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.

3K 110.7K
View

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

253 103K
View
gws-gmail logo
Security

gws-gmail

Send, read, and manage Gmail messages, drafts, labels, and account settings.

31.2K 78.9K
View

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View
gws-shared logo
Security

gws-shared

Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.

31.2K 63.4K
View

Security AI tools

StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
GeoSpy logo
Security

GeoSpy

GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams

Free
View

Detect AI-generated voices to protect against audio fraud.

Paid
View

Ensure Your Content's Originality with AI Plagiarism Checker

Freemium
View
Img Upscaler logo
Security

Img Upscaler

Upscale images by 400% without quality loss

Freemium
View
AICheatCheck logo
Security

AICheatCheck

Accurately Detect AI-Generated Content with TheChecker.AI

Free
View
D
Security

Detect GPT

Chrome extension that detects and flags AI-generated content

Free
View