agentleFS
unclejobs-aiunclejobs-ai/second-claude-code/skills/batch/SKILL.md

batch

Skill41 starsChanged 7 days agoMITView on GitHub

Use when decomposing large tasks into independent parallel units that do not depend on each other

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use simplify and verify.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Hugging FaceSkill

    simplify

    Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.

    Also in 4 projects that use this

  • Microsoft AzureSkill

    verify

    End-to-end app testing pipeline for browser-based web apps on cloud browsers via Azure Playwright Workspaces: verify the live app, author tests for working flows, heal failing tests, then re-run with video and produce one consolidated report. Three phases (app verification, test authoring, test healing) plus a scoped final sanity run; each phase emits a sub-report. Use when asked to "verify my app", "make sure my app works and has good test coverage", "do a full QA pass", "add tests where I'm missing coverage", "fix failing tests and add new ones", "smoke test before deploy", "QA my deployment", or any combined verify-and-test ask. Requires Azure CLI (`az login`) and a Playwright Workspace resource ID — bootstraps configs on first invocation. Browser-based web apps with Playwright only — not for unit/API tests, native mobile/desktop, load/perf, or full accessibility audits.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 6

    Distinctive

    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
  1. Distinctive:

    No unit uses another unit's output as input

    line 59
  2. Distinctive:

    If a candidate unit depends on another unit's output → merge them into one unit or flag as sequential

    line 61
  3. Distinctive:

    After approval, spawn one agent per unit.

    line 85
  4. Distinctive:

    After all units complete (or time out), produce a Batch Summary Report:

    line 110
  5. Distinctive:

    Worktree cleanup: After synthesis, discard unit worktrees.

    line 178
  6. Very specific:

    No cross-unit dependencies: If the user's requested task has inherent sequencing (e.g., part 2 builds on part 1's conclusion), this is not …

    line 179
  7. Distinctive:

    Partial failure is not total failure: If 2 of 10 units fail, deliver the 8 successes and report the 2 failures clearly.

    line 180

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Iron Law

Verify task independence before parallel execution.

Red Flags

  • "These tasks look independent enough" → STOP, because hidden output dependencies only surface after parallel dispatch wastes the full budget — verify independence rigorously before execution.
  • "Part 2 builds on part 1's conclusion but we can still batch them" → STOP, because inherent sequencing means this is not a batch job — route to workflow instead.
  • "Let's skip the approval step, the decomposition is obvious" → STOP, because the Approve gate is mandatory with no exceptions — decomposition errors are cheap to fix before execution and expensive after.
  • "10 units is fine, we have the budget" → STOP, because cost scales linearly (10 units = 10x a single invocation) — always show estimated cost at the Approve gate and get explicit approval.
  • "2 units failed but the other 8 are fine, just discard the failures" → STOP, because partial failure requires a clear failure report with error summaries and recommended actions — do not silently drop failed units.

Batch

Decompose large knowledge work tasks into independent parallel units, each executed in its own worktree. Inspired by Claude Code's /batch command — designed for high-volume, homogeneous content production.

When to Use

  • User needs 5+ similar artifacts produced from distinct source material (e.g., 10 newsletter issues, 8 competitor analyses)
  • The work has a clear unit of decomposition (by topic, by section, by competitor, by framework)
  • Sequential execution would take too long and units do not depend on each other
  • Output quality benefits from independent focus per unit rather than a shared context window

Workflow

1. Analyze

Dispatch an Explore agent to understand the full scope of the request:

  • How many units does the task naturally decompose into?
  • What is the unit type: topic, competitor, framework, section, time period, persona?
  • What skill handles each unit (default: write)?
  • What shared context applies to all units (format, voice, audience, constraints)?

2. Decompose

Break the task into 2–10 independent units. Each unit specification must include:

unit:
  id: <integer, 1-indexed>
  label: <short human-readable title>
  topic: <specific topic for this unit — no overlap with other units>
  skill: <write|research|analyze|review|refine>
  output: <file path: .captures/batch-{run_id}/{slug}.md>
  shared_context: <reference to shared context block>

