agentleFS
ZhouYinLong-labZhouYinLong-lab/Dog-Skills/code-simplifier/SKILL.md

code-simplifier

Skill7 starsChanged 5 months agoMITView on GitHub

AI 生成代码后自动二次优化——不改代码行为,只优化结构和可读性。消除重复代码、 减少嵌套层级、简化复杂逻辑、提取公共可复用函数。代码行数通常减少 30-40%, 嵌套深度从 4-5 层降到 1-2 层。 Trigger keywords: code simplifier, 代码简化, 代码优化, 简化代码, 重构, 减少嵌套, 消除重复, 提取公共函数, simplify code, 精简代码, 代码瘦身, 优化可读性, 写完代码后优化, AI代码优化。

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use tdd-rust, type-design-analyzer and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • FlorianBruniauxSkill

    tdd-rust

    Also in 3 projects that use this

  • PaulKinlanSkill

    type-design-analyzer

    Analyzes type design quality focusing on encapsulation, invariant expression, usefulness, and enforcement. Provides quantitative ratings (1-10) for each dimension.

    Also in 3 projects that use this

  • PaulKinlanSkill

    comment-analyzer

    Analyzes code comments for accuracy, completeness, and long-term maintainability. Identifies misleading comments, comment rot, and documentation gaps.

    Also in 4 projects that use this

  • ufodev-ioSkill

    security-guardian

    Comprehensive security layer for all interactions with Claude: audits code, dependencies, commands, configs, and AI-generated output for vulnerabilities. Protects against prompt injection, data leaks, unsafe advice, and social engineering. Works in Cursor, Claude Code, claude.ai, and API contexts. Use always as a background security protocol in any Claude-powered environment.

    Also in 3 projects that use this

  • SentrySkill

    find-bugs

    Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.

    Also in 3 projects that use this

  • tossSkill

    pr-triage

    Classify and summarize a PR for efficient review

    Also in 3 projects that use this

  • +1 more from PaulKinlan

The file

Files
SKILL.md

Code Simplifier — AI 代码自动二次优化

AI 生成代码有一个通病:啰嗦。变量名重复声明、if 嵌套四五层、明明三行能写完的逻辑硬拆成三十行。这些代码能跑,但过两个月再看,你根本不想维护。

Code Simplifier 在代码生成之后自动做二次优化。

核心能力

不改行为,只优化结构

功能逻辑原封不动,只优化:

  • 消除重复代码:合并相同的逻辑块,提取重复模式
  • 减少嵌套层级:if 嵌套从 4-5 层降到 1-2 层
  • 简化复杂逻辑:三行能写完的不用三十行
  • 提取公共函数:识别可复用的代码块,提取为独立函数
  • 统一命名风格:变量命名更一致、更语义化

实测效果

  • 代码行数通常减少 30-40%
  • 嵌套深度从 4-5 层降到 1-2 层
  • 变量命名更一致

安装

/plugin install code-simplifier@claude-plugin-directory

使用方式

# 简化当前改动
/simplify

# 在 Claude Code 里对 AI 说
"简化刚才生成的代码"
"帮我优化这个模块的可读性"

推荐流水线

① 写代码 ──→ ② Code Simplifier 优化 ──→ ③ Code Review 审查 ──→ ④ 人工 Review

为什么是这个顺序?

  • 先简化再审查——简化后的代码更容易发现真正的问题
  • Code Review 能检查简化过程是否引入了意外行为
  • 最后人工把关——AI 写 + AI 审 + 人审 = 三重保障

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.