Batch Review (claude-batch-toolkit)
Integration: Load via
@Skill:batch-review.mdin DECISION LOOP step 5
RTK Integration: Supports@hooks-session-start.md,@PreCompact.md
Overview
Send non-urgent analysis to Anthropic's Batch API at 50% cost reduction. Ideal for code reviews, documentation, security audits, and architecture analysis that can wait ~1 hour.
When to Activate
Use this skill for batch processing when:
- Code reviews or security audits (non-urgent)
- Documentation generation
- Architecture analysis
- Test generation for existing code
- Refactoring plans
- Changelog generation
- Any task where 50% cost savings > immediate results
Detection Keywords
"batch", "review", "audit", "analyze", "documentation", "architecture", "changelog", "refactoring plan"
Protocol Integration
DECISION LOOP Position
This skill applies at step 5 of the DECISION LOOP:
1. CLASSIFY -> complexity? backup needed? tools?
2. PROTECT -> cp file file.bak (for configs, DBs)
3. MEMORY -> query relevant context + past failures
4. AGENTS -> check overlaps (if multi-agent)
5. SKILLS -> @Skill:batch-review.md for domain-specific guidance
6. WORK -> implement (ALWAYS use worktree for ANY file changes)
7. REVIEW -> self-review diff before testing
8. TEST -> completion gates pass
9. LEARN -> store outcome in memory
Required Pre-Checks
Before using batch review:
- MANDATORY: Worktree created (
uap worktree create <slug>) - Task is non-urgent (can wait ~1 hour)
- Context is self-contained (no interactive debugging needed)
- Full file contents gathered (batch model has NO codebase access)
Setup
git clone git@github.com:s2-streamstore/claude-batch-toolkit.git
cd claude-batch-toolkit && ./install.sh --api-key $ANTHROPIC_API_KEY
Good Batch Candidates
- ✅ Code reviews and security audits
- ✅ Documentation generation
- ✅ Architecture analysis
- ✅ Test generation for existing code
- ✅ Refactoring plans
- ✅ Changelog generation
Bad Candidates (use real-time instead)
- ❌ Anything needed right now
- ❌ Interactive debugging
- ❌ Quick questions
- ❌ Tasks requiring back-and-forth
Usage Pattern
- Gather all context into a self-contained prompt file
- Include full file contents (batch model has NO codebase access)
- Submit via MCP tool
send_to_batchwithpacket_path - Check results:
batch_listthen read from~/.claude/batches/results/
Integration with Parallel Review Protocol
Instead of running security-auditor/code-quality-guardian synchronously as subagents, submit reviews as batch jobs for 50% cost savings when time allows:
# Assemble review prompt with full diff
git diff --staged > /tmp/review_diff.txt
cat > /tmp/batch_prompt.md << 'EOF'
Review the following diff for security vulnerabilities and code quality issues.
## Diff
EOF
cat /tmp/review_diff.txt >> /tmp/batch_prompt.md
# Submit (via MCP or CLI)
uv run ~/.claude/mcp/claude_batch_mcp.py submit --packet-path /tmp/batch_prompt.md --label "pr-review"
Cost Reference
| Model | Standard | Batch (50% off) |
|---|---|---|
| Claude Opus 4 | $15/$75 per 1M | $7.50/$37.50 |
| Claude Sonnet 4 | $3/$15 per 1M | $1.50/$7.50 |
UAP Protocol Compliance
Completion Gates Checklist
Before reporting task complete:
[x] Schema diffed against test expectations
[x] Tests: X/Y (must be 100%, run 3+ times)
[x] Outputs verified: ls -la
[x] Worktree created and PR prepared
[x] MANDATORY cleanup after PR merge
Verifier-First Integration
If tests are involved:
- Schema Diff Gate: Compare output schema against test expectations BEFORE running verifier
- Environment Check:
python3 --version; which pip3 gcc make node npm - Run Verifier: After each change, minimum 3 runs with TESTS output format
Memory Integration
Store Lessons Learned
uap memory store "Batch review completed: <task_type> saved $<cost> vs real-time" \
--tags batch-review,<category> --importance 7
Query Relevant Context
uap memory query "batch review <task_type>"
Common Pitfalls
- Never skip worktree: ALWAYS use
uap worktree create <slug>before any file changes - Never batch urgent tasks: Batch takes ~1 hour, use real-time for urgent needs
- Never forget context: Batch model has NO codebase access, include all file contents
- Never forget cleanup: Run
uap worktree cleanup <id>after PR merge
Success Criteria
- All tests pass (100%, 3+ runs)
- Schema verified against test expectations
- Worktree cleanup completed
- Lessons stored in memory
- No debug artifacts left behind
- Cost savings achieved vs real-time review
References
- CLAUDE.md v2.3.0: Universal Agent Patterns (P1-P39)
- Claude Batch API: https://docs.anthropic.com/en/docs/build-with-claude/batch-processing
- Pattern P8: CLI over Libraries
- Pattern P13: Iterative Refinement Loop
Last Updated: 2026-03-09
Compatibility: CLAUDE.md v2.3.0+
RTK Includes: @hooks-session-start.md, @PreCompact.md