with one click
refactor
约束 Agent 必须遵循安全的重构流程:在保证原有业务逻辑和功能完全等价的前提下,提升代码质量。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
约束 Agent 必须遵循安全的重构流程:在保证原有业务逻辑和功能完全等价的前提下,提升代码质量。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
约束 Agent 必须遵循结构化的 Bug 修复流程:定位 → 根因分析 → 实施修复 → 回归测试验证。
约束 Agent 从正确性、安全性、性能和可维护性四个维度进行系统化的结构性代码审查。
约束 Agent 必须遵循结构化的功能特性开发流程:理解需求 → 技术设想 → 编写代码 → 自验自测。
约束 Agent 遵循标准流程生成结构化、高质量且要素齐全的产品需求文档。
Constrains the Agent to generate structured Product Requirements Documents (PRDs) with quality and completeness guarantees.
Constrains the Agent to follow a structured bug fix process — locate → root cause → fix → regression verify.
| name | 代码重构 (Refactor) |
| description | 约束 Agent 必须遵循安全的重构流程:在保证原有业务逻辑和功能完全等价的前提下,提升代码质量。 |
| assets | {"checklist":"assets/checklist.yaml","template":"assets/template.yaml"} |
| references | {"guidelines":"references/guidelines.yaml","security":"references/security.yaml"} |
约束 Agent 必须执行极端安全的重构:在改善代码结构、抽象度或性能的同时,绝对保证功能的等价性(Functional Equivalence)。
在开始动手重构前,你必须逐条检查 assets/checklist.yaml 中的项目。
你的最终输出必须严格符合 assets/template.yaml 中定义的格式框架。
必须实质性涵盖:重构的具体目标、影响面分析说明、带有 Diff 代码的分解行动步骤,以及用来保证不会改坏代码的等效验证打钩清单。
如果在重构期间你需要在终端里跑测试跑脚本,必须先查阅 references/security.yaml 黑名单。
在重构过程中,绝对绝对不允许随意删掉原有的单元测试代码,或是把原本严谨的错误处理 / catch 逻辑给阉割掉(即使它们看起来很啰嗦)。
完成重构方案后,拿着 references/guidelines.yaml 里的标准对你的输出做一次自我审核。
核心审查点:代码的运行表现还是和原来完全一样吗?被别人调用的公共 API 签名有没有被你不小心改掉?代码复杂度真的降低了吗?
如果不合规,退回重写,最多重试 3 次。