qwenlm/qwen-code/batch
Claude Code and agent skill by qwenlm/qwen-code
- community
Checking that the SKILL.md file is still in the repository.
Execute batch operations on multiple files in parallel. Automatically discovers files, splits into chunks, and processes with parallel worker agents. Use `/batch` followed by operation and file pattern. For many independent single-turn transforms (translate/rewrite/extract each file into a new file) that can wait minutes to hours, you may suggest the user type `/batch-api` themselves for the half-price asynchronous Batch API — you cannot invoke it, and it is not suited to in-place edits or task…
Install
npx vskill@latest install qwenlm/qwen-code/batchSKILL.md
The same SKILL.md was published earlier as qwenlm/qwen-code/batch.
/batch - Parallel Batch Operations
You are orchestrating a batch operation across multiple files. Your job is to:
- Parse the user's request to understand the target files and operation
- Discover matching files using glob
- Split files into chunks for parallel processing
- Launch multiple worker agents to process files concurrently
- Aggregate results and present a summary
Step 1: Parse Intent and Discover Files
First, parse the user's request to identify:
- Target pattern: glob pattern for files (e.g.,
src/**/*.ts,**/*.js) - Operation: what to do with each file (e.g., "add JSDoc comments", "convert to TypeScript")
If the user didn't specify a pattern, infer it from context or ask for clarification.
Use the glob tool to discover matching files.
If no files match the pattern:
- Inform the user that no files were found for the given pattern
- Suggest checking the pattern or broadening the search scope
- Do not proceed with an empty batch
Apply these common exclusions automatically:
node_modules/**dist/**build/**.git/****/*.test.ts,**/*.test.js**/*.spec.ts,**/*.spec.js**/__tests__/****/test/**,**/tests/****/package-lock.json**/yarn.lock**/pnpm-lock.yaml**/*.min.js- Binary files (images, fonts, etc.)
- Files larger than 500KB (check size if needed)
Important: If more than 50 files match, inform the user with the exact count and the file list, then proceed. The user can cancel (Ctrl+C) if needed. If the count exceeds 100 files, warn the user and suggest a more specific pattern instead of proceeding.
Step 2: Chunk Files for Parallel Processing
Split the discovered files into chunks based on these rules:
| Total Files | Chunk Count | Files Per Chunk | |
|---|---|---|---|
| 1-5 | 1 | All files | |
| 6-15 | 2 | 3-8 each | |
| 16-30 | 3 | ~10 each | |
| 31-50 | 4 | ~10-12 each | |
| 51-75 | 5 | ~10-15 each | |
| 76-100 | 5 | ~15-20 each |
Chunking algorithm:
- Minimum chunk size: 3 files (avoid over-parallelization for small batches)
- Maximum chunk size: 15 files (ensure reasonable work per agent)
- Maximum parallel agents: 5 (API rate limit consideration)
Example: 24 files → 3 chunks of ~8 files each
Step 3: Launch Parallel Worker Agents
Launch worker agents in parallel by invoking the task tool (the Agent tool) multiple times in a SINGLE message.
Note: The task tool in allowedTools is the Agent tool used to spawn worker agents.
Each worker agent should receive:
- The list of files to process (full paths)
- The operation to perform
- Clear instructions to report success/failure per file
Use the general-purpose subagent type for workers.
CRITICAL: All Agent tool calls MUST be in a single response to enable parallel execution. The system automatically runs multiple Agent calls concurrently.
Agent Prompt Template
For each chunk, use this prompt format:
Example Invocation Pattern
Set run_in_background: false on every worker call so all results return inline for aggregation in Step 4.
Step 4: Aggregate Results
After all worker agents complete, aggregate their results into a clear summary.
Output Format
Handling Partial Failures
If some files failed but others succeeded:
- Clearly report which files succeeded
- List failures with specific reasons
- Suggest follow-up actions if appropriate
If all files failed:
- Report the common failure pattern
- Suggest potential fixes
Step 5: Error Handling
During Batch Processing
- Single file failure: Don't abort the batch. The worker agent records the error and continues.
- Agent failure: If a worker agent fails completely (timeout, crash), note the chunk as failed with reason.
- User cancellation: If the user sends Ctrl+C, the system will cancel all pending agents gracefully.
Error Reporting
For each failed file, include:
- File path
- Specific error message or reason
- Suggested fix if obvious
Usage Examples
Example 1: Add License Headers
Flow:
- glob
src/**/*.ts→ find 45 files - Split into 4 chunks
- Launch 4 parallel agents
- Each agent adds the license header to its assigned files
- Summary: 45 files processed, 45 succeeded, 0 failed
Example 2: Convert JavaScript to TypeScript
Flow:
- glob
utils/**/*.js→ find 12 files - Split into 2 chunks
- Launch 2 parallel agents
- Each agent converts files and renames to .ts
- Summary: 12 files processed, 10 succeeded, 2 failed (complex dynamic patterns)
Example 3: Fix Lint Errors
Flow:
- Use
grep_searchto find files containing: anypattern insrc/ - Filter to relevant files
- Split into chunks and launch parallel agents
- Each agent fixes the specific lint issue (replace
anywith proper types) - Summary: 8 files fixed
Constraints and Limits
| Constraint | Value | Reason | |
|---|---|---|---|
| Max files per batch | 100 | Prevent resource exhaustion | |
| Max parallel agents | 5 | API rate limit consideration | |
| Min files per agent | 3 | Avoid over-parallelization | |
| Max files per agent | 15 | Ensure meaningful work | |
| File size limit | 500KB | Avoid context overflow |
Dry-Run Mode
If the user wants to preview what will be changed without actually modifying files (e.g., "preview", "show me what would change", "dry run"):
- Discover and list all matching files with counts
- Show the planned operation for each file
- Display the chunking strategy
- Ask the user if they want to proceed with the actual changes
- If user confirms, execute the batch operation
Example:
Expected output:
Security
- Security scanPassed, 96 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/core/src/skills/bundled/batch/SKILL.md
Popularity
- Repository stars
- 30,432
- Repository forks
- 3,523
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/qwenlm/qwen-code/batch)