重构

工程开发 社区

技能解读

当前原文的自动摘译,尚未人工审校。

检查与 main 的差异,并对此分支中所有更改的代码执行结构重构。

重点关注:

提取并整合

将重复的逻辑拉入共享函数中。合并接近重复的代码路径。折叠不必要的包装层。

改善结构

压平深嵌套。将超大功能分解为集中的单元。将代码移至更靠近其使用位置的位置。并置相关逻辑。

清理 API 和接口

删除未使用的参数、导出和返回值。简化函数签名。使类型更紧凑、更精确。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
工程开发
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
94 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@unkeyed · NOASSERTION
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Refactor pass

Review the diff against main and perform a structural refactoring pass on all changed code in this branch.

Focus on:

1. **Extract and consolidate**: Pull repeated logic into shared functions. Merge near-duplicate code paths. Collapse unnecessary wrapper layers.

2. **Improve structure**: Flatten deep nesting. Break oversized functions into focused units. Move code closer to where it's used. Colocate related logic.

3. **Clean up APIs and interfaces**: Remove unused parameters, exports, and return values. Simplify function signatures. Make types tighter and more precise.

4. **Reduce indirection**: Inline trivial helpers that obscure intent. Remove pass-through functions that add no value. Shorten unnecessary call chains.

5. **Fix naming**: Rename variables, functions, and types so they say what they mean. Align naming with surrounding code conventions.

Rules:

- **Do not change behavior.** Every input/output must remain identical.
- **Stay within the branch diff.** Only refactor code that was added or modified in this branch. Do not refactor unrelated code unless it is directly entangled.
- **Respect project conventions.** Follow patterns and standards from CLAUDE.md and the surrounding codebase.
- **Don't over-abstract.** Three similar lines are fine. Only extract when duplication is real and likely to grow.
- **Commit-ready output.** The code should compile and pass tests after your changes.

Process:

1. Read the full branch diff (`git diff main...HEAD`)
2. Identify structural issues in the changed code
3. Apply refactors file by file
4. Run the project's type check / lint if available
5. Report a 1-5 sentence summary of what you changed

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。