跳到正文
Skillpedia
部署与云(DevOps)280k · #377

orch-refine-code

它能做什么

这个工具会重新组织你的代码,使其更简洁、更易理解,同时不改变代码的功能。它会确保一切仍然像之前一样正常工作。

适用场景

  • ✓当你想改善代码的组织结构时。
  • ✓当存在可以去掉的重复代码时。
  • ✓当你想删除不再使用的代码时。

技能链接

https://github.com/affaan-m/ECC/blob/main/skills/orch-refine-code/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“把 poller.py 文件中的 NWS HTTP 客户端代码重构出来。”

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

工作原理

这个工具会先检查现有测试是否通过。然后分小步重新组织代码,每次改动后都进行测试。如果一切正常,最后保存这些改动。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

orch-refine-code

Actor · action · target: orch · refine · code. Thin wrapper over the shared engine in orch-pipeline.

When to Use

  • Same behavior, better structure: extract modules, remove duplication, kill dead code, reduce nesting, rename for clarity.
  • Distinguish from siblings: if behavior is meant to change at all, this is the wrong skill (orch-change-feature / orch-fix-defect).

Operation settings

  • Default size floor: standard — restructures touch multiple files.
  • Phase mask: 0 → 2 (plan the restructure) → 4 (keep green) → 5 → 6. No new behavior tests are written — the existing suite is the safety net.
  • First move (phase 4): confirm the relevant tests exist and are green before touching code; if coverage is thin, add characterization tests first. Then restructure in small steps, re-running tests after each.

How It Works

  1. Run the orch-pipeline engine with the settings above.
  2. For dead-code / duplication sweeps, delegate to the refactor-cleaner agent (it runs knip / depcheck / ts-prune and removes safely).
  3. Stop at Gate 1 (restructure plan) and Gate 2 (pre-commit).
  4. Commit as refactor: — the diff must be behavior-neutral.

Example

orch-refine-code: extract the NWS HTTP client out of poller.py
→ confirm tests green → plan extraction  [GATE 1: approve]
→ move in small steps, tests green throughout → code-review
→ commit refactor:  [GATE 2: confirm]
常见问题

代码的“行为”是什么意思?

行为指代码做什么、如何运作、产生什么结果。这个工具确保最终结果不发生变化。

什么是“测试”?

测试是自动检查,用来确认代码是否按预期运行。如果某个测试失败,说明代码中有某处被破坏了。

什么是“提交”(commit)?

提交就像是把一组代码改动保存下来。“带关卡的提交”(gated commit)指只有在所有检查(测试)都通过时才会保存。

详情

作者的原始描述

Orchestrate a behavior-preserving refactor — confirm tests are green, restructure without changing behavior, keep tests green, review, and gated commit. Use when the structure should improve but behavior must not change.

repo: affaan-m/ECC

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能