跳到正文
cccskills
免费在 GitHub 公开

code-simplification

Simplify code that works — remove speculative abstraction, dead flexibility, and needless indirection while keeping behaviour identical and verified. Use when a feature has just landed ('now simplify it'), when AI-generated code arrives over-engineered, when a file has grown hard to follow, or as the cleanup pass before review. Produces a smaller, flatter version with identical behaviour, plus a ledger of what was removed and why it was safe. For finding bugs use code-review-checklist / ai-code-review — this skill assumes it works and makes it simple.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md5.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Code Simplification Skill

Code accretes defensive complexity: abstractions for futures that never came, options nobody passes, indirection that once had a reason. AI-generated code arrives pre-accreted — interfaces with one implementer, config objects with nine unused knobs. Simplification is its own pass with its own rule: behaviour identical, verified; complexity removed, listed.

What This Skill Produces

  • The simplified code — smaller, flatter, same behaviour
  • A removal ledger: each simplification, why it was safe, and what future it forecloses (honestly)
  • Verification evidence that behaviour held

Required Inputs

Ask for these if not provided:

  • The code — what works today and should keep working
  • The pressure — what made it feel complex: onboarding, a bug, a review comment
  • What must not change — the public API, behaviour, or performance envelope
  • Test coverage — whether there are tests to prove the simplification is safe

Working from a brief

Given a description of the code instead of the code itself, deliver the simplification anyway: the target shape in code, each removal with the reason and the test that proves behaviour is unchanged, and the order to do them in. Say which steps need a look at the real code before they are applied.

What to Hunt (in order of payoff)

  1. Speculative generality — the interface with one implementation, the parameter always called with the same value, the config option no caller sets, the "pluggable" thing nothing plugs into. Rule: the future that justified it must be on a roadmap, not in an imagination. YAGNI is a removal warrant.
  2. Indirection without insulation — layers that only forward: the wrapper that calls one function, the factory returning one type, the event fired for one listener sitting next door. Each hop costs a reader a jump; collapse hops that don't isolate change.
  3. Dead and duplicate paths — unreachable branches, handled-nowhere flags, the local re-implementation of a utility that exists (grep before believing anything is unique).
  4. Cleverness taxing readers — the nested ternary, the reduce that should be a loop, the regex doing four jobs. Rewrite for the next reader; "fewer characters" is not "simpler".
  5. Flatten control flow — guard clauses over nested ifs; early returns over else-pyramids; splitting the function that needs a comment per section into functions named by those comments.

The Safety Discipline (what makes this different from vandalism)

  • Behaviour-preserving means verified, not asserted: run the full relevant suite before AND after; if coverage is thin over the code being simplified, add the pinning test first — simplifying untested code is refactoring blind.
  • One hunt-class per pass where the code is load-bearing (remove speculation, verify; collapse indirection, verify) — mirrors incremental-implementation's rule.
  • Chesterton's fence check on anything weird: git log/blame the strange bit before deleting it. Some "needless" complexity is a bug fix wearing an odd shape — if the history shows a fix, keep it and comment WHY it's shaped that way instead.
  • Public surface needs a wider net: simplifying exported/shared code means checking callers across the codebase, not just the local file.

Output Format

Simplification: [target]

Verification: [suite/build run before → after: identical] · pinning tests added: [n or none-needed because…]

Removal ledger

What was removed/flattenedClassWhy safeFuture foreclosed (honest)

Kept deliberately: [the weird-but-load-bearing bits, with their Chesterton evidence] Size: [LOC/complexity before → after]

Quality Checks

  • Full verification ran before and after — identical behaviour, evidenced
  • Thinly-tested code got pinning tests before simplification
  • Every removal states the future it forecloses — "none" must be argued, not assumed
  • Strange code was history-checked before deletion (Chesterton's fence)
  • The result is simpler for a READER, not just shorter

Anti-Patterns

  • Do not simplify and change behaviour in one pass — the moment behaviour shifts, this became a rewrite without a spec
  • Do not delete weirdness without checking why it's weird — some of it is a production incident's scar tissue
  • Do not confuse terse with simple — code golf raises the reading tax this skill exists to cut
  • Do not remove flexibility that's actually on the roadmap — YAGNI applies to imagined futures, not planned ones
  • Do not skip the ledger — invisible simplification is indistinguishable from unexplained deletion in review

Example Trigger Phrases

  • "Now simplify it."
  • "This AI-generated code is over-engineered: simplify it."
  • "Remove the dead abstraction in this file."
  • "Make this simpler without changing behaviour."

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Design a 360-degree feedback survey or write a structured 360 feedback report. Use when asked to build a 360 feedback process, write 360 feedback for a colleague, design a feedback survey, or produce a feedback report. Produces either a complete survey instrument with rating scales and open-ended questions, or a structured narrative feedback report with themes, strengths, and development areas.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

Decode a 401k or workplace retirement plan — the real cost of its funds, the match's fine print, vesting math, and the plan features worth using or avoiding. Use when someone asks 'is my 401k any good', 'decode my 401k plan', 'which funds should I look at', or 'what fees am I paying'. Produces a fee decode in dollars-over-time, match and vesting math, a fund-lineup triage by cost, and the questions for HR or the plan administrator.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

Design statistically rigorous A/B tests for product features, UI changes, onboarding flows, and pricing experiments. Use when asked to set up an experiment, design an A/B test, calculate sample size, or interpret test results. Produces a complete test plan with hypothesis, variant definitions, sample size, duration estimate, guardrail metrics, and a results interpretation guide.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

Analyse a finished A/B test and write the readout — the result, whether it's statistically and practically significant, what it means, and the ship/no-ship call. Use when asked to analyse experiment results, write an A/B test readout, interpret test data, or decide whether to ship a variant. Produces a clear verdict with the lift and confidence, segment cuts, the risks (peeking, novelty, sample), and a recommendation. Distinct from planning a test — this reads results.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

Build or tailor an academic CV for faculty, postdoc, research or fellowship applications: publications, grants, teaching, supervision and service in the order the field expects, with consistent citations. Use when asked to write my academic CV, update my CV for a lectureship, tenure-track or postdoc application, format my publications list, or adapt my academic CV for an industry research role. Produces the full academic CV, a field-appropriate section order, a clean publications list in one citation style, and a two-page summary version when asked.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

Generate a WCAG 2.2 accessibility audit checklist and remediation suggestions for any UI or design. Use when asked to audit for accessibility, check WCAG compliance, review a design for a11y issues, or create an accessibility remediation plan. Produces a prioritised checklist with pass/fail assessments and specific fixes.

中文简介正在准备中。当前显示原文说明。

mohitagw15856/pm-claude-skills14702026年10月19日 更新

查看 mohitagw15856 的全部技能

报告此技能的问题