跳到正文
Skillpedia
通用编程48k · #5389

orchestrate-batch-refactor

它能做什么

这个工具可以帮你组织和执行项目中的大规模代码修改。它会把工作拆分成更小的部分,并管理它们之间的依赖关系,确保每一步都安全、有条理地完成。

适用场景

  • ✓当一次修改影响到代码的很多部分时。
  • ✓当你需要在动手修改前先规划好步骤时。
  • ✓当多个人需要同时处理不同部分时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/orchestrate-batch-refactor/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/orchestrate-batch-refactor/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我组织一次对 'src/components' 目录的大型重构,目标是提升性能,同时确保现有功能保持不变。”

每周 5 个新技能,1 分钟读完。

工作原理

首先,工具会分析所有需要修改的代码部分。然后,它会制定详细的计划,把工作拆成若干可以并行完成的小任务,并同时考虑它们之间的依赖关系。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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.

When to Use

  • When a refactor spans many files or subsystems and needs clear work partitioning.
  • When you need dependency-aware planning before parallel implementation.

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 for the exact shape.

Agent Prompting Contract

  • Use the prompt templates in references/agent-prompt-templates.md.
  • 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.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

“重构”是什么意思?

重构是指在不改变代码外部行为的前提下,改进代码的内部结构。这就像整理房子里的电线,让它更容易理解和维护,而电器的使用方式不会因此改变。

什么是“工作包”?

工作包是把大任务拆分后得到的小任务。每个工作包都有明确的目标、需要处理的具体文件,以及确保不与其他任务发生冲突的规则。

为什么要并行分析?

并行分析是指由不同的“代理”(即小型 AI 助手)同时检查代码的不同部分。这样可以更快地摸清修改范围,并在开始改动前识别风险。

详情

作者的原始描述

Plan and execute large refactors with dependency-aware work packets and parallel analysis.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5389
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能