PR

processing-api-batches

Implements batch processing to improve API performance, reduce request overhead, and manage concurrency efficiently.

Install

mkdir -p .claude/skills/processing-api-batches && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4739" && unzip -o skill.zip -d .claude/skills/processing-api-batches && rm skill.zip

Installs to .claude/skills/processing-api-batches

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Optimize bulk API requests with batching, throttling, and parallel execution.
77 charsno explicit “when” trigger
Advanced

Key capabilities

  • Convert sequential API loops into batch requests
  • Implement concurrency control for parallel execution
  • Handle partial failure status reporting
  • Track long-running batch progress via Redis
  • Enforce batch size limits and validation

How it works

It identifies high-frequency loop operations and replaces them with batch endpoints that support synchronous processing for small batches and asynchronous background workers for large ones.

Inputs & outputs

You give it
Array of API operations
You get back
Per-item success or failure status

When to use processing-api-batches

  • Convert sequential API loops into batch requests
  • Optimize database bulk insertion performance
  • Implement rate-limited parallel API execution
  • Handle partial failure status reporting for batch operations

About this skill

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

  1. Examine existing API endpoints using Read and Grep to identify operations frequently called in loops by consumers, which are candidates for batch equivalents.
  2. Design the batch request format: accept an array of operations in the request body, each with an optional client-provided id for result correlation, e.g., POST /batch with {operations: [{method: "POST", path: "/users", body: {...}, id: "op1"}]}.
  3. 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.
  4. Add asynchronous batch processing for large batches (> 100 items): accept the batch, return 202 Accepted with a batchId and status polling URL, process in a background worker, and update progress in Redis.
  5. Implement concurrency control: process batch items in parallel with configurable concurrency limit (default: 10) using p-limit or asyncio.Semaphore to prevent database connection exhaustion.
  6. 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).
  7. Add progress tracking for async batches: expose GET /batch/:batchId/status returning {total, completed, failed, progress: 0.75, status: "processing|completed|failed"}.
  8. 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.
  9. Write tests covering: small sync batches, large async batches, partial failure handling, progress tracking, concurrency limits, and batch size validation.

See ${CLAUDE_SKILL_DIR}/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

ErrorCauseSolution
413 Payload Too LargeBatch exceeds maximum item count (1000) or body size limitReturn clear error with maximum allowed count; suggest splitting into multiple batch requests
207 Multi-StatusSome batch items succeeded while others failedReturn per-item status array; include error details for failed items; provide summary counts
408 Batch TimeoutSynchronous batch processing exceeded request timeoutSwitch to async processing for large batches; return 202 with status polling URL
Partial transaction failureDatabase transaction rolls back all items due to one failureUse savepoints for per-item isolation; or process items individually outside a wrapping transaction
Progress tracking staleWorker crashed mid-batch; progress stops updatingImplement heartbeat monitoring; mark batch as failed after heartbeat timeout; enable retry from last checkpoint

Refer to ${CLAUDE_SKILL_DIR}/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.

Idempotent batch retry: Client includes idempotencyKey per batch item; on retry, already-completed items return their cached result without re-execution, while failed items are re-attempted.

See ${CLAUDE_SKILL_DIR}/references/examples.md for additional examples.

Resources

When not to use it

  • Processing single, non-repetitive API calls
  • Systems without bulk database operation support

Prerequisites

Web framework with large body size limitsDatabase with bulk operation supportQueue system for async processingRedis for progress tracking

Limitations

  • Maximum 1000 items per batch
  • Requires Redis for async progress tracking

How it compares

It automates the transition from sequential request loops to structured batch processing with built-in concurrency and progress monitoring.

Compared to similar skills

processing-api-batches side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
processing-api-batches (this skill)127dReviewAdvanced
optimizing-performance12moReviewIntermediate
caching-strategies16moNo flagsIntermediate
senior-backend147moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

Search skills

Search the agent skills registry