Recursive Decomposition Skill Handle long-context tasks with Claude Code through recursive decomposition What It Does • Installation • How It Works • Benchmarks • Acknowledgments When analyzing large codebases, processing many documents, or aggregating information across dozens of files, Claude's context window becomes a bottleneck. As context grows, "context rot" degrades performance: - Missed de
Add this skill
npx mdskills install massimodeluisa/recursive-decomposition-skillStrong documentation for handling large-scale tasks, but actual skill instructions not visible
1<p align="center">2 <img src="assets/logo.png" alt="Recursive Decomposition Skill" width="200">3</p>45<h1 align="center">Recursive Decomposition Skill</h1>67<p align="center">8 <strong>Handle long-context tasks with Claude Code through recursive decomposition</strong>9</p>1011<p align="center">12 <a href="#installation"><img src="https://img.shields.io/badge/Claude_Code-Plugin-blueviolet?style=flat-square" alt="Claude Code Plugin"></a>13 <a href="https://arxiv.org/abs/2512.24601"><img src="https://img.shields.io/badge/arXiv-2512.24601-b31b1b?style=flat-square" alt="arXiv Paper"></a>14 <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green?style=flat-square" alt="MIT License"></a>15 <a href="https://agentskills.io"><img src="https://img.shields.io/badge/Format-Agent_Skills-orange?style=flat-square" alt="Agent Skills Format"></a>16</p>1718<p align="center">19 <a href="#what-it-does">What It Does</a> •20 <a href="#installation">Installation</a> •21 <a href="#usage">Usage</a> •22 <a href="#how-it-works">How It Works</a> •23 <a href="#benchmarks">Benchmarks</a> •24 <a href="#acknowledgments">Acknowledgments</a>25</p>2627---2829## The Problem3031When analyzing large codebases, processing many documents, or aggregating information across dozens of files, Claude's context window becomes a bottleneck. As context grows, **"context rot"** degrades performance:3233- Missed details in long documents34- Decreased accuracy on information retrieval35- Hallucinated connections between distant content36- Degraded reasoning over large evidence sets3738## The Solution3940This skill implements **Recursive Language Model (RLM)** strategies from [Zhang, Kraska, and Khattab's 2025 research](https://arxiv.org/abs/2512.24601), enabling Claude Code to handle inputs **up to 2 orders of magnitude beyond normal context limits**.4142Instead of cramming everything into context, Claude learns to:43441. **Filter** — Narrow search space before deep analysis452. **Chunk** — Partition inputs strategically463. **Recurse** — Spawn sub-agents for independent segments474. **Verify** — Re-check answers on smaller, focused windows485. **Synthesize** — Aggregate results programmatically4950---5152## What It Does5354| Task Type | Without Skill | With Skill |55|-----------|---------------|------------|56| Analyze 100+ files | Context overflow / degraded results | Systematic coverage via decomposition |57| Multi-document QA | Missed information | Comprehensive extraction |58| Codebase-wide search | Manual iteration | Parallel sub-agent analysis |59| Information aggregation | Incomplete synthesis | Map-reduce pattern |6061### Real Test Results6263We tested on the [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook) (196 files, 356MB):6465```66Task: "Find all Anthropic API calling patterns across the codebase"6768Results:69├── Files scanned: 14270├── Files with API calls: 1871├── Patterns identified: 8 distinct patterns72├── Anti-patterns detected: 473└── Output: Comprehensive report with file:line references74```7576---7778## Installation7980### Via Claude Code Marketplace8182```bash83# Add the marketplace84claude plugin marketplace add massimodeluisa/recursive-decomposition-skill8586# Install the plugin87claude plugin install recursive-decomposition@recursive-decomposition88```8990### From Local Clone9192```bash93# Clone the repository94git clone https://github.com/massimodeluisa/recursive-decomposition-skill.git ~/recursive-decomposition-skill9596# Add as local marketplace97claude plugin marketplace add ~/recursive-decomposition-skill9899# Install the plugin100claude plugin install recursive-decomposition101```102103### Manual Installation (Skills Directory)104105```bash106# Copy skill directly to Claude's skills directory107cp -r plugins/recursive-decomposition/skills/recursive-decomposition ~/.claude/skills/108```109110After installation, **restart Claude Code** for the skill to take effect.111112### Updating113114```bash115# Update marketplace index116claude plugin marketplace update117118# Update the plugin119claude plugin update recursive-decomposition@recursive-decomposition120```121122---123124## Usage125126The skill activates automatically when you describe tasks involving:127128- Large-scale file analysis (`"analyze all files in..."`)129- Multi-document processing (`"aggregate information from..."`)130- Codebase-wide searches (`"find all occurrences across..."`)131- Long-context reasoning (`"summarize these 50 documents..."`)132133### Example Prompts134135```136"Analyze error handling patterns across this entire codebase"137138"Find all TODO comments in the project and categorize by priority"139140"What API endpoints are defined across all route files?"141142"Summarize the key decisions from all meeting notes in /docs"143144"Find security vulnerabilities across all Python files"145```146147### Trigger Phrases148149The skill recognizes these patterns:150- `"analyze all files"`151- `"process this large document"`152- `"aggregate information from"`153- `"search across the codebase"`154- Tasks involving 10+ files or 50k+ tokens155156---157158## When to Use159160The skill is designed for **complex, long-context tasks**. Use it when:161162- Analyzing 10+ files simultaneously163- Processing documents exceeding 50k tokens164- Performing codebase-wide pattern analysis165- Extracting information from multiple scattered sources166- Multi-hop reasoning requiring evidence synthesis167168**When NOT to use:**169170- Single file edits → Direct processing is faster171- Specific function lookup → Use Grep directly172- Tasks < 30k tokens → Overhead not worth it173- Time-critical operations → Latency matters more than completeness174175---176177## How It Works178179### Decomposition Strategies180181#### 1. Filter Before Deep Analysis182```1831000 files → Glob filter → 100 files184100 files → Grep filter → 20 files18520 files → Deep analysis186```187**Result:** 50x reduction before expensive processing188189#### 2. Strategic Chunking190- **Uniform:** Split by line count or natural boundaries191- **Semantic:** Partition by logical units (functions, classes)192- **Keyword-based:** Group by shared characteristics193194#### 3. Parallel Sub-Agents195```196Main Agent197├── Sub-Agent 1 (Batch A) ─┐198├── Sub-Agent 2 (Batch B) ─┼── Parallel199├── Sub-Agent 3 (Batch C) ─┘200└── Synthesize results201```202203#### 4. Verification Pass204Re-check synthesized answers against focused evidence to catch context rot errors.205206---207208## Benchmarks209210From the [RLM paper](https://arxiv.org/abs/2512.24601):211212| Task | Direct Model | With RLM | Improvement |213|------|--------------|----------|-------------|214| Multi-hop QA (6-11M tokens) | 70% | 91% | **+21%** |215| Linear aggregation | Baseline | +28-33% | **Significant** |216| Quadratic reasoning | <0.1% | 58% | **Massive** |217| Context scaling | 2^14 tokens | 2^18 tokens | **16x** |218219**Cost:** RLM approaches are ~3x cheaper than summarization baselines while achieving superior quality.220221---222223## Repository Structure224225```226recursive-decomposition-skill/227├── .claude-plugin/228│ └── marketplace.json # Marketplace manifest229├── plugins/230│ └── recursive-decomposition/231│ ├── .claude-plugin/232│ │ └── plugin.json # Plugin manifest233│ ├── README.md # Plugin documentation234│ └── skills/235│ └── recursive-decomposition/236│ ├── SKILL.md # Core skill instructions237│ └── references/238│ ├── rlm-strategies.md239│ ├── cost-analysis.md240│ ├── codebase-analysis.md241│ └── document-aggregation.md242├── assets/243│ └── logo.png # Project logo244├── AGENTS.md # Agent-facing docs245├── CONTRIBUTING.md # Contribution guidelines246├── LICENSE247└── README.md248```249250---251252## Skill Contents253254| File | Purpose |255|------|---------|256| [`SKILL.md`](plugins/recursive-decomposition/skills/recursive-decomposition/SKILL.md) | Core decomposition strategies and patterns |257| [`references/rlm-strategies.md`](plugins/recursive-decomposition/skills/recursive-decomposition/references/rlm-strategies.md) | Detailed techniques from the RLM paper |258| [`references/cost-analysis.md`](plugins/recursive-decomposition/skills/recursive-decomposition/references/cost-analysis.md) | When to use recursive vs. direct approaches |259| [`references/codebase-analysis.md`](plugins/recursive-decomposition/skills/recursive-decomposition/references/codebase-analysis.md) | Full walkthrough: multi-file error handling analysis |260| [`references/document-aggregation.md`](plugins/recursive-decomposition/skills/recursive-decomposition/references/document-aggregation.md) | Full walkthrough: multi-document feature extraction |261262---263264## Acknowledgments265266This skill is based on the **Recursive Language Models** research paper. Huge thanks to the authors for their groundbreaking work:267268<table>269 <tr>270 <td align="center">271 <a href="https://x.com/a1zhang">272 <b>Alex L. Zhang</b>273 </a>274 <br>275 <a href="https://x.com/a1zhang">@a1zhang</a>276 <br>277 <sub>MIT CSAIL</sub>278 </td>279 <td align="center">280 <a href="https://x.com/tim_kraska">281 <b>Tim Kraska</b>282 </a>283 <br>284 <a href="https://x.com/tim_kraska">@tim_kraska</a>285 <br>286 <sub>MIT Professor</sub>287 </td>288 <td align="center">289 <a href="https://x.com/lateinteraction">290 <b>Omar Khattab</b>291 </a>292 <br>293 <a href="https://x.com/lateinteraction">@lateinteraction</a>294 <br>295 <sub>MIT CSAIL, Creator of DSPy</sub>296 </td>297 </tr>298</table>299300### Paper301302> **Recursive Language Models**303>304> *Alex L. Zhang, Tim Kraska, Omar Khattab*305>306> arXiv:2512.24601 • December 2025307>308> We propose Recursive Language Models (RLMs), an inference technique enabling LLMs to handle prompts up to two orders of magnitude beyond model context windows through programmatic decomposition and recursive self-invocation over prompt segments.309310<p>311 <a href="https://arxiv.org/abs/2512.24601"><img src="https://img.shields.io/badge/arXiv-2512.24601-b31b1b?style=for-the-badge" alt="arXiv Paper"></a>312 <a href="https://arxiv.org/pdf/2512.24601"><img src="https://img.shields.io/badge/PDF-Download-blue?style=for-the-badge" alt="PDF Download"></a>313</p>314315---316317## References318319- [Agent Skills Specification](https://agentskills.io/specification)320- [Claude Code Documentation](https://docs.anthropic.com/claude-code)321322---323324## Contributing325326Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.327328---329330## Author331332<p>333 <a href="https://x.com/massimodeluisa">334 <img src="https://img.shields.io/badge/X-@massimodeluisa-000000?style=flat-square&logo=x" alt="X (Twitter)">335 </a>336 <a href="https://github.com/massimodeluisa">337 <img src="https://img.shields.io/badge/GitHub-massimodeluisa-181717?style=flat-square&logo=github" alt="GitHub">338 </a>339</p>340341**Massimo De Luisa** — [@massimodeluisa](https://x.com/massimodeluisa)342343---344345## License346347MIT License — see [LICENSE](LICENSE) for details.348349---350
Full transparency — inspect the skill content before installing.