Agent Skills
› NeverSight/learn-skills.dev
› code-simplifier
code-simplifier
GitHub用于简化代码以提升可读性、一致性和可维护性,同时严格保留原有功能、输出和接口。适用于刚添加或修改的代码,通过消除冗余逻辑、优化结构和命名来清理代码,不进行行为变更。
Trigger Scenarios
代码刚被添加或修改后需要清理
代码可读性差但需保持功能不变
需要重构以提高可维护性
Install
npx skills add NeverSight/learn-skills.dev --skill code-simplifier -g -y
SKILL.md
Frontmatter
{
"name": "code-simplifier",
"description": "Simplify and refactor code for clarity, consistency, and maintainability while preserving exact behavior. Use when code was just added or modified and needs readability-focused cleanup without changing outputs, side effects, or external interfaces."
}
Code Simplifier
Refine code so it is easier to read, reason about, and maintain without changing what it does.
Source basis: adapted from Anthropic's code-simplifier skill:
https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md
Core Rules
- Preserve functionality exactly.
- Keep public behavior, outputs, side effects, and interfaces unchanged.
- Follow project-specific coding standards and patterns.
- Prefer clarity over compactness.
- Avoid clever rewrites that reduce debuggability.
Simplification Targets
Improve code by:
- Reducing unnecessary nesting and branching complexity.
- Removing redundant abstractions and duplicate logic.
- Renaming unclear identifiers to improve intent readability.
- Splitting dense logic into coherent, single-purpose helpers.
- Replacing fragile one-liners with explicit, readable control flow.
- Removing comments that only restate obvious code behavior.
Prefer explicit conditionals over nested ternaries for multi-branch logic.
Boundaries
Do not:
- Change business logic or edge-case behavior.
- Alter API contracts, data formats, or error semantics unless requested.
- Expand scope beyond recently touched code unless explicitly requested.
- Over-normalize style at the expense of local codebase conventions.
Workflow
- Identify files and sections changed in the current task.
- Detect readability and maintainability issues in that scope.
- Apply minimal, behavior-preserving refactors.
- Re-check for regressions in logic, interfaces, and side effects.
- Run available lint/test checks when practical.
- Summarize only meaningful structural changes.
Decision Heuristics
- If two versions are equivalent, choose the one a new teammate can understand fastest.
- Keep useful abstractions; remove only those that add indirection without value.
- Prefer straightforward flow over reduced line count.
- Stop when readability gains flatten out.
Version History
- e0220ca Current 2026-07-05 22:20


