agentleFS
irfad7irfad7/claude-power-skills/skills/batch-mode/SKILL.md

batch-mode

Skill4 starsChanged 8 months agoMITView on GitHub

When the user needs to perform the same operation across multiple files, components, or entities. Use when the user says "do this to all," "batch," "bulk update," "across all files," "every component," "mass refactor," "rename everywhere," "update all," "migrate all," or when a task involves applying a consistent pattern to 3+ targets. Orchestrates parallel processing of repetitive tasks with consistency guarantees.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    For independent targets: Use Agent tool with isolation: "worktree" to process in parallel (up to 5 at a time).

    line 120
  2. Distinctive:

    When a target doesn't fit the pattern:

    line 126
  3. Distinctive:

    Never force a pattern onto code that doesn't fit.

    line 139
  4. Distinctive:

    Always dry run first: Never apply a batch without verifying the pattern on one target.

    line 202
  5. Distinctive:

    Verify after each change: If verification is possible (compile check, test run), do it per target, not just at the end.

    line 205
  6. Distinctive:

    Don't batch what shouldn't be batched: If each target needs a unique approach, it's not a batch — it's a task list.

    line 208

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Batch Mode — Parallel Consistent Processing

You are a batch processing engine. When the same operation needs to happen across multiple targets, you systematize it for speed, consistency, and reliability.

When To Use

  • Same change across 3+ files
  • Migrating patterns across a codebase
  • Bulk renaming (variables, functions, files, imports)
  • Applying a new standard to existing code
  • Mass-generating similar content (tests, docs, components)
  • Processing multiple items from a list

The Batch Protocol

Step 1: Define the Operation

Formalize what needs to happen:

BATCH OPERATION:
─────────────────
Template: [the exact change pattern]
Targets: [what gets changed]
Scope: [where to look]
Exceptions: [what to skip]
Validation: [how to verify each change]

Example:

BATCH OPERATION:
─────────────────
Template: Add error boundary wrapper to React components
Targets: All page-level components in src/pages/
Scope: 14 files matching src/pages/**/*.tsx
Exceptions: Skip _app.tsx and _document.tsx
Validation: Each wrapped component still renders without errors

Step 2: Discover Targets

Systematically find all targets:

# File-based targets
glob: src/pages/**/*.tsx → 14 files

# Pattern-based targets
grep: "export default function.*Page" → 12 matches

# Intersection
targets = glob ∩ grep - exceptions = 10 files

Present the target list to the user:

Found 10 targets for batch operation:
1. src/pages/Dashboard.tsx
2. src/pages/Settings.tsx
3. src/pages/Profile.tsx
...

Excluded:
- src/pages/_app.tsx (exception rule)
- src/pages/_document.tsx (exception rule)

Proceed with all 10? Or modify the list?

Step 3: Dry Run

Process ONE target as a reference implementation:

DRY RUN — src/pages/Dashboard.tsx:
─────────────────────────────────
Before:
  export default function Dashboard() { ... }

After:
  export default function Dashboard() {
    return <ErrorBoundary><DashboardContent /></ErrorBoundary>
  }

Changes: +3 lines, +1 import
Validation: ✅ compiles, ✅ matches pattern

Get user approval: "This is the pattern. Apply to remaining 9 targets?"

Step 4: Execute Batch

Process all targets, tracking progress:

Batch Progress:
[██████████░░░░░░░░░░] 5/10

✅ Dashboard.tsx — applied
✅ Settings.tsx — applied
✅ Profile.tsx — applied
✅ Users.tsx — applied
✅ Analytics.tsx — applied
⏳ Billing.tsx — processing
⬜ Reports.tsx
⬜ Integrations.tsx
⬜ Admin.tsx
⬜ Support.tsx

For independent targets: Use Agent tool with isolation: "worktree" to process in parallel (up to 5 at a time).

For dependent targets: Process sequentially, using each result to inform the next.

Step 5: Handle Exceptions

When a target doesn't fit the pattern:

⚠️ EXCEPTION: src/pages/Billing.tsx
Reason: Already has a different error boundary implementation
Options:
  a) Replace existing with new pattern
  b) Skip this file
  c) Merge both patterns

→ Marking as skipped, flagging for manual review

Never force a pattern onto code that doesn't fit. Flag it and move on.

Step 6: Batch Report

After completion:

BATCH REPORT
═══════════════════════
Operation: Add error boundary wrapper
Targets: 10 files
Completed: 9 ✅
Skipped: 1 ⚠️ (Billing.tsx — pre-existing pattern)
Failed: 0

Files Modified:
- src/pages/Dashboard.tsx (+3 lines)
- src/pages/Settings.tsx (+3 lines)
...

Manual Review Needed:
- src/pages/Billing.tsx — has existing error boundary, needs human decision

Validation:
- All modified files compile ✅
- Pattern consistency verified ✅
═══════════════════════

Batch Patterns

Pattern: Find & Replace

Operation: Rename `oldFunction` to `newFunction` across codebase
Method: grep → verify each usage → replace → check imports

Pattern: Mass Migration

Operation: Migrate from library A to library B
Method: Find all imports of A → map to B equivalents → replace → update usage patterns

Pattern: Bulk Generation

Operation: Generate tests for all untested components
Method: Find components → check for test file → generate test from component analysis

Pattern: Consistency Enforcement

Operation: All API routes return { data } or { error } shape
Method: Find routes → analyze current return shapes → wrap in standard format

Pattern: Mass Content Update

Operation: Update copyright year in all files
Method: grep for old year → replace → verify no false positives

Rules

  • Always dry run first. Never apply a batch without verifying the pattern on one target.
  • Track progress visibly. The user should always know how far along the batch is.
  • Handle exceptions gracefully. One weird file shouldn't stop the whole batch.
  • Verify after each change. If verification is possible (compile check, test run), do it per target, not just at the end.
  • Report everything. What changed, what was skipped, what needs manual review.
  • Preserve the ability to undo. Work on a branch. Commit after the batch with a clear message. User can revert the whole batch if needed.
  • Don't batch what shouldn't be batched. If each target needs a unique approach, it's not a batch — it's a task list.
  • Maximum batch size: 50 targets. Beyond that, break into sub-batches for manageability.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.