一键导入
ce-decompose
Split or rebuild oversized diffs into reviewable pieces. Use for 'too big to review', 'break this down', 'decompose this', or 'split this up'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Split or rebuild oversized diffs into reviewable pieces. Use for 'too big to review', 'break this down', 'decompose this', or 'split this up'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Normalize a consequential or ambiguous request when missing context, boundaries, or proof could materially change the work. Explicit invocation previews the improved prompt.
Explore requirements and approaches through collaborative dialogue, then write a right-sized requirements document. Use when the user says "let's brainstorm", "what should we build", or "help me think through X", presents a vague or ambitious feature request, or seems unsure about scope or direction -- even without explicitly asking to brainstorm.
Find root causes and fix bugs. Use for errors, failing tests, issue repros, stack traces, "debug this", or "why is this failing".
Create structured plans for multi-step tasks once the goal is clear enough to plan. Use after ce-brainstorm or ce-grill, or directly for clear planning requests. If the request has branchy product/scope ambiguity, run ce-grill first. After markdown plans, document-review runs before handoff.
Review recent code changes for bugs, regressions, product fit, conventions, performance, security, and blast radius.
Execute implementation work with a compact product-contract loop. Use when the user asks to build, fix, implement, polish, or finish a scoped task. Favor reasoning, prior art, smallest correct changes, focused tests, and real-surface proof. Do not run autonomous PR, CI, ticket, or residual-work pipelines.
| name | ce-decompose |
| description | Split or rebuild oversized diffs into reviewable pieces. Use for 'too big to review', 'break this down', 'decompose this', or 'split this up'. |
| argument-hint | [optional: branch/PR/path to the diff] [optional: threshold:<lines>] |
A large diff is not a unit of work — it is a signal that the change was never split. This skill takes over after your normal loop has produced such a diff and carves it into pieces small enough that a human can review each one with real confidence.
You arrive here with code already written. Your ideate → brainstorm → plan → work loop ran up front; it produced a change that is correct (or close) but too big to review in one pass. This skill does not re-open the product contract or re-plan the feature — it operates on the diff that loop produced and turns it into reviewable increments.
ce-plan defines HOW to build from settled requirements. ce-work executes a scoped task. ce-decompose sits downstream of both: it is the back-half tool you reach for when the work is done but the diff is too large to ship as one reviewable chunk.
Do not reach for this at the front of the funnel. If requirements are unresolved, use ce-brainstorm; if the work isn't built yet, use ce-plan → ce-work. Decomposition operates on an existing diff — there must be code to carve.
The core heuristic: any change large enough that you cannot hold it in your head and review it line-by-line is too big.
threshold:<lines> argument overrides the default for this run.The number is a proxy. Every step returns to the real question: can a careful human review this piece and be confident it is correct? If no, it is still too big.
When asking the user a question, use the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension). Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors — not because a schema load is required. Never silently skip the question.
Dispatch parallel work using the platform's subagent primitive: Agent/Task in Claude Code, spawn_agent in Codex, subagent in Pi. When several pieces have no dependency between them, launch their agents in a single batch so they run concurrently. Use the current harness's subagent instructions for the dispatch pattern, and orchestration when the fan-out needs structured coordination.
This loop is human-in-the-loop by default. It is for feature work, which touches human boundaries (UI, API) and where net-new code can introduce architectural pathologies that violate invariants the specs and tests do not yet capture. Confirm the carve strategy and the seams before executing; do not run the full loop autonomously unless the user explicitly asks.
Pin down exactly what change is being decomposed, then size it.
git diff <base>...HEAD plus git diff HEAD for uncommitted work.git diff <merge-base>..<branch>.Size it. Measure the whole surface you're decomposing — for a working tree that means committed and uncommitted and untracked work, or the in-progress sprawl will read as under-threshold and skip decomposition:
# Working tree (committed + uncommitted tracked changes vs base):
git diff <base> --numstat | awk '{a+=$1; d+=$2} END {print a+d " tracked lines"}'
# ...plus untracked new files, which git diff never shows:
git ls-files --others --exclude-standard -z | xargs -0r wc -l | tail -1
# Branch or PR (the committed range is the whole change). Use the requested
# head ref — the branch name or PR head SHA — not HEAD, which measures whatever
# happens to be checked out:
git diff <base>...<head> --numstat | awk '{a+=$1; d+=$2} END {print a+d " changed lines"}'
Note the three-dot <base>...HEAD form covers only committed changes; use git diff <base> (no dots) when uncommitted working-tree edits are part of the change. If the total is under threshold (after the risk adjustments above), the change is already reviewable — hand it to normal review via ce-quality-gate → ce-review and stop. There is nothing to decompose. Otherwise continue.
Decide what to do with the code that's already written. This gate routes the rest of the loop.
Read enough of the diff to judge its quality, then choose:
A single diff can be mixed — most of it sound and one region tangled. Split the sound majority and flag the tangled region for rebuild. Confirm the strategy with the user before executing (see Interaction Method).
Both paths need the same thing: the set of atomic, incremental, reviewable units the change naturally breaks into. Each unit should be:
Find the seams twice, independently, then reconcile:
Massage the units into the right general shape. Agents will very often make units too specific to the shape the diff happened to take — pinned to incidental file names, the diff's accidental ordering, or one-off helpers. Re-derive units from the change's durable boundaries, not its incidental layout. The unit list should read like it describes the feature, not the diff.
Capture the result as an ordered list of units with one-line goals and explicit dependencies (cite units by name). Hand off to ce-plan when the set warrants a durable plan — its implementation-unit structure (stable U-IDs, per-unit files, test scenarios, dependency ordering) is exactly this artifact.
Carve the existing code into the units from Step 3, preserving the work. The output is an ordered stack of commits or PRs, each self-contained and each leaving the system green.
git reset --mixed <base> first — a --soft reset leaves the whole diff staged in the index, so the first git-commit would sweep in every sibling unit's files and collapse the stack; --mixed keeps the changes in the working tree but unstages them, so each unit stages cleanly. For file-level units, use git-commit / git-commit-push-pr once each unit's files are grouped. For partial-file (hunk-split) units, do not hand off to git-commit — it stages whole files by name and would re-stage the sibling units' hunks in the same file, collapsing the split back together. Instead stage the hunks directly (git add -p) and commit in place, then move to the next unit.gh pr create --base <prev-unit-branch>), not the repo default. Left to default, every later PR targets main and re-includes the earlier units, so the stack stops being independently reviewable.When the existing code isn't worth preserving, rebuild each unit cleanly.
git add -A && git commit) or git stash -u. Plain git stash and git diff > patch both omit untracked paths, so a bare patch must be paired with an archive of the untracked files. Confirm with the user before the destructive step, especially when the change is an uncommitted working tree.git-worktree / isolation: "worktree").Each unit — whether split off or rebuilt — goes through normal review as it lands: ce-quality-gate on touched files, then ce-review for substantial or risky units. Review the stack piece by piece; you do not wait for the whole set.
The loop terminates when every remaining piece is something a careful human can review with confidence. That is the exit condition — not a fully-specified plan, and not a green test suite alone.
ce-plan → ce-work — your normal build loop, upstream of this skill. It produces the diff; this skill carves it.ce-plan — the natural home for the Step 3 unit breakdown when the set warrants a durable plan with test scenarios and dependency ordering.ce-work — builds each unit on the rebuild path, and finishes any unit a split leaves incomplete.git-commit / git-commit-push-pr — create the commits/PRs for each unit in the stack.ce-quality-gate / ce-review — gate each unit as it lands; review incrementally, not in one giant pass.git-worktree — isolates parallel rebuild agents that touch overlapping files.orchestration — use when the parallel fan-out needs structured coordination beyond a single concurrent batch.Keep the user oriented with a compact status:
After the status, recommend what to run next and fire it — do not end on a bare status. The menu is gated by the carve state, not a fixed list: show only the options that fit, mark the recommended one, and renumber so options stay contiguous from 1.
Use the platform's blocking question tool (AskUserQuestion in Claude Code, request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension)). In Claude Code, call ToolSearch with select:AskUserQuestion first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to a numbered chat list ("Pick a number or describe what you want.") only when no blocking tool exists or the call errors. Act on the selection — invoke the routed skill via the platform's skill primitive — do not merely name it.
Gate the options on the carve state:
ce-plan (recommended).ce-work on that unit.ce-quality-gate then ce-review on that unit, incrementally — not one giant pass.git-commit / git-commit-push-pr for that unit in the stack.Always include a Done for now option that ends the turn with the stack/dispatch state saved.
Sub-step guard: When another skill invoked this as a sub-step, skip the menu — return the status and let the caller route. Present the menu only when this skill owns the turn's endpoint.