refactor-advisor SKILL.md skillA
refactor-advisor from laolaoshiren/claude-code-skills-zh is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add laolaoshiren/claude-code-skills-zh/refactor-advisor@git:20260617.b8acb5fPins git:20260617.b8acb5f in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- laolaoshiren/claude-code-skills-zh
- Path
skills/refactor-advisor/SKILL.md- Versions recorded
- 2
- Latest version
- git:20260617.b8acb5f, committed Jun 17, 2026
- First version recorded
- Apr 14, 2026
- Size
- 3,247 bytes
- Repository stars
- 869
- License
- MIT
重构顾问 - 识别代码坏味道并提供重构方案.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# 代码重构顾问 ## 触发条件 当用户要求重构代码、优化代码结构、改善代码质量、消除技术债务时激活此技能。 ## 工作流程 ### 第 1 步:扫描代码库 - 使用 `grep`/`rg` 扫描目标目录,识别潜在坏味道 - 统计文件行数、函数长度、参数数量等指标 - 查找重复代码块(相似度 > 80%) ### 第 2 步:分类坏味道 按严重程度分类发现的问题: | 等级 | 含义 | 说明 | |------|------|------| | 🔴 严重 | 必须立即修复 | 影响可维护性和稳定性 | | 🟡 中等 | 建议尽快修复 | 降低代码可读性 | | 🟢 轻微 | 可择机优化 | 不影响功能但有改进空间 | ### 第 3 步:优先级排序 按以下维度综合排序: 1. **影响范围** — 被引用/调用次数越多,优先级越高 2. **变更频率** — git log 频繁改动的文件优先 3. **修复成本** — 成本低且收益高的优先处理 ### 第 4 步:输出重构方案 ## 常见坏味道检测 | 坏味道 | 特征 | 重构手法 | 等级 | |--------|------|---------|------| | 长方法 | 函数超过 50 行 | 提取方法 (Extract Method) | 🔴 | | 大类 | 类超过 300 行 | 提取类 (Extract Class) | 🔴 | | 重复代码 | 相似代码块出现 3+ 次 | 提取公共方法 | 🔴 | | 过长参数 | 函数参数超过 4 个 | 引入参数对象 | 🟡 | | 嵌套过深 | if/for 嵌套 3+ 层 | 卫语句 (Guard Clause) | 🟡 | | 魔法数字 | 硬编码的数字 | 提取为常量 | 🟢 | | 过长链式调用 | a.b.c.d.e | 提取中间变量 | 🟢 | | 全局可变状态 | 全局变量被多处修改 | 封装为模块/引入依赖注入 | 🔴 | | 过度耦合 | 模块间相互依赖 | 依赖反转、引入接口 | 🟡 | ## 输出格式 ### 完整报告模板 ```markdown # 代码重构报告 ## 概要 - 扫描文件数:XXX - 发现问题数:XX(🔴 X / 🟡 X / 🟢 X) - 预估工作量:X 天 ## 问题列表 ### 问题 1:[问题标题] - **📍 位置**:`src/services/user.ts:45-120` - **🔍 问题**:该函数长达 75 行,包含 3 层嵌套,职责不单一 - **🛠️ 重构方案**: - 提取 `validateUserData()` 方法 - 提取 `saveToDatabase()` 方法 …
Read the whole file at its exact version.
How to install
mdr add laolaoshiren/claude-code-skills-zh/refactor-advisor@sha256:79e57f70f0bf4c07The line at the top of this page pins the label git:20260617.b8acb5f, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_pkr4rymebumjmkzc)
4 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 2 versions of this file, between Apr 14, 2026 and Jun 17, 2026, about one every 64 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20260617.b8acb5f latest | 2026-06-17 | b8acb5f | 3,247 B | A | view · diff |
| git:20260414.3583839 | 2026-04-14 | 3583839 | 961 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (3247 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
laolaoshiren/claude-code-skills-zh · 869 stars · license MIT · pushed 2026-09-22 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_pkr4rymebumjmkzc GET https://markdownregistry.com/api/v1/resolve?ref=laolaoshiren/claude-code-skills-zh/refactor-advisor GET https://markdownregistry.com/api/v1/blob/79e57f70f0bf4c07d3d6b03dea69c865ac9c7fe5bee2fdde71d89c53eaf63186
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.