godmode:decompose
Skill1 starsChanged 56 days agoMITView on GitHub
Use when the user wants to break up a large diff, PR, or branch into smaller independent PRs or branches. Handles mechanical analysis (file-to-crate mapping, concern classification, coupling detection), proposes a decomposition plan, requires explicit approval, then executes the split (creates branches, stages subsets, runs taskit check compile per split, optionally opens PRs). Trigger on "decompose this PR", "split this branch", "this diff is too big", "break this into smaller PRs", "make this reviewable", "/decompose", or any request to split a large changeset into independent units.
- Commits and pushes
In this repository76 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- godmode:agent-governanceSkill
- godmode:agent-improvement-loopSkill
- agents-skill-saveSkill
- baml-add-typesSkill
- godmode:brainstormSkill
- godmode:capSkill
- godmode:changelogSkill
- godmode:ci-fixSkill
- godmode:code-reviewSkill
- godmode:context-mapSkill
- godmode:cross-issueSkill
- godmode:crs-discoverSkill
- godmode:crs-hook-testingSkill
- godmode:crs-installSkill
- godmode:crs-propose-rulesSkill
- godmode:crs-validateSkill
- godmode:dead-codeSkill
- godmode:dep-auditSkill
- godmode:dep-bumpSkill
- godmode:designSkill
- devloop-session-primerSkill
- godmode:dialecticSkill
- godmode:doc-maintainerSkill
- godmode:doc-reviewSkill
- godmode:doc-syncSkill
- godmode:doc-writerSkill
- doob-db-inspectorSkill
- doob-release-managerSkill
- godmode:doublecheckSkill
- dual-forge-pr-mergeSkill
- gh-bulk-issuesSkill
- godmode:health-scoreSkill
- godmode:ingestSkill
- godmode:introspectionSkill
- godmode:issue-triageSkill
- godmode:memory-bankingSkill
- godmode:mergeSkill
- godmode:mini-context-graphSkill
- godmode:mistake-trackerSkill
- godmode:moaSkill
- notfiles-release-workflowSkill
- godmode:observability-as-infrastructureSkill
- godmode:parallel-agentsSkill
- godmode:pattern-learnerSkill
- planning-with-cruxSkill
- godmode:pr-authorSkill
- godmode:receiving-reviewSkill
- godmode:refactoringSkill
- godmode:release-notesSkill
- release-readiness-checkSkill
- remote-upstream-triageSkill
- repo-gap-backlogSkill
- godmode:rust-conventionsSkill
- rustqualSkill
- rustqual-workspaceSkill
- rust-release-workflow-authorSkill
- godmode:self-reflectSkill
- session-wrap-commit-pushSkill
- godmode:systematic-debuggingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
If the branch has more than one commit, also inspect the commit log for structure clues:
- Distinctive: line 63
Run the analyzer. This is deterministic — no LLM judgment yet.
- Distinctive: line 88
Read and summarize the report.
- Distinctive: line 144
Run the splitter for each approved split:
- Distinctive: line 163
If checks pass: commits with a conventional message
- Distinctive: line 164
If checks fail: reports failure, rolls back the branch, stops — does not continue to next split
- Distinctive: line 168
After all splits pass:
- Distinctive: line 185
If the user wants PRs opened:
- Very specific: line 229
If any split failed verification, list it as FAILED with the failure summary.
- Distinctive: line 236
Source branch is read-only: Never commit to it, never delete it.
- Distinctive: line 237
Plan approval is required: No git mutations before the user says go.
- Distinctive: line 240
Coverage check: After all splits, verify every changed file appears in exactly one split.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
godmode:decompose — Diff Decomposition Agent
Splits a large diff or branch into independent, reviewable units. Mechanical analysis runs first and is fully verifiable. LLM judgment is used only where the mechanical analysis is ambiguous — and always requires explicit user approval before any git mutations occur.
Helpers
| File | Purpose |
helpers/analyze-diff.nu | Mechanical analysis: file→crate map, concern classification, coupling detection |
helpers/split-branch.nu | Branch creation, file staging, per-split verification loop |
helpers/decompose-proptest.rs | Property tests for grouping and coverage invariants |
references/split-strategies.md | Decision guide for ambiguous grouping calls |
Step 0 — Identify the input
Determine what to decompose:
# Option A: current branch vs main
git diff main...HEAD --name-only
# Option B: a specific PR
gh pr diff <number> --name-only
# Option C: patch file provided by user — read it directlyIf the branch has more than one commit, also inspect the commit log for structure clues:
git log --oneline main..HEADRecord:
- Source branch: the branch being decomposed (never modified)
- Base: the branch to split against (default:
main) - Changed files: full list with paths
Step 1 — Mechanical analysis
Run the analyzer. This is deterministic — no LLM judgment yet.
nu skills/decompose/helpers/analyze-diff.nu \
--base main \
--branch $(git branch --show-current) \
| save --force .ctx/godmode/decomps/$(git branch --show-current | str replace '/' '-')-analysis.jsonThe analyzer produces a JSON report with:
{
"files": [...],
"crate_groups": { "crate-name": ["path/to/file.rs", ...] },
"concern_groups": { "tests": [...], "deps": [...], "docs": [...], "logic": [...] },
"coupling_warnings": [
{ "files": ["a.rs", "b.rs"], "reason": "shared import: crate::foo::Bar" }
],
"proposed_splits": [
{ "id": 1, "files": [...], "crate": "crate-name", "concern": "logic", "coupled_to": [] }
]
}Read and summarize the report. Surface all coupling warnings — these are files the mechanical analysis grouped separately but that share a type or module import. They may need to move together.
Step 2 — LLM review of proposed splits
Review the mechanical groupings with judgment:
- Check coupling warnings — if two proposed splits share a public API type or trait impl,
merge them. The mechanical analysis detects imports but not semantic dependency. Read
references/split-strategies.mdfor decision heuristics. - Check group sizes — a split with 1 file and a split with 40 files suggests the coarse grouping needs subdivision. Apply concern sub-classification (see split strategies).
- Name each split — use a conventional branch name:
<source-branch>-split-<N>-<scope>(e.g.,feat/auth-split-1-core,feat/auth-split-2-tests) - Write a one-line rationale for each split: why these files belong together and why they are independent from the other splits.
Step 3 — Present the decomposition plan
Show the full plan before doing anything. Format:
Decomposition plan for: <branch> (N files changed)
Split 1: <name>
Branch: <branch-name>
Files: N files
- crates/foo/src/lib.rs
- crates/foo/src/bar.rs
Rationale: <one line>
Coupling risk: none | <warning if any>
Split 2: <name>
...
Coupling warnings (review before approving):
- a.rs and b.rs both import crate::foo::Bar — confirm they can ship independently
Dry run? [y/n] — reply 'go' to execute, 'adjust' to modify the plan, or give me new groupings.Do not proceed until the user explicitly confirms. This is the guardrail. Every split that is created after this point was approved by the user.
Step 4 — Execute the splits
Run the splitter for each approved split:
nu skills/decompose/helpers/split-branch.nu \
--source <source-branch> \
--base main \
--split-id 1 \
--branch <split-branch-name> \
--files "path/a.rs path/b.rs ..." \
--output-dir .ctx/godmode/decomps/<decomp-name>The splitter:
- Checks out
main(or base) - Creates the split branch
- Cherry-picks by file:
git checkout <source-branch> -- <files> - Runs
taskit check compile - Runs
taskit test run(or scoped to affected crates) - If checks pass: commits with a conventional message
- If checks fail: reports failure, rolls back the branch, stops — does not continue to next split
Process splits sequentially, not in parallel. A failing split must be resolved before continuing.
After all splits pass:
# Verify no file was dropped — writes result to .ctx/godmode/decomps/
nu skills/decompose/helpers/analyze-diff.nu --verify-coverage \
--source <source-branch> \
--splits "split-1-branch split-2-branch ..." \
| save --force .ctx/godmode/decomps/<decomp-name>/coverage.jsonCoverage check: the union of all split files must equal the source branch file list. Report any files that appear in the source but no split (orphaned files).
Step 5 — Open PRs (optional)
If the user wants PRs opened:
gh pr create \
--base main \
--head <split-branch> \
--title "<conventional title for this split>" \
--body-file - <<'EOF'
## Summary
<rationale from plan>
## Part of
Decomposed from #<original-PR-number-or-branch>.
Depends on: #<prior-split-PR> (if sequential dependency exists)
## Files
- crates/foo/src/lib.rs
- crates/foo/src/bar.rs
## Test plan
- [ ] taskit test run passes
- [ ] clippy clean
EOFPrint each PR URL as it's created.
Step 6 — Report
Decomposition complete: <source-branch> → N splits
Split 1: <name> | <sha> | PR #<N> <url>
Split 2: <name> | <sha> | PR #<N> <url>
...
Coverage: all N changed files accounted for.
Orphaned: none | <list if any>
Source branch <source-branch> was not modified.If any split failed verification, list it as FAILED with the failure summary. The source branch
is always intact regardless.
Guardrails
- Source branch is read-only. Never commit to it, never delete it. All splits branch from base.
- Plan approval is required. No git mutations before the user says go.
- Sequential verification. Each split must pass
taskit check compile+nextestbefore the next begins. A failing split halts the process — do not skip forward. - Coverage check. After all splits, verify every changed file appears in exactly one split. Files in multiple splits or no split are bugs.
- Coupling warnings are not blockers — but they must be shown. The user decides whether to merge the affected splits or accept the dependency.
- Dry-run by default on ambiguous inputs. If uncertain what the user wants decomposed, ask rather than acting.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

