Skip to content
Back to skills

Refactor Advisor

ASecurity

重构顾问 - 识别代码坏味道并提供重构方案

  • 876 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 26, 2026
code-quality

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add laolaoshiren/claude-code-skills-zh --skill refactor-advisor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Advisor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Refactor Advisor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/laolaoshiren-refactor-advisor/badge)](https://www.skillsdirectory.com/skills/laolaoshiren-refactor-advisor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: refactor-advisor
description: 重构顾问 - 识别代码坏味道并提供重构方案
---

# 代码重构顾问

## 触发条件
当用户要求重构代码、优化代码结构、改善代码质量、消除技术债务时激活此技能。

## 常见坏味道检测

| 坏味道 | 特征 | 重构手法 |
|--------|------|---------|
| 长方法 | 函数超过 50 行 | 提取方法 (Extract Method) |
| 大类 | 类超过 300 行 | 提取类 (Extract Class) |
| 重复代码 | 相似代码块出现 3+ 次 | 提取公共方法 |
| 过长参数 | 函数参数超过 4 个 | 引入参数对象 |
| 嵌套过深 | if/for 嵌套 3+ 层 | 卫语句 (Guard Clause) |
| 魔法数字 | 硬编码的数字 | 提取为常量 |
| 过长链式调用 | a.b.c.d.e | 提取中间变量 |

## 输出格式
为每个问题提供:
1. 📍 定位(文件 + 行号)
2. 🔍 问题描述
3. 🛠️ 重构方案(含 before/after 代码)
4. ⚠️ 注意事项

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…