Codex Task Decomposition skill for Codex

Big changes as small, green, reviewable steps. Codex investigates read-only, picks a slicing strategy such as vertical slices, expand-migrate-contract or strangler, and writes a plan file where every step has an outcome, a check command and a stop condition. It then executes one step per prompt, commits each green step as a rollback point, parallelizes only independent work, and updates the plan when reality diverges.

  • Codex Mastery
  • $codex-task-decomposition
  • 144 lines
  • 2 files
  • ~1,550 tokens
  • MIT
  • Updated

Install

curl -fsSL codexskills.dev/install.sh \  | sh -s -- codex-task-decomposition

Installs to ~/.agents/skills/codex-task-decomposition/ for every project on this machine.

104-line POSIX script. No sudo, no telemetry. Read install.sh

Use it in Codex

Start a prompt with $codex-task-decomposition, or pick it from /skills. You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.

What Codex reads before loading it

Splits large engineering work for Codex into small, independently verifiable steps, each with an outcome, a check command and a rollback point, written to a plan file in the repo and executed with /plan, /goal, per-step commits, subagents for independent read-heavy work and worktrees for parallel edits. Use when a request spans many files or modules, will not fit one session's context, mixes refactoring with behavior change, or when earlier attempts produced a huge unreviewable diff.

Use it when

  • A request spans many files, modules or services
  • A previous attempt produced an unreviewable diff or ran out of context
  • Refactoring and behavior changes are tangled together
  • Work should continue across sessions or people

Use something else when

How to check the result

Every completed step in the plan file has a passing check and its own commit, the build is green at each commit, and the final global check passes on the full branch.

The mistake it prevents

Letting Codex execute several plan steps in one go, which recreates the large unreviewable diff the plan was meant to prevent.

~/.agents/skills/codex-task-decomposition/SKILL.md

--- name: codex-task-decomposition description: Splits large engineering work for Codex into small, independently verifiable steps, each with an outcome, a check command and a rollback point,… license: MIT ---

Decomposition is right when every step leaves the repository green, is small enough to review in a few minutes, has a check that proves it, and could be handed to a fresh session using only the plan file. Big-bang diffs that are “almost done” are the failure this prevents.

Signals that a task needs splitting

  • Touches more than about 10 files or more than one module boundary.
  • Mixes a refactor with a behavior change.
  • Needs a schema, API or dependency change that consumers must follow.
  • Cannot state a single check command that proves the whole thing.
  • A previous attempt ran out of context, compacted repeatedly, or produced a diff you could not review.

Slicing strategies

SituationSlice byEach step ends with
New feature across layersVertical slices: one thin end-to-end path at a timeFeature flag off by default; a test for the slice
Renames, API changes with many callersExpand, migrate callers in batches, contractOld and new APIs both work until the last step
Replacing a subsystemStrangler: route one use case at a time to the new codeCharacterization tests pass on both paths
Language or framework migrationFile or module batches in dependency order (leaves first)Typecheck + tests green per batch
Risky legacy changeCharacterization tests first, then changeTests that pin current behavior
Investigation plus fixSeparate read-only investigation step, then fix stepsWritten root cause before any edit

Rule: refactor steps and behavior-change steps never share a commit.

Workflow

- [ ] 1. Investigate read-only and draft the plan (/plan)
- [ ] 2. Write the plan file with steps, checks and stop conditions
- [ ] 3. Execute one step at a time; verify; commit
- [ ] 4. Parallelize only independent steps (subagents, worktrees)
- [ ] 5. Re-plan when reality diverges; finish with the full check

1. Investigate and draft

Start in plan mode so nothing is edited while the shape is unclear:

/plan Migrate order totals from float dollars to integer cents across services/orders
and apps/web. Map every read and write of `total`, list the consumers, and propose
steps that each keep the build green. Do not edit files.

Read the plan critically: are steps ordered by dependency? Does each have a check? Is any step secretly two steps?

2. Plan file

Commit the plan so any session (or person) can continue from it:

# Plan: order totals in integer cents
Owner: @dana  Branch: feat/cents  Started: 2026-10-28
Global check: `pnpm turbo run typecheck test --filter=...[origin/main]`

## Steps
- [x] 1. Add `totalCents` column + backfill migration (no reads yet)
      Check: `pnpm --filter orders test migrations`  Commit: a1b2c3d
- [ ] 2. Write both fields in OrderService.save; read old field
      Check: `pnpm --filter orders test`
- [ ] 3. Switch readers in services/orders to totalCents (batch: api/, jobs/)
      Check: same + contract tests
- [ ] 4. Switch apps/web formatting to cents
      Check: `pnpm --filter web test`; screenshot of invoice page
- [ ] 5. Stop writing `total`; drop column in a follow-up release
      Check: global check; grep -rn "\.total\b" returns nothing in src

## Stop and ask if
- A consumer outside this repo reads `total`.
- Any step needs more than ~15 files.

## Decisions
- Rounding: banker's rounding during backfill (see #482).

Put it at docs/plans/<topic>.md or wherever AGENTS.md says plans live.

3. Execute step by step

Prompt per step, referencing the plan rather than restating it:

Do step 2 of docs/plans/order-cents.md only. Run its check. If it passes, tick the box,
add the commit hash after I commit, and stop. If it fails twice, stop and explain.
  • Commit after each green step (or ask the user to); the commit is the rollback point.
  • Run /review or codex review --uncommitted on the step’s diff before committing.
  • For a long run with a clear end state, /goal can drive the steps: /goal Complete docs/plans/order-cents.md steps 2-4; each step's check must pass; stop at "Stop and ask" conditions. A goal keeps the same sandbox and approval policy.
  • When context gets heavy, /compact, or start a new session pointed at the plan file; the plan, not the chat history, is the source of truth.

4. Parallelize safely

Work typeMechanism
Independent read-heavy exploration (map callers, read logs, check docs)Ask Codex to use subagents; each returns a summary to the main thread
Independent write steps touching disjoint filesSeparate sessions in separate git worktrees (/worktree, codex exec --worktree "...")
Long implementation that can run unattendedCodex Cloud task from a published environment
Steps that depend on each otherSequential only

Never let two sessions write the same files. Subagents cost extra tokens; use them when the parallel parts are genuinely independent.

5. Re-plan

When a step reveals something the plan missed, stop, update the plan file (new step, changed order, a decision recorded), and continue. Finish with the global check and a final diff review across all steps.

Gotchas

  • “Small steps” that leave the build red between them are not steps; every commit must pass its check, or the rollback point is useless.
  • Plans written without the read-only investigation invent file paths. Verify paths exist.
  • Codex will happily do steps 2 to 5 in one go if the prompt allows it. Say “only step N, then stop”.
  • Generated files and lockfiles create merge conflicts between parallel worktrees; serialize steps that regenerate them.
  • Database migrations and public API removals deserve their own steps and explicit user confirmation before running against shared environments.

Output contract

**Plan:** docs/plans/order-cents.md (5 steps, global check defined)
**Progress:** steps 1-3 done (commits a1b2c3d, d4e5f6a, 0718bcd), all checks green
**Next:** step 4 (apps/web formatting); blocked on: none
**Changes to plan:** added step 3b for the reporting job found during step 3

What the zip contains

SKILL.md plus the interface file below. Nothing runs on install.

agents/openai.yamlgenerated from this page

Gives the Codex app a display name, a one-line description and a starter prompt for this skill.

interface:
  display_name: "Codex Task Decomposition"
  short_description: "Big changes as small, green, reviewable steps"
  default_prompt: "$codex-task-decomposition Plan the migration of our REST handlers to the new router in steps Codex can do one at a time"

About this skill

Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.

esc
Just launched

Codex Skills Pro is live

79 premium skills for Codex, each with scripts, references and an evidence report that proves the result.

Bought one by one$882.21
All 79 skills$49
94% off

That's $0.62 a skill, paid once.

Get all 79 for $49Or pick single skills from $4.99 →

Secure checkout by Creem