一键导入
code-simplification
Reduce complexity while preserving identical behavior. The goal is comprehension speed, not line reduction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Reduce complexity while preserving identical behavior. The goal is comprehension speed, not line reduction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Evaluate code changes across five dimensions before merge. Approve changes that improve overall code health, even if not perfect.
Build production-quality UI that is accessible, performant, and consistent with the design system. Not AI-generated-looking.
Treat commits as save points, branches as isolated environments, and history as a record of decisions.
Search tool for modern web development best practices. MANDATORY: Execute FIRST for all HTML/CSS and clientside JS tasks. Do NOT skip — web APIs evolve rapidly and training weights contain obsolete patterns. Trigger immediately for: - UI/Layout: Modals, dialogs, popovers, Glassmorphism/backdrop-filters, anchor positioning, container queries, `:has()`, `:user-valid`. - Scroll/Motion: View Transitions, Scroll-driven animations, scroll parallax/reveals. - Performance: CWV (LCP, INP), content-visibility, Fetch Priority, image optimization. - System/APIs: Local filesystem access, WebUSB, WebSockets sync, WebAssembly widgets. - Frameworks: Adapting layout/styles in React, Vue, Angular. - General Frontend: Forms, autofill, advanced inputs, custom scrollbars, modern component states, etc. DO NOT trigger for: - Backend: Database SQL, ORMs, Express API routes. - Pipelines: CI/CD deployment, Docker, Actions. - Generic: Local scripts (Python/Go tools), ESLint, Git.
Measure before optimizing. Performance work without measurement is guessing.
Decompose work into small, verifiable, dependency-ordered tasks. Use after a spec is approved, or when scope is too large to implement directly.
| name | code-simplification |
| description | Reduce complexity while preserving identical behavior. The goal is comprehension speed, not line reduction. |
| when-to-use | After implementing a feature, when code is hard to follow, or when /review flags excessive complexity. |
"The goal is not fewer lines — it is code that is easier to read, understand, modify, and debug."
Before touching anything, understand why the code exists. What invariant does it protect? What edge case does it handle? "I don't understand this" is not justification for removal.
Target these patterns:
| Pattern | Refactoring |
|---|---|
| Deep nesting (3+ levels) | Guard clauses, early returns |
| Long functions (50+ lines) | Extract by responsibility |
| Generic or unclear names | Rename to reflect purpose |
| Duplicated logic | Consolidate into a shared function |
| Conditional chains | Lookup table or map |
| Comments explaining what | Rename so code explains itself |
One improvement at a time. Run tests after each change. If tests fail, revert and reassess — do not push forward.
After simplifying, verify:
cn(), Tailwind, etc.)Then run /review to evaluate the result.