场景定位
移除死代码并现代化遗留模式,同时保持行为不变。 本页把官方 use case 的章节、工具、起步提示词和检查点整理成中文执行流程,便于直接对照落地。
- 难度
- 中级
- 时间跨度
- 约 30-60 分钟
适合用于
- 需要把「移除死代码并现代化遗留模式,同时保持行为不变。」做成可复用流程的团队,且来源分散在 Security Best Practices、Skill Creator 等工具中
- 希望 ChatGPT 或 Codex 保留来源、检查点和可审阅输出的使用者
- 需要把「重构代码库」从一次性对话变成可复查工作流的场景
Skills & Plugins
相关工具
Starter Prompt
起步提示词
Modernize and refactor this codebase.
Requirements:
- Preserve behavior unless I explicitly ask for a functional change.
- Start by identifying dead code, duplicated paths, oversized modules, stale abstractions, and legacy patterns that are slowing changes down.
- For each proposed pass, name the current behavior, the structural improvement, and the validation check that should prove behavior stayed stable.
- Break the work into small reviewable refactor passes such as deleting dead code, simplifying control flow, extracting helpers, or replacing outdated patterns with the repo's current conventions.
- Keep public APIs stable unless a change is required by the refactor.
- Call out any framework migration, dependency upgrade, API change, or architecture move that should be split into a separate migration task.
- If the work is broad, propose the docs, specs, and parity checks we should create before implementation.
Propose a plan to do this. 在 ChatGPT 中尝试 介绍
这一节对应官方流程中的「Introduction」。落地时围绕「重构代码库」把目标、输入、执行步骤和验证证据保持在同一条工作流里。
操作要点:先把本节需要的来源材料、权限和上下文补齐;缺失内容要明确标记,不要让 ChatGPT 或 Codex 隐式猜测。
操作要点:在继续执行前检查来源、假设、受众、权限和输出质量,并关注 Codex 等相关来源或工具;不确定内容应进入待确认列表。
操作要点:围绕「Introduction」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
- 围绕「Introduction」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
- 围绕「Introduction」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
- 围绕「Introduction」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
- 围绕「Introduction」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
如何使用
这一节对应官方流程中的「How to use」。落地时围绕「重构代码库」把目标、输入、执行步骤和验证证据保持在同一条工作流里。
- 在继续执行前检查来源、假设、受众、权限和输出质量,并关注 Codex 等相关来源或工具;不确定内容应进入待确认列表。
- 先把本节需要的来源材料、权限和上下文补齐;缺失内容要明确标记,不要让 ChatGPT 或 Codex 隐式猜测。
- 先把本节需要的来源材料、权限和上下文补齐,并关注 Codex 等相关来源或工具;缺失内容要明确标记,不要让 ChatGPT 或 Codex 隐式猜测。
- 在继续执行前检查来源、假设、受众、权限和输出质量;不确定内容应进入待确认列表。
- 围绕「How to use」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致。
利用 ExecPlans
这一节对应官方流程中的「Leverage ExecPlans」。落地时围绕「重构代码库」把目标、输入、执行步骤和验证证据保持在同一条工作流里。
操作要点:围绕「Leverage ExecPlans」推进「重构代码库」时,保持目标、输入、执行步骤和验证结果一致,并关注 Codex 等相关来源或工具。
用 skills 固化重复模式
这一节对应官方流程中的「Use skills for repeatable patterns」。落地时围绕「重构代码库」把目标、输入、执行步骤和验证证据保持在同一条工作流里。
操作要点:把已确认的上下文转成「重构代码库」所需的可审阅草稿或交付物,并关注 Codex 等相关来源或工具,并保留后续修改入口。
Prompt Library
建议提示词
先界定范围
For Refactor your codebase, first inspect the available sources and propose the smallest useful scope. Name the inputs, outputs, validation steps, permissions, and anything that needs approval before action. 交付前复核
Review the result for Refactor your codebase. Check source coverage, assumptions, unresolved questions, and the evidence that proves the output is ready to use.