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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
- Define scope and success criteria.
- List target paths/modules and non-goals.
- State behavior constraints (for example: preserve external behavior).
- Run parallel analysis first.
- Split target scope into analysis lanes.
- Spawn
explorersub-agents in parallel to analyze each lane. - Ask each agent for: intent map, coupling risks, candidate work packets, required validations.
- 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.
- Execute with worker agents.
- Spawn one
workerper independent packet. - Assign explicit ownership (files/responsibility).
- Instruct every worker that they are not alone in the codebase and must ignore unrelated edits.
- Spawn one
- Integrate and verify.
- Review packet outputs, resolve overlaps, and run validation gates.
- Run targeted tests per packet, then broader suite for integrated scope.
- 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:
- Packet ID and objective.
- Owned files.
- Dependencies (none or packet IDs).
- Risks and invariants to preserve.
- Required checks.
- 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:
- Packet-level checks (fast and scoped).
- Cross-packet integration checks.
- 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.
热度
- GitHub 星标
- 48k
- 排名
- #5389
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。