一键导入
parallel
Use when processing multiple independent tasks with bounded concurrency to manage resource limits, avoid rate limits, or prevent system overload
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when processing multiple independent tasks with bounded concurrency to manage resource limits, avoid rate limits, or prevent system overload
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when writing, revising, or auditing a standalone Markdown explanation of a research paper. Produces image-supported, source-verified explanations for an average reader in the paper's field, prioritizes the paper's mechanisms and algorithms over background or benchmark dumps, checks appendices/code/official web resources, follows md-report-writer information-density rules, and runs separate Reviewer and Reader subagents.
Use when generating a physics or engineering experiment report from measured data and reference materials — orchestrates Theory, Data Analysis, Plotting, and Report sub-agents to produce a compiled LaTeX PDF. Also use for any sub-task in that pipeline: deriving formulas, analyzing lab data, plotting measurements with theory overlay, or writing/compiling the report.
Use when creating LaTeX Beamer presentation slides from documents, especially for academic presentations. Use when source document contains structured content with sections, subsections, or clear hierarchical organization that should be preserved in slides.
Professional LaTeX experiment report writing assistant for physics and engineering. Focuses on narrative flow, coherent explanations, proper academic style, structured content, and LaTeX best practices.
Use when writing math textbook content in XeLaTeX, including definitions, theorems, proofs, and section formatting in English or Chinese.
Use when enhancing existing lecture notes with multiple course source materials (recordings, PPT slides, existing notes)
| name | parallel |
| description | Use when processing multiple independent tasks with bounded concurrency to manage resource limits, avoid rate limits, or prevent system overload |
Manage a pool of subagents with a precise concurrency limit, dispatching new tasks immediately as slots free up. Unlike fire-all-at-once approaches, this maintains steady parallelism without overwhelming systems.
✅ Use when:
❌ Don't use when:
superpowers:dispatching-parallel-agents instead)1. INITIALIZE: Set concurrency limit (default 3), create task queue
2. DISPATCH: Fire min(limit, queue_size) subagents initially
3. WAIT: Monitor for ANY completion (not polling - check notification)
4. REFILL: When slot frees, immediately dispatch next task from queue
5. REPEAT: Until queue empty AND all slots free
Critical: Refill slots immediately when ANY completes, not "wait for all then dispatch next batch."
// Pool state management
const limit = 3; // or custom limit from args
const queue = [...tasks]; // remaining tasks
const running = new Set(); // currently-executing agent IDs
const results = []; // collected results
// Step 1: Initial dispatch (fill pool to limit)
for (let i = 0; i < Math.min(limit, queue.length); i++) {
const task = queue.shift();
const agent = dispatchAgent(task);
running.add(agent.id);
}
// Step 2: Monitor and refill loop
while (running.size > 0) {
// Wait for ANY completion to finish
const completed = awaitNextCompletion(running);
// Free the slot
running.delete(completed.agentId);
results.push(completed.result);
// Refill immediately if queue has tasks
if (queue.length > 0) {
const next = queue.shift();
const nextAgent = dispatchAgent(next);
running.add(nextAgent.id);
}
}
// running.size === 0 and queue.length === 0 means done
When a task fails, the slot must still free:
try {
const result = await agentCompletion;
results.push({success: true, data: result});
} catch (error) {
results.push({success: false, error: error.message});
// Slot still freed - running.delete() happens regardless
}
// Decide: retry (add back to queue) or log and skip?
if (shouldRetry(task, error)) {
queue.push(task); // will be re-dispatched
}
Principle: Failures are local. One task failing doesn't block the queue. Free the slot, decide retry/skip, continue.
| Operation | Pattern |
|---|---|
| Use default limit (3) | Initialize with limit = 3 |
| Specify custom limit | limit = 5 (or from args) |
| Track running state | Set<agentId> for O(1) add/remove/lookup |
| Refill on completion | if (queue.length > 0) dispatchNext() |
| Handle failure | try/catch, free slot regardless, decide retry |
| Mistake | Why It's Wrong | Fix |
|---|---|---|
| Fire all tasks at once | Violates limit, overwhelms system | Dispatch only min(limit, queue.length) initially |
| Batch-wait (wait ALL, then next) | Inefficient - slots sit idle | Refill immediately when ANY slot frees |
| No running state tracking | Can't enforce limit | Always maintain Set<agentId> of running agents |
| Forget to free slot on error | Pool eventually stalls | running.delete() in finally block or outside try/catch |
| Don't handle failures | Queue blocks on first error | Wrap in try/catch, log, free slot, continue |
| Polling for completions | Wastes cycles, inefficiency | Use notification-based "await next completion" |
Before using this pattern:
superpowers:dispatching-parallel-agents: Fire ALL agents at once in one block. Use when you need all results simultaneously and have no rate limits.superpowers:subagent-driven-development: Sequential execution (one task at a time). Use when tasks might conflict or need careful integration.parallel (this skill): Bounded pool with steady refill. Use when you need parallelism with resource constraints.Without pool management, agents either:
Pool management gives you controlled parallelism: steady throughput without resource spikes.