Skill

Orchestrate Safe Batch Code Refactoring

Orchestrates large multi-file refactors: parallel explorer analysis, one dependency-aware plan, then worker execution.


90
Spark score
out of 100
Updated 20 days ago
Version 14.1.0

Add to Favorites

Why it matters

Safely refactor large codebases by orchestrating parallel analysis, dependency-aware planning, and independent worker execution for high-throughput code changes.

Outcomes

What it gets done

01

Analyze code scope in parallel using sub-agents.

02

Synthesize a single, dependency-aware refactoring plan.

03

Execute independent work packets with dedicated worker agents.

04

Integrate and verify refactored code with automated checks.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-orchestrate-batch-refactor | bash

Overview

Orchestrate Batch Refactor

A multi-agent orchestration framework for large refactors: parallel explorer analysis, a merged dependency-aware plan, ownership-scoped worker execution, and staged validation. Use when a refactor spans many files or subsystems and needs safe work partitioning; skip it for small or tightly coupled single-file changes.

What it does

Orchestrate Batch Refactor runs high-throughput refactors safely across many files: analyze scope in parallel with explorer sub-agents, synthesize their findings into a single dependency-aware plan, then execute independent work packets with worker sub-agents.

When to use - and when NOT to

Use this for a refactor spanning many files or subsystems that needs clear work partitioning and dependency-aware planning before parallel implementation. Skip multi-agent execution for tiny edits or highly coupled single-file work, where the coordination overhead isn't worth it.

Inputs and outputs

Inputs: the repo path and target scope (paths, modules, or feature area), the goal type (refactor, rewrite, or hybrid), and constraints such as behavior parity, API stability, deadlines, and test requirements. The six-step workflow: define scope and success criteria, including non-goals and behavior constraints like preserving external behavior; run parallel analysis by splitting the scope into lanes and spawning one explorer sub-agent per lane to produce an intent map, coupling risks, candidate work packets, and required validations; merge that explorer output into a single dependency-aware work graph, creating work packets with clear file ownership and validation commands, sequenced by dependency level so only independent packets run in parallel; spawn one worker sub-agent per independent packet with explicit file ownership, instructed that other agents are working in the same codebase and unrelated edits must be ignored; integrate outputs by resolving overlaps and running validation gates, first targeted tests per packet then a broader suite for the integrated scope; and finally report packet outcomes, key refactors, conflicts resolved, and residual risks.

Integrations

Every work packet follows a fixed planning contract: packet ID and objective, owned files, dependencies (none or specific packet IDs), risks and invariants to preserve, required checks, and integration notes for the main thread, using references/work-packet-template.md for the exact shape. Explorer and worker prompts follow templates in references/agent-prompt-templates.md - explorer prompts focus on analysis and decomposition, worker prompts on implementation and validation within strict ownership boundaries. Validation runs in a fixed order: packet-level checks first (fast and scoped), then cross-packet integration checks, then full project safety checks when scope is broad.

Who it's for

Teams or agents running large, multi-file refactors who need one owner per file per execution wave, no parallel edits on overlapping file sets, and explicit safety guardrails: never start worker execution before plan synthesis is complete, never parallelize across unresolved dependencies, never claim completion if a required packet check fails, and stop to re-plan if packet boundaries keep causing merge conflicts.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.