Concurrency safe tool batching

From ychampion/cskill-agents · View interactive version

Concurrency safe tool batching is an AI agent skill from the GitHub repository ychampion/cskill-agents. Group tool calls into concurrency-safe batches to run read-only calls in parallel while serializing non-read-only work.

How to use this skill

Skill file

SKILL: Concurrency-Safe Tool Batching

Domain: tool-orchestration

Trigger: Use when one turn contains multiple tool calls and some are safe to run together while others mutate state or require exclusive execution.

Source Pattern: Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.

Core Method

Partition the requested tool calls into successive batches where each batch is either a set of read-only calls that may run together or a single exclusive call that must run alone. Decide concurrency safety from each tool’s declared behavior and validated inputs, not from naming conventions. Execute safe batches in parallel, then apply any shared-context updates only after the whole batch completes. Run mutating or stateful tools one at a time so ordering and side effects remain deterministic.

Key Rules

Example Application

When building a CLI tool runner, first group together safe read-only lookups like file reads or searches, run that group in parallel, then execute any edit, write, or stateful shell step on its own. This gives you parallelism where it is safe without letting mutating tools race each other.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.