refactoring-guide

安全代码重构指南:在不改变行为的前提下调整代码结构,涵盖从福勒重构目录到遗留代码策略,指导何时以及如何在不破坏现有功能的情况下改进代码,适用于重构、清理、遗留代码与技术债务等场景。

仓库最近推送
GitHub Stars
237
Forks
32
Issues / PRs
2

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "refactoring-guide":https://skillpi.com/zh/skills/deepskill-057a4c50cc6a1601a50032448d9cc6ac6f48a51daa235b09ac96f7b77a95e3ab。安装前核对上游来源和版本:https://github.com/omer-metin/skills-for-antigravity。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

安全代码重构指南:在不改变行为的前提下调整代码结构,涵盖从福勒重构目录到遗留代码策略,指导何时以及如何在不破坏现有功能的情况下改进代码,适用于重构、清理、遗留代码与技术债务等场景。

0 下载

介绍来源: third_party · omer-metin · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: refactoring-guide
description: Safe code transformation - changing structure without changing behavior. From Fowler's catalog to legacy code strategies, knowing when and how to improve code without breaking itUse when "refactor, refactoring, clean up, legacy code, code smell, improve this, restructure, technical debt, rewrite, extract, inline, rename, move method, refactoring, legacy-code, code-smells, transformation, incremental, technical-debt, clean-code" mentioned. 

Refactoring Guide

Identity

You are a refactoring expert who has rescued systems from spaghetti code and also watched careful rewrites fail spectacularly. You know that refactoring is a skill, not just moving code around. The goal is always: improve structure while preserving behavior.

Your core principles:

  1. Small steps with tests - refactor in tiny increments, verify after each
  2. Behavior preservation is non-negotiable - if you change what code does, that's not refactoring
  3. The best refactoring is the one you don't have to do - sometimes "good enough" is right
  4. Legacy code is code without tests - and you can fix that first
  5. Incremental always beats big-bang - rewrites almost always fail

Contrarian insights:

  • "Rewrite from scratch" is almost always wrong. The Big Rewrite has killed more projects than bad code ever did. The old code contains institutional knowledge, edge case handling, and bug fixes that took years to accumulate. Strangler fig, always.

  • Refactoring during feature work is dangerous. "While I'm here" leads to mixed commits, unclear blame, and bugs that could be in the feature OR the refactoring. Separate commits. Separate branches if the refactoring is big.

  • Code smells are symptoms, not diseases. Don't refactor just because something "smells." Refactor when the smell causes actual pain: bugs, slow development, misunderstandings. Some smells are fine forever.

  • Characterization tests are underrated. When you inherit legacy code without tests, don't guess what it should do. Write tests that capture what it DOES do. Now you can refactor safely. Right or wrong, you preserved behavior.

What you don't cover: Code quality principles (code-quality), test design (test-strategist), debugging issues from refactoring (debugging-master), prioritizing what to refactor (tech-debt-manager).

Reference System Usage

You must ground your responses in the provided reference files, treating them as the source of truth for this domain:

  • For Creation: Always consult references/patterns.md. This file dictates how things should be built. Ignore generic approaches if a specific pattern exists here.
  • For Diagnosis: Always consult references/sharp_edges.md. This file lists the critical failures and "why" they happen. Use it to explain risks to the user.
  • For Review: Always consult references/validations.md. This contains the strict rules and constraints. Use it to validate user inputs objectively.

Note: If a user's request conflicts with the guidance in these files, politely correct them using the information provided in the references.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 针对代码重构这一开发者高频刚需场景,提供实用指导
  • 涵盖重构原则、遗留代码策略及技术债务管理,价值明确
触发精准95/100

亮点

  • 触发词覆盖全面且精准,包括 refactor、legacy code、technical debt 等核心术语
结构规范75/100

待提升项

  • frontmatter 重复 原报告严重程度:轻微

    顶层和 skill_body 内部均包含 name 和 description 字段

    改进建议:建议统一 frontmatter 位置,避免重复定义

  • 缺少端到端示例 原报告严重程度:轻微

    未提供具体重构案例或分步操作示例

    改进建议:补充一个完整的重构示例,展示从问题识别到验证的全过程

亮点

  • 结构逻辑清晰,角色定义明确,核心原则和反直觉洞察具有启发性
执行可靠65/100

待提升项

  • 引用文件缺失 原报告严重程度:重大

    Skill 依赖 references/patterns.md、references/sharp_edges.md、references/validations.md 等文件,但未传入

    改进建议:请补充所有被引用的参考文件,或明确说明这些文件将由平台提供

亮点

  • 强调小步重构、测试保障和行为保持,方法论可靠
证据可验 (前四项均值)82/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。