0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code Batch Processing

Posted at

Introduction

Claude Code users often face the challenge of "wanting to execute multiple prompts sequentially" and "automating code generation with overnight batch processing." Many also need "project-specific prompt management" for their development workflows.

This article provides a detailed explanation of the batch processing features added in Prompt Scheduler v1.0.2, along with real development scenarios.

Disclaimer

The Prompt Scheduler introduced in this article is an open-source tool that I personally developed. I want to clearly state that this is an independent personal development project with no connection whatsoever to Anthropic's Claude or Claude Code. Please use at your own risk.

What is Batch Processing?

Batch processing in Prompt Scheduler refers to the functionality of pre-defining multiple prompts and automatically executing them in a specified order. Compared to the traditional method of manually entering prompts one by one, it offers the following benefits:

  • Work Standardization: Ensures consistent execution of the same procedures
  • Effective Time Usage: Automated execution during nighttime or when away
  • Human Error Reduction: Prevention of manual input mistakes
  • Progress Visualization: Centralized management of execution status

Two Execution Modes: repeat and sequential

v1.0.2 provides two execution modes that can be selected based on usage requirements.

repeat Mode (Default)

tsx src/claude-schedule.ts run --mode repeat
# or simply
tsx src/claude-schedule.ts run

Operating Principle:

  • Utilizes tmux command history (Up key)
  • Recalls previous prompts and overwrites content
  • Leverages existing session history

Application Scenarios:

  • Continuous prompt execution in active development projects
  • When Claude Code session has existing history
  • Automation of interactive development flows

sequential Mode

tsx src/claude-schedule.ts run --mode sequential

Operating Principle:

  • Direct prompt sending without relying on tmux history
  • More reliable and predictable behavior
  • Stable operation even in new sessions

Application Scenarios:

  • Initial execution or processing in clean environments
  • Batch processing prioritizing reliability
  • Automation in CI/CD pipelines

Flexible Scheduling with Time Control Features

Automatic Stop at Specified Times

# Automatically stop at 5 PM
tsx src/claude-schedule.ts run --stop-at 5pm

# 24-hour format specification
tsx src/claude-schedule.ts run --stop-at 17:30

Practical Example:

# Execution restriction within business hours
tsx src/claude-schedule.ts run --stop-at 6pm --mode sequential

Execution Time Limits

# Automatically stop after 3 hours
tsx src/claude-schedule.ts run --hours 3

# Stop after 30 minutes
tsx src/claude-schedule.ts run --hours 0.5

Project-Specific Management: Custom Prompt Files

Parallel Management of Multiple Projects

# Frontend prompt file
tsx src/claude-schedule.ts run --prompt-file ~/projects/frontend/prompts.jsonl

# Backend prompt file
tsx src/claude-schedule.ts run --prompt-file ~/projects/backend/prompts.jsonl

# Individual status checking is also possible
tsx src/claude-schedule.ts status --prompt-file ~/projects/frontend/prompts.jsonl

Prompt File Example

{"prompt": "Conduct API endpoint design review", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "10m"}
{"prompt": "Propose database schema optimization", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "15m"}
{"prompt": "Execute security vulnerability inspection", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "20m"}
{"prompt": "Analyze performance test results", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "10m"}

Smart Usage Limit Processing

Automatic Detection of Limit Messages

Prompt Scheduler automatically detects the following limit messages:

  1. "Approaching usage limit ยท resets at 10pm"
  2. "Claude usage limit reached. Your limit will reset at 1pm"

Selective Ignoring of Approaching Limits

# Ignore "approaching" messages and stop only at "reached"
tsx src/claude-schedule.ts run --ignore-approaching-limit

Usage Guidelines:

  • Normal execution: Default (stop at all limits)
  • Aggressive execution: Use --ignore-approaching-limit
  • Overnight batch: Combination of --ignore-approaching-limit + --hours

Real Development Scenario: Web Application Development

Scenario: E-commerce Site Development

{"prompt": "Design and implement product management API", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "20m"}
{"prompt": "Implement payment system integration", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "25m"}
{"prompt": "Optimize product search functionality", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "15m"}
{"prompt": "Strengthen user authentication system", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "20m"}
{"prompt": "Propose admin panel UI improvements", "tmux_session": "/tmp/tmux-1000/default", "sent": "false", "sent_timestamp": null, "default_wait": "15m"}

Execution Command Examples

# Overnight batch (aggressive execution ignoring limits)
tsx src/claude-schedule.ts run \
  --prompt-file ~/projects/ec-site/prompts.jsonl \
  --mode sequential \
  --ignore-approaching-limit \
  --hours 6

# Phased execution during business hours
tsx src/claude-schedule.ts run \
  --prompt-file ~/projects/ec-site/prompts.jsonl \
  --mode repeat \
  --stop-at 6pm

Progress Management and Monitoring

Status Checking

# Basic status check
npm run status

# Custom file status check
tsx src/claude-schedule.ts status --prompt-file ~/my-project/prompts.jsonl

Execution Results Example

๐Ÿ“Š PROMPT STATUS

๐Ÿ“„ Using prompt file: ~/projects/ec-site/prompts.jsonl

1. โœ… SENT Design and implement product management API (2024-01-15 14:30:25)
2. โœ… SENT Implement payment system integration (2024-01-15 14:55:10)
3. โณ PENDING Optimize product search functionality (N/A)
4. โณ PENDING Strengthen user authentication system (N/A)
5. โณ PENDING Propose admin panel UI improvements (N/A)

Performance Optimization Tips

1. Appropriate Wait Time Settings

{"prompt": "Lightweight refactoring", "default_wait": "5m"}
{"prompt": "Complex architecture design", "default_wait": "30m"}

2. Execution Mode Selection

  • Stability priority: sequential mode
  • Response priority: repeat mode

3. Time Control Utilization

# Short-term focused execution
tsx src/claude-schedule.ts run --hours 1 --mode sequential

# Long-term stable execution
tsx src/claude-schedule.ts run --ignore-approaching-limit --hours 8

Summary

Prompt Scheduler v1.0.2's batch processing features dramatically improved development efficiency with Claude Code.

Key Points:

  • repeat and sequential: Selecting execution modes based on usage requirements
  • Time control: Flexible scheduling with --stop-at and --hours
  • Project management: Parallel processing of multiple projects with --prompt-file
  • Limit processing: Aggressive execution with --ignore-approaching-limit

By combining these features, you can significantly automate Claude Code development processes and build a more productive development environment.

Installation and Getting Started

# One-liner installation
curl -fsSL https://raw.githubusercontent.com/prompt-scheduler/cli/main/install.sh | bash

# Basic usage
npm run help
npm run status

Please try using the batch processing features to improve your Claude Code development efficiency!


Note: This tool is a personal development project. Please use at your own risk.

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?