Claude Code Batch Processing with Skills Guide
Claude Code skills transform how developers handle repetitive tasks. Instead of processing files one at a time, you can chain skills together to handle batch operations across entire directories. This guide shows you how to build efficient batch processing workflows using Claude skills. For multi-agent approaches to parallel workloads, see fan-out fan-in pattern with Claude Code subagents.
How Batch Processing Works with Skills
Skills in Claude Code are Markdown files containing specialized instructions. When you invoke a skill, Claude loads its context and applies that expertise to your current task. For batch processing, you combine skill invocation with shell commands or scripting to iterate over multiple files.
The key is understanding that skills don’t execute loops themselves—they guide Claude’s behavior while you provide the iteration mechanism through bash or scripts. This separation keeps your workflows flexible and debuggable.
Setting Up Batch Processing
Create a working directory for your batch operations:
~/batch-projects/
├── process/
│ ├── input/
│ └── output/
└── scripts/
Initialize your Claude session with the skills you need. For example, if processing design files, load the frontend-design skill alongside your processing script:
/frontend-design
Processing Multiple Files with Skill Chains
The most common batch pattern involves iterating through files and applying skill-guided transformations. Here’s a practical example processing markdown files for a documentation site:
#!/bin/bash
# batch-process-docs.sh
INPUT_DIR="./docs"
OUTPUT_DIR="./processed"
for file in "$INPUT_DIR"/*.md; do
filename=$(basename "$file")
echo "Processing: $filename"
# Use claude to process each file with skill guidance
claude -p "Apply the documentation skill to improve this markdown file.
- Fix heading hierarchy
- Add appropriate code block language tags
- Ensure links are properly formatted
$(cat "$file")" > "$OUTPUT_DIR/$filename"
done
This script uses Claude in headless mode to process each file. The documentation improvement happens through skill guidance, not manual editing.
PDF Batch Processing Example
The pdf skill handles batch document operations efficiently. Process multiple PDFs for extraction or conversion:
#!/bin/bash
# batch-extract-pdf.sh
PDF_DIR="./invoices"
OUTPUT_DIR="./extracted"
for pdf in "$PDF_DIR"/*.pdf; do
filename=$(basename "$pdf" .pdf)
claude -p "Using the pdf skill, extract all text content from this invoice: $pdf
Return the data as JSON with keys: invoice_number, date, total, line_items."
done > "$OUTPUT_DIR/all_invoices.json"
This extracts structured data from multiple invoices in one run. The pdf skill understands document structure and applies consistent extraction logic across files.
Code Transformation with Multiple Skills
Combine skills for complex batch transformations. This example uses the tdd skill together with a refactoring prompt:
#!/bin/bash
# batch-add-tests.sh
SRC_DIR="./src"
for file in "$SRC_DIR"/*.js; do
echo "Adding tests to: $file"
claude -p "Apply the tdd skill to generate unit tests for this file, then
ensure the implementation passes all tests and follows clean code principles.
File: $file
$(cat "$file")"
done
The tdd skill generates appropriate test cases while the refactoring guidance ensures the implementation meets quality standards. Running both in the prompt produces tested, clean code.
Automating Documentation Generation
The docs skill paired with batch scripts automates documentation across codebases:
#!/bin/bash
# generate-docs.sh
COMPONENTS=(
"Button"
"Modal"
"Dropdown"
"DatePicker"
)
for component in "${COMPONENTS[@]}"; do
claude -p "Generate component documentation for this file.
Include: props table, usage examples, and type signatures.
$(cat "./components/$component.js")"
done > "./docs/components.md"
This processes multiple component files and aggregates the documentation into a single file.
Memory-Augmented Batch Processing
The supermemory skill enhances batch processing by maintaining context across iterations. When processing related files, this prevents redundant work:
/supermemory Remember: processing all API endpoint files in ./src/api/ for documentation generation
The skill tracks what has been processed and what still needs attention, making large batch jobs more efficient.
Performance Optimization Tips
Batch processing with skills runs faster when you optimize the workflow:
Parallel processing: Use GNU parallel or xargs for concurrent operations:
ls *.json | xargs -P 4 -I {} bash process-one.sh {}
Reduce skill reloads: Group similar files together to minimize context switching between different skills.
Pre-filter files: Use find or glob patterns to process only relevant files:
find . -name "*.ts" -newer last-run.txt -exec process.sh {} \;
Error Handling in Batch Jobs
Always implement proper error handling:
#!/bin/bash
for file in ./*.md; do
if claude -p "Process this file: $(cat "$file")" > "processed/$file" 2>&1; then
echo "Success: $file"
else
echo "Failed: $file" >> errors.log
fi
done
Review errors.log after completion to identify files requiring manual attention.
Real-World Use Cases
Batch processing with skills excels in several scenarios:
- Legacy code modernization: Process hundreds of files to add TypeScript types using the tdd skill with type-checking prompts
- Content migration: Transform CMS exports using docs and formatting skills
- Test coverage expansion: Apply tdd skill across entire codebases
- Design system updates: Batch update component props with frontend-design guidance
Conclusion
Claude Code skills combined with shell scripting create powerful batch processing capabilities. Start with simple single-skill workflows, then combine multiple skills for complex transformations. The key is separating iteration logic (bash) from transformation expertise (skills)—this keeps your pipelines maintainable and scalable.
Related Reading
- Claude Code Agent Pipeline: Sequential vs Parallel Execution — Understand when to run batch jobs sequentially versus in parallel for maximum throughput
- Rate Limit Management for Claude Code Skill-Intensive Workflows — Avoid hitting API rate limits when running large batch processing jobs
- Fan-Out Fan-In Pattern with Claude Code Subagents — Distribute batch workloads across multiple subagents and collect results
- Claude Skills Hub — Explore automation workflows and batch processing patterns with Claude Code
Built by theluckystrike — More at zovo.one