Skip to content

Instantly share code, notes, and snippets.

@chew-z
Created December 3, 2025 13:21
Show Gist options
  • Select an option

  • Save chew-z/76d65d00615dba7e7f29606a69c876c7 to your computer and use it in GitHub Desktop.

Select an option

Save chew-z/76d65d00615dba7e7f29606a69c876c7 to your computer and use it in GitHub Desktop.
Claude skill for using Codex
name description
codex
Use Codex CLI for autonomous code analysis, refactoring, design, and implementation. Use when user asks to run codex, mentions pair programming with Codex, or requests iterative code analysis and development with session continuity.

Codex CLI Pair Programming

Codex is an advanced AI programming assistant that excels at autonomous code analysis, design, and implementation through iterative consultation with self-constructed quality standards.

Core Capabilities

  • Session Continuity: Maintains conversation context across commands
  • Autonomous Planning: Discovers context and creates execution plans independently
  • Rubric-Based Excellence: Creates and iterates against self-constructed quality standards
  • Pattern Recognition: Analyzes and matches existing code patterns

Starting a New Session

Use the default profile for safe, read-only analysis:

codex exec --profile readonly_quiet -C /full/path/to/project "your comprehensive prompt here" 2>/dev/null

Profile: Always use --profile readonly_quiet for analysis and planning (safe mode)

Working Directory: Always use -C flag with the fully qualified path to the project directory (use the actual project root path you know)

Suppress Thinking Tokens: Always append 2>/dev/null to suppress stderr unless user explicitly requests to see thinking tokens or debugging is needed

Continuing a Session

Maintain context for iterative work:

codex exec "follow-up prompt" resume --last 2>/dev/null

No flags needed: The resumed session inherits all settings from the original session

Session Benefits: Preserves context, builds on previous analysis, maintains rubric consistency

Effective Prompting Patterns

Rubric-Based Approach

Codex performs best when asked to create and iterate against quality rubrics:

codex exec --profile readonly_quiet -C /full/path/to/project "Analyze [component]. Create excellence rubric covering architecture, performance, maintainability, security. Execute comprehensive analysis against rubric with scored evaluations (0-10) and actionable findings." 2>/dev/null

Rubric Dimensions:

  • Functionality: Does it meet all requirements?
  • Code Quality: Is it clean, maintainable, follows patterns?
  • Integration: Does it fit seamlessly with existing code?
  • Testing: Is coverage comprehensive?
  • Performance: Is it efficient and scalable?
  • Security: Are there vulnerabilities?

Self-Reflection Pattern

codex exec --profile readonly_quiet -C /full/path/to/project "Create an excellence rubric for [task]. Execute iteratively against this rubric, self-assessing and refining your approach." 2>/dev/null

Analysis Pattern

codex exec --profile readonly_quiet -C /full/path/to/project "Analyze [component]. Files: [paths]. Create analysis rubric covering architecture, performance, maintainability, security. Execute comprehensive analysis with actionable findings." 2>/dev/null

Implementation Planning Pattern

codex exec --profile readonly_quiet -C /full/path/to/project "Plan implementation for [feature]. Discovery: Analyze similar implementations. Standards: Follow observed patterns. Rubric: Create comprehensive standards. Provide detailed reasoning and execution plan." 2>/dev/null

Review Pattern

codex exec "Review implementation of [feature]. Create review rubric: correctness, performance, security, maintainability, style. Score against each criterion (0-10). Provide improvement suggestions with priority ranking." resume --last 2>/dev/null

Iterative Consultation Workflow

  1. Initial Consultation: Execute comprehensive initial prompt
  2. Think Critically: Analyze Codex response, don't be passive
  3. Follow-up: Formulate next prompt based on results
  4. Continue Session: Use resume --last to maintain context
  5. Iterate: Continue until excellence (8+/10 scores) achieved

Prompt Guidelines

CRITICAL: Backticks are strictly forbidden in Codex prompts

  • Never use backticks (`) - the tool will crash
  • Use single quotes (' ') instead for emphasis or code references
  • Avoid Markdown code formatting in prompts
  • Keep prompts simple and clear

Good: "Analyze the 'UserService' class and review the 'authenticate' method"

Bad: "Analyze the UserService class and review the authenticate method"

Codex Philosophy

Less is More

  • Provide objectives, not implementation details
  • Let Codex discover and plan autonomously
  • Focus on what and why, not how
  • Trust Codex's analytical capabilities

Context Over Commands

  • Share project context and constraints
  • Let Codex determine the best approach
  • Enable self-directed problem solving

Iteration Over Perfection

  • Start with analysis and planning
  • Build incrementally
  • Review and score frequently
  • Refine until excellence

Quick Reference

Use Case Command Pattern
New analysis codex exec --profile readonly_quiet -C /full/path/to/project "prompt" 2>/dev/null
Continue session codex exec "follow-up prompt" resume --last 2>/dev/null
Show thinking codex exec "prompt" resume --last (omit 2>/dev/null)

Error Handling

  • Report failures when commands exit non-zero
  • Summarize warnings and partial results
  • Ask user for direction before retrying
  • Show stderr only when debugging or explicitly requested

Key Reminders

  • Codex CLI commands are bash commands - execute them using terminal
  • Session continuity is key - use resume --last for follow-ups
  • Think critically about Codex suggestions - you're pair programming
  • Let Codex create rubrics and self-assess
  • No backticks in prompts - use single quotes instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment