code-simplification

code-simplification is a skill for Claude Code from vinvcn/addyosmani-agent-skills-zh. It costs 64 tokens per session (3,321 once invoked), scanned A, original, MIT.

A code-review and refactoring guide for making existing code easier to read while keeping its behavior unchanged. Refactoring means changing how code is organized without changing what it does.

In plain words
What is it for?
Use it to simplify readable-but-heavy code, clean up rushed implementations, combine duplicated logic, and check that tests and error behavior remain unchanged.
Why use it?
It helps remove unnecessary complexity such as deep nesting, long functions, unclear names, duplicated logic, and inconsistent changes without rewriting working behavior.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; mentions Claude Code.

Part of the agent-skills plugin — 23 skills, 8 commands, 3 agents, 1 hook shipped together

Good fit Use it to simplify readable-but-heavy code, clean up rushed implementations, combine duplicated logic, and check that tests and error behavior remain unchanged.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vinvcn/addyosmani-agent-skills-zh/code-simplification
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add vinvcn/addyosmani-agent-skills-zh --skill code-simplification
Clone the repo
git clone --depth 1 https://github.com/vinvcn/addyosmani-agent-skills-zh

Made for: Claude Code.

Or install agent-skills, the plugin that ships this one along with the rest of its 23 skills, 8 commands, 3 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-simplification

README.md
[![agentmods](https://agentmods.dev/badge/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification/github.svg)](https://agentmods.dev/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification)
Your own site
<a href="https://agentmods.dev/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification"><img src="https://agentmods.dev/badge/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-simplification

Your own site · 80×15
<a href="https://agentmods.dev/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification"><img src="https://agentmods.dev/badge/skills/vinvcn/addyosmani-agent-skills-zh/code-simplification.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,321 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.03321
Opus 5 $0.00032 $0.01661
Sonnet 5 $0.00013 $0.00664
Haiku 4.5 $0.00006 $0.00332

Measured 9d ago against content hash 5bf3a7c15b3e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

code-simplification scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-simplification/SKILL.md · 332 lines

How it starts

The opening of the file, as written. The whole thing — 332 lines — stays where its author put it; the contents beside it link to each section on GitHub.

代码简化

灵感来自 Claude Code Simplifier plugin。这里改编为一个模型无关、流程驱动的 skill,供任何 AI coding agent 使用。

概览

通过降低复杂度来简化代码,同时精确保留行为。目标不是减少行数,而是让代码更容易阅读、理解、修改和调试。每次简化都必须通过一个简单测试:“新团队成员理解它会不会比理解原版本更快?”

何时使用

  • 功能已经可用且测试通过,但实现感觉比必要状态更重
  • 代码审查中发现可读性或复杂度问题
  • 遇到深层嵌套逻辑、长函数或不清晰命名
  • 重构在时间压力下写出的代码
  • 合并分散在多个文件中的相关逻辑
  • 合并引入重复或不一致的变更之后

不应使用的情况:

  • 代码已经干净可读,不要为了简化而简化
  • 你还不理解代码在做什么,先理解再简化
  • 代码是性能关键路径,而“更简单”的版本会明显变慢
  • 你即将完全重写该模块,简化即将丢弃的代码是在浪费精力

五项原则

1. 精确保留行为

不要改变代码做什么,只改变它如何表达。所有输入、输出、副作用、错误行为和边界情况都必须保持一致。如果你不确定某个简化是否保留行为,就不要做。

ASK BEFORE EVERY CHANGE:
→ Does this produce the same output for every input?
→ Does this maintain the same error behavior?
→ Does this preserve the same side effects and ordering?
→ Do all existing tests still pass without modification?

2. 遵循项目约定

简化意味着让代码更符合代码库,而不是强加外部偏好。简化之前:

1. Read CLAUDE.md / project conventions
2. Study how neighboring code handles similar patterns
3. Match the project's style for:
   - Import ordering and module system
   - Function declaration style
   - Naming conventions
   - Error handling patterns
   - Type annotation depth

破坏项目一致性的简化不是简化,而是 churn。

3. 清晰优先于聪明

如果紧凑写法需要停下来费力解析,那么显式代码就优于紧凑代码。

// UNCLEAR: Dense ternary chain
const label = isNew ? 'New' : isUpdated ? 'Updated' : isArchived ? 'Archived' : 'Active';

// CLEAR: Readable mapping
function getStatusLabel(item: Item): string {
  if (item.isNew) return 'New';
  if (item.isUpdated) return 'Updated';
  if (item.isArchived) return 'Archived';
  return 'Active';
}
// UNCLEAR: Chained reduces with inline logic
const result = items.reduce((acc, item) => ({
  ...acc,
  [item.id]: { ...acc[item.id], count: (acc[item.id]?.count ?? 0) + 1 }
}), {});

// CLEAR: Named intermediate step
const countById = new Map<string, number>();
for (const item of items) {
  countById.set(item.id, (countById.get(item.id) ?? 0) + 1);
}

Read the full file on GitHub · 332 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 332 lines · 64 tokens per session scan A 5bf3a7c15b3e

Subscribe to this mod's changes

code-simplification is a skill published in the GitHub repository vinvcn/addyosmani-agent-skills-zh (30 stars, last pushed 4mo ago), licensed MIT. It adds 64 tokens to every session and 3,321 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

code-review-and-quality

Conducts multi-axis code review with hard rules against rubber-stamping and diff-only tunnel vision. Use before merging any change, whether written by yourself, another agent, or a human. Triggers on "review this", "is this ready to merge", or any completed implementation awaiting approval.

borhen68/SkillEngine · 63 tokens

doubt-driven-development

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production, security-sensitive logic, irreversible operations), or any time a confident output would be cheaper to verify now…

borhen68/SkillEngine · 67 tokens

code-simplification

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

borhen68/SkillEngine · 51 tokens

code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.

addyosmani/agent-skills · 51 tokens

doubt-driven-development

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production, security-sensitive logic, irreversible operations), or any time a confident output would be cheaper to verify now…

addyosmani/agent-skills · 67 tokens

code-simplification

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

addyosmani/agent-skills · 51 tokens