/laravel-ddd:decide-chunkingfrom laravel-ddd
When and how to process large datasets. Memory-efficient iteration.
Ships in laravel-ddd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
"Memory is finite. Chunk accordingly."
| Method | Use when | Because |
|---|---|---|
chunk() | Read and process in a callback, no writes | Offsets stay stable while the rows do |
chunkById() | The callback updates or deletes the rows | Offset paging skips rows the moment you mutate them |
cursor()/lazy() | Read-only streaming — exports, reports | One row in memory, no callback |
lazyById() | Streaming and mutating | Lazy iteration with the chunkById() guarantee |
Ask: "Am I modifying records during iteration?"
chunkById()chunk()cursor()| ❌ Don't | ✅ Do | Why |
|---|---|---|
| Break a chain into a temp per stage "for memory" | Break a chain only for readability | Every temp stays pinned for the scope's lifetime — measurably the worst variant, not the fix |
Break a chain for readability, never for memory. The memory lever is eager-vs-lazy — lazy(), cursor(), a builder chain — not syntax.
For concrete examples from this codebase, see examples.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub attac-t/the-foundry --plugin laravel-ddd47 skills in this plugin
/craft-contextCrafting Context Objects. Parameter encapsulation for complex operations.Other plugins' skills for the same job