[research@ai4se] : ~ $
cd ../
[tools] | | 12 min

# Claude Code vs. Codex: Comparing the Official Best Practices

Both official guides converge on the same operating model: context first, plan when ambiguity is high, verify with runnable checks, persist guidance, control permissions, and scale out only once reliable.

[coding-agents][claude-code][tools]

Claude Code and Codex are the two flagship products in the coding-agent market. The value of their official best-practice guides isn’t “which one is better” — it’s how to operate a coding agent reliably: a shift from “choosing a tool” to “building operating habits.”

A Shared Operating Model

The two official guides converge on eight points:

  1. Context first — task, files, constraints, and the definition of “done” must be explicit
  2. Plan first when ambiguity is high — use plan/interview mode before implementing
  3. Verify with runnable checks — tests, builds, lint, screenshots
  4. Persist guidanceCLAUDE.md or AGENTS.md, instead of rewriting it into every prompt
  5. Control permissions — loosen them only after trust is established
  6. Use external context judiciously — MCP and CLI tools
  7. Scale out only once reliable — skills, hooks, subagents, automations, parallel sessions
  8. Independent review — long-running tasks need fresh-context review or diff review

Claude Code’s Official Themes

ThemeKey points
Verify the workProvide tests, builds, screenshots; without checks, the human becomes the only verification loop
Explore before codingexplore → plan → implement → commit/PR; small changes can skip planning
Rich context@ file references, screenshots, URLs, logs
Configure the environment/init to build CLAUDE.md; permissions, sandbox, MCP, hooks, skills
Manage sessions/clear between tasks; subagents to preserve main context; checkpoints, /rewind
Scale with automationclaude -p for non-interactive runs; worktrees for parallelism; adversarial review before release

Common failures: mixing unrelated tasks into the same context-heavy session; not clearing and restarting after repeated corrections; letting Claude work without verifiable checks.

Codex’s Official Themes

ThemeKey points
Prompt structureGoal, Context, Constraints, Done when
Plan modePlan first for complex/ambiguous tasks; can interview the user
AGENTS.mdAn open-format README for agents: layout, commands, conventions, PR expectations, verification standards
config.tomlPersonal ~/.codex/ plus repo .codex/; model, sandbox, approval, MCP
Testing and reviewCreate/update tests, run checks, confirm behavior, /review
SkillsSingle responsibility, SKILL.md, clear triggers
AutomationsSchedule background runs only once the workflow is stable
Session controlthreads, worktrees, resume/fork; avoid multiple threads editing the same file

Common failures: piling durable rules into the prompt instead of AGENTS.md; not stating the build/test/verify process; skipping planning for multi-step work; granting broad permissions too early; automating before the workflow is stable.

Side-by-Side Comparison

DimensionClaude CodeCodex
Persistent repo guidanceCLAUDE.mdAGENTS.md
Planningexplore → plan → codePlan mode / PLANS.md
Verificationrunnable checks + screenshotsdone-when + tests + review loop
Permissionsauto mode, /permissions, /sandboxsandbox, approval policy
Long-running taskscheckpoints, /rewind, resumethreads, /fork, goals, worktrees
Extensibilityhooks, skills, subagents, pluginsskills, automations, config profiles

Relationship to Harness

The official practices map onto the five Harness dimensions:

  • ContextCLAUDE.md / AGENTS.md, rich references
  • Permissions → sandbox, approval, auto mode
  • Routing → subagents, plan mode, skills
  • Governance → hooks, rules
  • Evaluation → tests, review, verification-before-completion

See Agentic Coding Agent Core Concepts for the core concept map.

A Checklist for Learners

  1. Scaffold with /init plus a refined persistent instruction file
  2. For every feature: explore/plan → implement in small steps → run checks → commit
  3. Define “done when” for the repo: which commands must pass
  4. Default to conservative permissions; loosen only in trusted repos
  5. Long sessions: split tasks with /clear; use subagents for investigation
  6. Before merging: a fresh review or an adversarial review step

References