Dev & Engineering

Recursive Decomposition Skill

For tasks spanning 10+ files or 50k+ tokens: split long-context work into chunks handled by parallel sub-agents, avoiding the accuracy loss of context rot.

59/ 100
Recommended

Generally reliable with disclosed limitations; trial as directed and keep a rollback path.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 52
Last updated
1mo ago
License
MIT
long-contextcontext-rotsub-agentsmap-reduce
+3codebase-analysisdocument-aggregationrecursive-decomposition

What does this skill do, and when should you use it?

An Agent Skill for Claude Code, Codex, Cursor and compatible agents, based on the Recursive Language Models (RLM) paper by Zhang, Kraska and Khattab (2025, arXiv:2512.24601). Instead of loading everything into the context window, it sizes the input, filters by search, chunks what remains, delegates independent batches to parallel sub-agents, verifies the merged answer on a small window, and synthesises programmatically. The paper reports RLM lifting multi-hop QA accuracy from 70% to 91% on 6–11M-token inputs at roughly one-third the cost of summarisation baselines. The skill is explicitly agent-agnostic and includes a table mapping each protocol step to equivalent tools across different agents.

Runs a six-step protocol: (1) size the input before reading anything (glob, find, wc -l, ls -lh, PDF page counts); (2) filter the search space with searches and file patterns rather than reads; (3) chunk what remains into batches of 5–10 files or natural units like functions and sections; (4) dispatch one sub-agent per batch with a self-contained brief (files, question, output schema), running batches in parallel; (5) spot-check the merged answer on a smaller window, settling disagreements with targeted re-reads; (6) aggregate, deduplicate and categorise programmatically, producing an answer with file and line references. SKILL.md also enforces hard rules: no single read over 2,000 lines or 50 KB, no more than 5 files in the main context without a written batch plan, and disjoint batches so the same content is never queried twice.

Good fit
  • A developer analysing patterns across an entire codebase (e.g. finding all error-handling styles) where the file count exceeds what fits in context
  • A product or engineering lead answering aggregation questions across dozens of PRDs or meeting notes, such as 'which features are planned across all documents'
  • A researcher or analyst summarising and prioritising large volumes of TODO/FIXME/HACK comments
  • Anyone producing very long output, generating sections independently into intermediate files and stitching them with a coherence pass
  • Work on a single oversized file (2,000+ lines, or PDFs over 100 pages) where a full read would drop details

How do you install this skill?

Before you use it
  • This is a static source review; no skill instructions were executed. Reliability conclusions rest on file self-consistency, not runtime verification.
  • Concrete numbers in the reference examples (file counts, feature counts, costs) are illustrative fiction and should not be read as test results.
  • The skill assumes a sub-agent/Task tool; in agents lacking one, the recursion step may not run as described and users must degrade to sequential processing themselves.
  • Performance figures in README and docs come from the RLM paper (arXiv:2512.24601), not independent reproduction of this skill; verify before relying on them.
  • For Chinese users: docs and examples are English-only with no Chinese support statement. Core function does not depend on overseas services, but the paper and the npx-based install CLI may be unstable from mainland-China networks.
Before you start
Your agent needs
  • Shell / CLI
  • Local filesystem
Install first
  • an agent with a sub-agent/task tool (Claude Code, Codex, Cursor, or Gemini CLI)

