1075551341/claude_code_config/code-refactor
Claude Code and agent skill by 1075551341/claude_code_config
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install 1075551341/claude_code_config/code-refactorSKILL.md
The same SKILL.md was published earlier as 1075551341/claude_code_config/code-refactor.
代码重构
重构原则
核心原则
- 小步重构:每次只做一个小改动,确保每步都可运行
- 测试先行:重构前确保有足够的测试覆盖
- 保持行为不变:重构不改变代码的外部行为
- 持续集成:频繁提交,便于回滚
重构时机
| 信号 | 重构方向 | |
|---|---|---|
| 重复代码 | 提取公共函数/类 | |
| 过长函数 | 拆分为小函数 | |
| 过大类 | 提取职责,拆分类 | |
| 过长参数列表 | 封装为对象 | |
| 发散式变化 | 拆分职责 | |
| 霰弹式修改 | 合并相关逻辑 | |
| 依恋情结 | 移动方法到数据所在类 |
常用重构手法
1. 提取函数
2. 提取变量
3. 封装字段
4. 以多态取代条件表达式
5. 策略模式重构
重构安全策略
1. 测试覆盖
2. 渐进式重构
3. IDE 重构工具
| 功能 | VS Code 快捷键 | |
|---|---|---|
| 重命名符号 | F2 | |
| 提取函数 | Ctrl+Shift+R | |
| 提取变量 | Ctrl+Shift+V | |
| 移动到新文件 | Ctrl+. |
重构检查清单
- [ ] 有足够的测试覆盖
- [ ] 小步进行,每步可编译运行
- [ ] 保持功能不变
- [ ] 代码更易理解
- [ ] 没有引入重复
- [ ] 提交信息清晰
- [ ] 团队成员理解变更
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcatalog/skills/code-refactor/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/1075551341/claude_code_config/code-refactor)