# 代码精简器 (code-simplifier)

> 在保留全部功能的前提下精简代码，按项目规范提升清晰度、一致性和可维护性。

- 分类: [重构](https://www.myskills.tools/zh/categories/refactoring/)
- 来源: 官方 · Sentry
- 代码仓库: https://github.com/getsentry/skills/tree/main/skills/code-simplifier (commit 24361e7)
- SKILL.md: https://github.com/getsentry/skills/blob/main/skills/code-simplifier/SKILL.md
- 安装命令: `npx skills add getsentry/skills --skill code-simplifier`
- 许可证: Apache-2.0
- 兼容工具: Claude Code
- 权限: read-repo ✓, write-files ✓, shell ✗, network ✗
- 状态: 扫描通过
- 规则扫描无法覆盖所有风险，安装前请阅读此技能的 SKILL.md，确认权限后再使用。

## 核心规则

绝不改变代码做什么，只改变它怎么做。

## 执行阶段

1. **定位最近改动** — 聚焦当前会话中修改过的代码，除非被明确要求扩大范围。
2. **分析改进点** — 查找不必要的嵌套、冗余代码与抽象、含糊命名、描述显而易见内容的注释和嵌套三元表达式。
3. **应用项目规范** — 遵循 CLAUDE.md 中的规范，如 ES 模块、function 关键字、显式返回类型和 Props 类型，优先清晰而非简短。
4. **确认并记录** — 确认功能完全不变、代码确实更简单易维护，只记录影响理解的重要改动。

## 权限说明（据 SKILL.md 整理）

| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 需要 | 修改最近改动过的代码以提升清晰度。 |
| 命令执行 | 不需要 | 技能未要求运行任何命令。 |
| 网络外发 | 不需要 | 不需要网络访问。 |

## SKILL.md 头部信息（YAML）

```yaml
---
name: code-simplifier
description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code", "refactor for clarity", "improve readability", or review recently modified code for elegance. Focuses on project-specific best practices.
---
```

首页: https://www.myskills.tools/zh/ · URL: https://www.myskills.tools/zh/skills/code-simplifier/
