Orchestrate Batch Refactor

作者 dimillian05ba982bfeb0无许可证3.9K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库6个月前更新

Plan and execute large refactor or rewrite efforts efficiently with parallel multi-agent analysis and implementation. Use when a user asks to refactor many files, split workstreams, analyze a target code area, and coordinate sub-agents with clear ownership and dependency-aware execution.

AI 生成的概览

通过并行子代理分析和依赖感知的工作包,规划并协调大规模多文件重构。

功能
该技能提供了一套工作流程,用于在大量文件中执行重构、重写或混合改造。它把目标范围拆分为多个分析通道,并行启动 explorer 子代理,将其结果合并为一张依赖感知的工作图,然后用具有明确文件归属的 worker 代理执行相互独立的工作包。它会产出计划、带验证命令的工作包,以及涵盖结果、冲突和残余风险的收尾报告。
适用场景
当重构或重写涉及大量文件或子系统、需要协调并行工作时使用。它面向可拆分工作流并按依赖排序的中大型范围任务。小型修改或高度耦合的单文件工作应跳过这种多代理方式。
运行要求
不附带脚本,仅为指令。它依赖代理启动 explorer 和 worker 子代理的能力,以及对目标代码仓库的访问。它引用了两个随附的参考文档,用于工作包和提示词模板。

Orchestrate Batch Refactor

Overview

Use this skill to run high-throughput refactors safely. Analyze scope in parallel, synthesize a single plan, then execute independent work packets with sub-agents.

Inputs

  • Repo path and target scope (paths, modules, or feature area)
  • Goal type: refactor, rewrite, or hybrid
  • Constraints: behavior parity, API stability, deadlines, test requirements

When to Use Parallelization

  • Use this skill for medium/large scope touching many files or subsystems.
  • Skip multi-agent execution for tiny edits or highly coupled single-file work.

Core Workflow

  1. Define scope and success criteria.
    • List target paths/modules and non-goals.
    • State behavior constraints (for example: preserve external behavior).
  2. Run parallel analysis first.
    • Split target scope into analysis lanes.
    • Spawn explorer sub-agents in parallel to analyze each lane.
    • Ask each agent for: intent map, coupling risks, candidate work packets, required validations.
  3. Build one dependency-aware plan.
    • Merge explorer output into a single work graph.
    • Create work packets with clear file ownership and validation commands.
    • Sequence packets by dependency level; run only independent packets in parallel.
  4. Execute with worker agents.
    • Spawn one worker per independent packet.
    • Assign explicit ownership (files/responsibility).
    • Instruct every worker that they are not alone in the codebase and must ignore unrelated edits.
  5. Integrate and verify.
    • Review packet outputs, resolve overlaps, and run validation gates.
    • Run targeted tests per packet, then broader suite for integrated scope.
  6. Report and close.
    • Summarize packet outcomes, key refactors, conflicts resolved, and residual risks.

Work Packet Rules

  • One owner per file per execution wave.
  • No parallel edits on overlapping file sets.
  • Keep packet goals narrow and measurable.
  • Include explicit done criteria and required checks.
  • Prefer behavior-preserving refactors unless user explicitly requests behavior change.

Planning Contract

Every packet must include:

  1. Packet ID and objective.
  2. Owned files.
  3. Dependencies (none or packet IDs).
  4. Risks and invariants to preserve.
  5. Required checks.
  6. Integration notes for main thread.

Use references/work-packet-template.md [blocked] for the exact shape.

Agent Prompting Contract

  • Use the prompt templates in references/agent-prompt-templates.md [blocked].
  • Explorer prompts focus on analysis and decomposition.
  • Worker prompts focus on implementation and validation with strict ownership boundaries.

Safety Guardrails

  • Do not start worker execution before plan synthesis is complete.
  • Do not parallelize across unresolved dependencies.
  • Do not claim completion if any required packet check fails.
  • Stop and re-plan when packet boundaries cause repeated merge conflicts.

Validation Strategy

Run in this order:

  1. Packet-level checks (fast and scoped).
  2. Cross-packet integration checks.
  3. Full project safety checks when scope is broad.

Prefer fast feedback loops, but never skip required behavior checks.

来源与署名

来源:dimillian/skills位于orchestrate-batch-refactor提交05ba982

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架