processing-api-batches
БесплатноБез исполняемых скриптовНе проверенOptimize bulk API requests with batching, throttling, and parallel execution. Use when processing bulk API operations efficiently. Trigger with phrases like…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
Processing API Batches
Overview
Optimize bulk API operations with batch request endpoints, parallel execution with concurrency control, partial failure handling, and progress tracking. Implement batch processing patterns that accept arrays of operations in a single request, execute them efficiently with database bulk operations, and return per-item results with individual success/failure status.
Prerequisites
- Web framework capable of handling large request bodies (configure body size limits: 10MB+ for batch payloads)
- Database with bulk operation support (bulk insert, bulk update, transactions)
- Queue system for async batch processing: Bull/BullMQ (Node.js), Celery (Python), or SQS
- Progress tracking store (Redis) for long-running batch status polling
- Rate limiting aware of batch operations (count individual operations, not just requests)
Instructions
- Examine existing API endpoints using Read and Grep to identify operations frequently called in loops by consumers, which are candidates for batch equivalents.
- Design the batch request format: accept an array of operations in the request body, each with an optional client-provided
idfor result correlation, e.g.,POST /batchwith{operations: [{method: "POST", path: "/users", body: {...}, id: "op1"}]}. - Implement synchronous batch processing for small batches (< 100 items): validate all items, execute in a database transaction, and return per-item results with
{id, status, result|error}for each operation. - Add asynchronous batch processing for large batches (> 100 items): accept the batch, return 202 Accepted with a
batchIdand status polling URL, process in a background worker, and update progress in Redis. - Implement concurrency control: process batch items in parallel with configurable concurrency limit (default: 10) using
p-limitorasyncio.Semaphoreto prevent database connection exhaustion. - Handle partial failures: do not abort the entire batch when individual items fail; collect per-item results with success/failure status, and return the batch result with summary counts (
succeeded,failed,total). - Add progress tracking for async batches: expose
GET /batch/:batchId/statusreturning{total, completed, failed, progress: 0.75, status: "processing|completed|failed"}. - Implement batch size limits and validation: maximum 1000 items per batch, reject oversized batches with 413, validate all items before processing any, and return all validation errors upfront.
- Write tests covering: small sync batches, large async batches, partial failure handling, progress tracking, concurrency limits, and batch size validation.
See references/implementation.md for the full implementation guide.
Output
${CLAUDE_SKILL_DIR}/src/routes/batch.js- Batch request endpoint with sync/async routing${CLAUDE_SKILL_DIR}/src/batch/processor.js- Batch execution engine with concurrency control${CLAUDE_SKILL_DIR}/src/batch/validator.js- Batch request validation and size limit enforcement${CLAUDE_SKILL_DIR}/src/batch/progress.js- Redis-backed progress tracking for async batches${CLAUDE_SKILL_DIR}/src/batch/workers/- Background worker for async batch processing${CLAUDE_SKILL_DIR}/src/batch/results.js- Per-item result aggregation with summary statistics${CLAUDE_SKILL_DIR}/tests/batch/- Batch processing integration tests
Error Handling
| Error | Cause | Solution |
|---|---|---|
| 413 Payload Too Large | Batch exceeds maximum item count (1000) or body size limit | Return clear error with maximum allowed count; suggest splitting into multiple batch requests |
| 207 Multi-Status | Some batch items succeeded while others failed | Return per-item status array; include error details for failed items; provide summary counts |
| 408 Batch Timeout | Synchronous batch processing exceeded request timeout | Switch to async processing for large batches; return 202 with status polling URL |
| Partial transaction failure | Database transaction rolls back all items due to one failure | Use savepoints for per-item isolation; or process items individually outside a wrapping transaction |
| Progress tracking stale | Worker crashed mid-batch; progress stops updating | Implement heartbeat monitoring; mark batch as failed after heartbeat timeout; enable retry from last checkpoint |
Refer to references/errors.md for comprehensive error patterns.
Examples
Bulk user import: Accept a CSV-uploaded batch of 5000 user records via POST /batch/users/import, return 202 with batchId, process asynchronously with progress updates, and provide a downloadable results file when complete.
Multi-resource batch: Accept mixed operations in a single batch: [{method:"POST",path:"/users",...}, {method:"PUT",path:"/orders/123",...}, {method:"DELETE",path:"/products/456"}], executing each against the appropriate handler.
**Idem
Установить processing-api-batches в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGrepGlobBash(api:batch-*)Вложенные файлы
FAQ
Что делает скилл processing-api-batches?
Optimize bulk API requests with batching, throttling, and parallel execution. Use when processing bulk API operations efficiently. Trigger with phrases like "process bulk requests", "batch API calls", or "handle batch operations".
Как установить скилл processing-api-batches?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл processing-api-batches запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic