massimodeluisa/recursive-decomposition-skill / skills/recursive-decomposition
recursive-decomposition
VerifiedDecompose dense codebase-wide, multi-document, PDF, and aggregation work even when the input fits the context window, following Recursive Language Models (Zhang, Kraska, Khattab, 2025). Use when the user asks to analyse all files, a whole repo, all docs, large PDFs, or to aggregate or multi-hop across scattered sources. Skip one file, one function, a single needle, or a one-page PDF conversion. Triggers: long context, context rot, large codebase, many files, all files, big document, multi-document, PDF, aggregate, summarize everything, codebase-wide, multi-hop, recursive, sub-agents, map-reduce.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.5 KB |
| evals/README.md | markdown | 2.3 KB |
| evals/evals.json | config | 1.2 KB |
| evals/gold/pdf-corpus.json | config | 253 B |
| evals/trigger-queries.json | config | 3.0 KB |
| references/codebase-analysis.md | markdown | 2.9 KB |
| references/cost-analysis.md | markdown | 3.8 KB |
| references/document-aggregation.md | markdown | 3.5 KB |
| references/rlm-strategies.md | markdown | 4.9 KB |
references/codebase-analysis.md
View on GitHub# Example: error handling across a codebase
Tool calls below use Claude Code names (`Glob`, `Grep`, `Task`); map them to your agent's file search, content search and sub-agent tools.
Walkthrough of the protocol on a made-up tree. File counts are the scenario, not a paper result.
## Task
"Analyze all error handling patterns in this codebase and report where they agree, where they diverge, and what to change."
## 1. Filter
```text
Glob("**/*.ts") → 450 files
Glob("**/*.tsx") → 120 files
total: 570 files
Grep("catch|throw|Error|exception", type="ts") → 89 files
Grep("try.*catch|\.catch\\(", type="ts") → 67 files
union: 102 files with error handling
```
Do not read the 570. Grep first.
## 2. Partition
```text
src/api/* 23 files batch A
src/services/* 31 files batch B
src/components/* 28 files batch C
src/utils/* 12 files batch D
other 8 files batch E
```
Five to ten files per batch is the skill default. These batches are larger; keep them only if each still fits a sub-agent window, or split again.
## 3. One sub-agent per batch
```text
Task(subagent_type="Explore", prompt="""
Analyze error handling in src/api/*.
For each file with error handling:
1. Identify error handling patterns used
2. Note any error types defined or caught
3. Check for consistent error propagation
4. Flag any unhandled promise rejections
Return structured findings.
""")
```
Launch A through E in parallel. Each brief must include the files, the question, and the output schema. Do not reuse the same query on overlapping files.
## 4. Merge
```text
A: HTTP errors, custom ApiError
B: service-level try/catch, logging
C: UI error boundaries, toasts
D: wrappers, validation errors
E: mixed, a few strays
```
## 5. Write the report from the merge
```text
API: ApiError, HttpError, ValidationError
service: ServiceError, DatabaseError
UI: error boundaries, user-facing messages
utils: generic wrappers
HTTP errors always carry a status code
DatabaseError drops the original error
add error codes the client can switch on
```
## 6. Spot-check
Re-read a handful of cited lines, not the 102 files:
```text
Is ApiError used throughout src/api/?
Does DatabaseError keep the stack?
Do error boundaries cover every route component?
```
If two batches disagree, re-read the conflict.
## Report shape
```markdown
# Error handling
102 files, four error families, three consistency bugs.
## Types
### API (src/api/)
- ApiError: HTTP errors
- ValidationError: bad requests
- AuthenticationError: auth failures
### Service (src/services/)
...
## What already agrees
1. API routes wrap handlers in try/catch
2. Errors include a request ID
## What does not
1. Some services swallow errors with no log
2. Database errors lose the original stack
## Changes
1. Error-code enum
2. Error boundary on the remaining routes
```
| | |
|-|-|
| Files after grep | 102 |
| Sub-agents | 5 |
| Tokens | spread across the five, not one 150k window |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |