Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Process multiple documents in bulk with parallel execution. Use when a user asks to batch process files, convert many documents at once, run parallel file operations, bulk rename, bulk transform, or process a directory of files concurrently. Covers parallel execution, error handling, and progress tracking.
.claude/skills/terminalskills-batch-processor/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 55% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 62% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 39% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 33% | 0% |
Process multiple documents and files in bulk using parallel execution. Handles large-scale file operations including format conversion, data extraction, transformation, and validation across hundreds or thousands of files with configurable concurrency, error recovery, and progress reporting.
When a user asks for batch processing, determine which approach fits their needs:
For simple transformations, use xargs or GNU parallel:
bash# Convert all PNG files to JPEG using ImageMagick (8 parallel jobs) find ./images -name "*.png" | xargs -P 8 -I {} bash -c \ 'convert "$1" "${1%.png}.jpg"' _ {} # Process files with GNU parallel and progress bar find ./docs -name "*.csv" | parallel --bar --jobs 8 \ 'python transform.py {} {.}_processed.csv' # Bulk compress PDFs (4 parallel jobs) find ./reports -name "*.pdf" | xargs -P 4 -I {} bash -c \ 'gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \ -dNOPAUSE -dBATCH -sOutputFile="{}.compressed" "{}" && mv "{}.compressed" "{}"'
Create a reusable batch processing script:
pythonimport asyncio import os from pathlib import Path from dataclasses import dataclass, field @dataclass class BatchResult: total: int = 0 success: int = 0 failed: int = 0 errors: list = field(default_factory=list) async def process_file(filepath: Path, semaphore: asyncio.Semaphore) -> tuple[bool, str]: async with semaphore: try: # Replace with actual processing logic content = filepath.read_text() output = content.upper() # Example transformation out_path = filepath.with_suffix('.processed' + filepath.suffix) out_path.write_text(output) return True, str(filepath) except Exception as e: return False, f"{filepath}: {e}" async def batch_process( input_dir: str, pattern: str = "*.*", max_concurrent: int = 10 ) -> BatchResult: semaphore = asyncio.Semaphore(max_concurrent) files = list(Path(input_dir).glob(pattern)) result = BatchResult(total=len(files)) tasks = [process_file(f, semaphore) for f in files] for coro in asyncio.as_completed(tasks): success, msg = await coro if success: result.success += 1 else: result.failed += 1 result.errors.append(msg) # Progress reporting done = result.success + result.failed print(f"\rProgress: {done}/{result.total}", end="", flush=True) print() # Newline after progress return result if __name__ == "__main__": result = asyncio.run(batch_process("./input", pattern="*.txt", max_concurrent=8)) print(f"Done: {result.success} succeeded, {result.failed} failed") for err in result.errors: print(f" ERROR: {err}")
For long-running jobs, track progress and allow resuming:
pythonimport json from pathlib import Path PROGRESS_FILE = ".batch_progress.json" def load_progress() -> set: if Path(PROGRESS_FILE).exists(): return set(json.loads(Path(PROGRESS_FILE).read_text())) return set() def save_progress(completed: set): Path(PROGRESS_FILE).write_text(json.dumps(list(completed))) def batch_with_resume(input_dir: str, pattern: str = "*.*"): completed = load_progress() files = [f for f in Path(input_dir).glob(pattern) if str(f) not in completed] print(f"Resuming: {len(completed)} done, {len(files)} remaining") for i, filepath in enumerate(files): try: process_single_file(filepath) # Your processing function completed.add(str(filepath)) if i % 10 == 0: # Checkpoint every 10 files save_progress(completed) except KeyboardInterrupt: save_progress(completed) print(f"\nSaved progress at {len(completed)} files") raise except Exception as e: print(f"Error on {filepath}: {e}") save_progress(completed) Path(PROGRESS_FILE).unlink() # Clean up on completion
bash#!/bin/bash INPUT_DIR="$1" OUTPUT_DIR="$2" LOG_FILE="batch_$(date +%Y%m%d_%H%M%S).log" PARALLEL_JOBS=8 TOTAL=$(find "$INPUT_DIR" -type f | wc -l) COUNT=0 mkdir -p "$OUTPUT_DIR" process_file() { local file="$1" local outfile="$OUTPUT_DIR/$(basename "$file")" # Replace with your processing command cp "$file" "$outfile" 2>&1 echo $? } export -f process_file export OUTPUT_DIR find "$INPUT_DIR" -type f | parallel --jobs "$PARALLEL_JOBS" --bar \ --joblog "$LOG_FILE" process_file {} echo "Results logged to $LOG_FILE" awk 'NR>1 {if($7!=0) fail++; else ok++} END {print ok" succeeded, "fail" failed"}' "$LOG_FILE"
User request: "Convert all 200 Markdown files in docs/ to PDF"
bash# Install pandoc if needed # Process in parallel with 6 workers find ./docs -name "*.md" | parallel --bar --jobs 6 \ 'pandoc {} -o {.}.pdf --pdf-engine=xelatex' echo "Conversion complete. Check for errors above."
User request: "OCR all scanned documents in the scans/ folder"
bash# Using tesseract with parallel processing find ./scans -name "*.png" -o -name "*.jpg" | parallel --bar --jobs 4 \ 'tesseract {} {.} -l eng 2>/dev/null && echo "OK: {}"'
User request: "Resize all product images to 800px wide, keep aspect ratio"
bashmkdir -p ./resized find ./products -name "*.jpg" | xargs -P 8 -I {} bash -c \ 'convert "$1" -resize 800x -quality 85 "./resized/$(basename $1)"' _ {} echo "Resized $(ls ./resized | wc -l) images"
--dry-run flags in scripts to preview operations before executing.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-22 | fail→fail | 7,441 | 8,931 | +20% | 1 | 1 | 0% | 1,701 | 3,901 | +129% | 0 | 0 | — |
case-01 | fail→fail | 15,212 | 13,177 | -13% | 1 | 1 | 0% | 2,537 | 4,674 | +84% | 0 | 0 | — |
case-02 | fail→pass | 11,215 | 6,338 | -43% | 1 | 1 | 0% | 1,953 | 3,032 | +55% | 0 | 0 | — |
case-03 | fail→pass | 10,707 | 4,300 | -60% | 1 | 1 | 0% | 1,606 | 2,605 | +62% | 0 | 0 | — |
case-04 | pass→pass | 9,055 | 5,526 | -39% | 1 | 1 | 0% | 1,699 | 2,928 | +72% | 0 | 0 | — |
case-05 | fail→fail | 16,323 | 16,946 | +4% | 1 | 1 | 0% | 3,181 | 5,070 | +59% | 0 | 0 | — |
case-06 | fail→fail | 15,095 | 13,370 | -11% | 1 | 1 | 0% | 2,813 | 4,408 | +57% | 0 | 0 | — |
case-07 | fail→fail | 10,265 | 8,311 | -19% | 1 | 1 | 0% | 1,950 | 3,532 | +81% | 0 | 0 | — |
case-08 | fail→pass | 7,742 | 6,359 | -18% | 1 | 1 | 0% | 1,604 | 3,027 | +89% | 0 | 0 | — |
case-09 | fail→pass | 9,870 | 3,662 | -63% | 1 | 1 | 0% | 1,823 | 2,534 | +39% | 0 | 0 | — |
case-10 | fail→fail | 9,390 | 6,468 | -31% | 1 | 1 | 0% | 1,596 | 3,012 | +89% | 0 | 0 | — |
case-11 | pass→pass | 7,609 | 6,009 | -21% | 1 | 1 | 0% | 1,245 | 2,597 | +109% | 0 | 0 | — |
case-16 | pass→pass | 7,543 | 4,728 | -37% | 1 | 1 | 0% | 1,627 | 2,887 | +77% | 0 | 0 | — |
case-12 | fail→pass | 13,329 | 6,571 | -51% | 1 | 1 | 0% | 2,224 | 2,961 | +33% | 0 | 0 | — |
case-13 | pass→pass | 3,410 | 4,396 | +29% | 1 | 1 | 0% | 680 | 2,620 | +285% | 0 | 0 | — |
case-14 | fail→pass | 6,228 | 3,689 | -41% | 1 | 1 | 0% | 1,181 | 2,521 | +113% | 0 | 0 | — |
case-15 | fail→pass | 8,486 | 3,664 | -57% | 1 | 1 | 0% | 1,699 | 2,597 | +53% | 0 | 0 | — |
case-17 | pass→pass | 9,573 | 5,872 | -39% | 1 | 1 | 0% | 2,041 | 2,961 | +45% | 0 | 0 | — |
case-18 | pass→pass | 8,590 | 8,088 | -6% | 1 | 1 | 0% | 2,080 | 3,370 | +62% | 0 | 0 | — |
case-19 | pass→pass | 15,784 | 11,426 | -28% | 1 | 1 | 0% | 2,648 | 3,894 | +47% | 0 | 0 | — |
case-20 | pass→pass | 10,387 | 12,497 | +20% | 1 | 1 | 0% | 2,326 | 4,813 | +107% | 0 | 0 | — |
case-21 | pass→pass | 10,032 | 11,364 | +13% | 1 | 1 | 0% | 2,025 | 4,718 | +133% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.