Three options: (1) via the skills CLI: npx skills add massimodeluisa/recursive-decomposition-skill, adding -g for user-level install or -a claude-code to target one agent; (2) as a Claude Code plugin: claude plugin marketplace add massimodeluisa/recursive-decomposition-skill then claude plugin install recursive-decomposition@recursive-decomposition-skill; (3) manually: copy the skills/recursive-decomposition folder into ~/.claude/skills/ (or your agent's skills directory) and restart the agent.

Generic route: install into Claude Code manually (macOS / Linux)
tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/massimodeluisa/recursive-decomposition-skill.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/recursive-decomposition" ~/.claude/skills/
rm -rf "$tmp"

Generated from the source repository and skill path; it copies only this skill's folder. If the author's install steps above differ, follow those first. To scope it to one project, replace ~/.claude/skills with that project's .claude/skills.

How do you use this skill?

Try saying

Once installed, send your agent any of these to trigger it:

  • Analyze error handling patterns across this entire codebase
  • Summarize the key decisions from all meeting notes in docs/

Run /recursive-decomposition to apply the protocol to the current task, or /recursive-decomposition src/ to size that input first, then run the protocol. The skill also self-activates on prompts like 'Analyze error handling patterns across this entire codebase' or 'Summarize the key decisions from all meeting notes in docs/'. For 30k–50k tokens decompose only when completeness matters; under 30k tokens, a single file, or a localized answer, read directly instead.

What are this skill's strengths and limitations?

Pros
  • Grounded in published research: RLM hits 91% on multi-hop QA versus 70% for the direct model, at about one-third the cost of summarisation baselines
  • Tested on the Anthropic Cookbook (196 files): 142 files scanned, 8 patterns and 4 anti-patterns reported with file:line references
  • Includes an anti-pattern table and hard rules (read by line range, disjoint batches), reducing misuse
  • Declared agent-agnostic, with a tool-mapping table plus reference docs on cost thresholds and worked examples
Limitations
  • The sub-agent delegation at its core assumes an agent with a task/sub-agent tool; pure API callers must implement that mechanism themselves
  • Decomposition spends coordination tokens — for small tasks (<30k tokens) it is counterproductive, as the skill itself advises reading directly
  • No automated test suite is mentioned in the README; compatibility with Cursor and Gemini CLI is claimed but unproven in the source
  • The RLM paper numbers come from the paper's own benchmarks and do not guarantee equivalent results on arbitrary codebases or document sets

How does this skill compare with similar options?

Side by side with related skills; every score comes from the same FSRS standard.

Skill FS score Stars Last updated License
Recursive Decomposition Skill this page 59 · Recommended ★ 52 1mo ago MIT
Model Hierarchy Routing Skill 56 · Use with care ★ 346 8mo ago MIT
Loop Library 55 · Use with care ★ 3.2k 3mo ago MIT
Claude Automation Advisor ✓ Anthropic · Official 50 · Use with care ★ 38k 11d ago Apache-2.0
NeMo MBridge Long-Context MoE Training ✓ NVIDIA · Official 48 · Use with care ★ 3.6k 11d ago Apache-2.0

The skill positions itself explicitly against 'load everything into context': decompose when a task exceeds 50k tokens or spans 10+ files, otherwise read directly. Within the paper, the comparison is summarisation baselines — RLM runs about 3x cheaper with higher accuracy on multi-hop tasks. No other competing skills are named in the source.

How did FollowSkills review this skill?

FollowSkills review · FSRS-2.0
Recommended
59/ 100 5-point scale 3.0 / 5
The upstream repository has new commits since this review. The score still applies to the reviewed revision shown and may not cover the latest changes.
1Trust20 / 25 · 4.0/5

Pure prompt skill: no scripts, no network calls, no sensitive-data handling; least privilege by construction. Rules mandate sizing before reading and bounded batches, so behavior is transparent. Deductions: no confirmation/rollback mechanisms; publisher identity unverified by the registry; README performance claims rest on a third-party paper rather than locally verifiable evidence.

2Reliability9 / 20 · 2.3/5

Instructions are self-consistent: thresholds (30k/50k, 2000-line, 5-10 files) agree across files; references cover the main paths; failure modes and mitigations get a dedicated section. Deductions: static review cannot execute anything, no committed tests prove key-path reproduction, and failure feedback on abnormal input (missing sub-agent tools, oversized PDFs) is only principled guidance — insufficient above anchor 10.

3Adaptability9 / 15 · 3.0/5

Trigger conditions, apply/non-apply boundaries (including a when-NOT-to-use list), and tool-agnostic mapping are clear across Claude Code, Codex, Cursor and Gemini CLI. Deductions: no Chinese-language support or localization; all examples in English; the sub-agent (Task/Explore) dependency is unavailable in some agent environments with no explicit degradation path.

4Convention11 / 15 · 3.7/5

Good layered architecture (protocol → references → worked examples), version 1.1.0, MIT license, CHANGELOG/CONVENTIONS/CONTRIBUTING present, plus a CI workflow validating format and skills-CLI discovery. Deductions: numbers in the reference examples (450 files, 46 features) are illustrative but not labeled as such, creating hidden assumptions; maintenance responsibility rests on an individual author with no stated update commitment.

5Effectiveness6 / 15 · 2.0/5

The core protocol is complete and operational: size-filter-chunk-recurse-verify-synthesise, with anti-patterns and a cost decision framework; marginal value over manual handling is clear. Deductions: static review cannot verify output direct-usability; performance figures (91%, 3x cheaper) cite the paper rather than independent reproduction of this skill; the README's Anthropic Cookbook test claim ships no raw data.

6Verifiability4 / 10 · 2.0/5

Auditable primary material exists: explicit arXiv citation, CI validating skill format, internally consistent references. Deductions: this is a static read with no third-party execution evidence covering key paths; CI checks format/discovery only, not decomposition behavior; the author's Cookbook test claim has no committed raw output to check.

1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Sep 10, 2026 Reviewed revision 72b209ab3492 Review evidence[1][2][3][4][5][6][7][8]

Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.

See the full review method →

FAQ

When should I NOT use this skill?
For inputs under 30k tokens, a single file, or a localized answer, read directly; a five-file task should not be decomposed — the skill's own anti-pattern table lists that as a mistake.
What does it need to run?
An agent that can run shell commands (find, wc, grep, sed), read and write the filesystem, and spawn sub-agents via a task tool. SKILL.md notes tool names differ across Claude Code, Codex, Cursor and Gemini CLI and maps each need to the equivalent.
Does using it guarantee accurate results?
No. Step 5 requires spot-checking the merged answer on a small window, and the rules mandate re-checking against sources before answering. Verification is built into the protocol but failure is still possible, especially with incomplete sub-agent briefs.
Is it cost-effective?
Decomposition spends coordination tokens, but the paper reports RLM runs about 3x cheaper than summarisation baselines while scaling from 2^14 to 2^18 tokens. The repo's references/cost-analysis.md covers thresholds and break-even points.

Related skills