Independence requirements (non-negotiable):

  • Each unit produces a separate output file
  • No unit uses another unit's output as input
  • Units can complete in any order without inconsistency
  • If a candidate unit depends on another unit's output → merge them into one unit or flag as sequential

Unit count limits:

  • Minimum: 2 (batching 1 unit is a no-op)
  • Default maximum: 10
  • Override with --units N

3. Approve

Present the full decomposition plan to the user before any execution begins. This gate is mandatory — no exceptions.

Present as a table:

#LabelTopicSkillOutput File
1......write.captures/batch-{run_id}/01-slug.md
2......write.captures/batch-{run_id}/02-slug.md

Show: total units, estimated cost (units × avg token cost), parallelism setting.

Wait for explicit approval. On rejection: re-decompose with user's feedback and re-present.

4. Execute

After approval, spawn one agent per unit. Each agent runs in an isolated worktree:

isolation: worktree
worktree_path: worktree-batch-{run_id}-unit-{id}

Concurrency is capped at --parallel (default: 3). Units beyond the cap queue and start as slots open.

Each unit agent receives:

  • The unit specification (topic, skill, output path)
  • The shared context block
  • The selected skill's full instruction set

5. Monitor

Track status per unit: PENDING | RUNNING | DONE | FAILED.

Print a live status table as units complete. On unit failure:

  • Log the failure with the unit's error
  • Continue remaining units (do not abort the batch)
  • Collect all failures for the synthesis report

6. Synthesize

After all units complete (or time out), produce a Batch Summary Report:

## Batch Summary — {topic} ({YYYY-MM-DD})

Units: {done}/{total} completed
Failed: {failed_ids} (if any)

### Output Files
| # | Label | Status | Path |
|---|-------|--------|------|
...

### Synthesis
{Optional: if --synthesize is set, produce a combined document merging all outputs}

### Failures
{For each failed unit: label, error summary, recommended action}

Save report to .captures/batch-{run_id}/00-summary.md.

Options

FlagValuesDefaultEffect
--units Ninteger 2–10auto (up to 10)Override max unit count
--skillwrite|research|analyze|refinewriteSkill each unit runs
--topicstring(required)The overarching topic being decomposed
--parallelinteger 1–53Max concurrent unit agents
--synthesizeflagoffAfter all units complete, merge outputs into one document
--langko|enkoOutput language passed to each unit skill
--formatwrite-skill formatsarticlePassed to each unit's write skill

State

State persisted at .data/state/batch-{run_id}.json. Schema:

{
  "run_id": "batch-{timestamp}",
  "topic": "...",
  "status": "PENDING | RUNNING | DONE | FAILED",
  "units": [...],
  "parallel": 3,
  "created_at": "ISO-8601",
  "completed_at": "ISO-8601 | null"
}

Subagents

These are configurations for general-purpose subagents, not entries in agents/. There is no decomposer agent to dispatch by name — spawn a general-purpose subagent with the model, tools, and constraint below. (Contrast /scc:review, whose roles are real subagent_type values.)

explorer:   { model: haiku,  tools: [Read], constraint: "scope analysis only, no writing" }
decomposer: { model: sonnet, tools: [],     constraint: "produce unit specs, verify independence" }
unit_agent: { model: varies, isolation: worktree, constraint: "run assigned skill, write to assigned output path only" }
synthesizer: { model: opus,  tools: [Read, Write], constraint: "merge outputs faithfully, no hallucinated content" }

Gotchas

  • Cost scales linearly: 10 units × write skill cost = 10× a single write invocation. Always show estimated cost at the Approve gate.
  • Decomposition quality determines output quality: Vague unit topics produce vague output. If the topic cannot be made specific, ask the user before decomposing.
  • Never skip the Approve gate: Decomposition errors are cheap to fix before execution and expensive after.
  • Worktree cleanup: After synthesis, discard unit worktrees. Do not leave orphaned worktrees.
  • No cross-unit dependencies: If the user's requested task has inherent sequencing (e.g., part 2 builds on part 1's conclusion), this is not a batch job — route to workflow instead.
  • Partial failure is not total failure: If 2 of 10 units fail, deliver the 8 successes and report the 2 failures clearly. Do not withhold completed work.

See references/decomposition-guide.md for split strategies, anti-patterns, and merge strategies.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.