Agent SkillsAmery2010/open-builder › code-simplifier

code-simplifier

GitHub

简化指定或修改的代码以提升清晰度、一致性和可维护性,严格保持行为不变。遵循项目约定,避免过度清理,仅针对用户指定的范围进行手术式重构。

public/skills/code-simplifier/SKILL.md Amery2010/open-builder

触发场景

需要简化代码逻辑 提升代码可读性 消除意外复杂度

安装

npx skills add Amery2010/open-builder --skill code-simplifier -g -y
更多选项

非标准路径

npx skills add https://github.com/Amery2010/open-builder/tree/main/public/skills/code-simplifier -g -y

不安装直接使用

npx skills use Amery2010/open-builder@code-simplifier

指定 Agent (Claude Code)

npx skills add Amery2010/open-builder --skill code-simplifier -a claude-code -g -y

安装 repo 全部 skill

npx skills add Amery2010/open-builder --all -g -y

预览 repo 内 skill

npx skills add Amery2010/open-builder --list

SKILL.md

Frontmatter
{
    "name": "code-simplifier",
    "tags": [
        "refactoring",
        "maintainability",
        "clarity"
    ],
    "author": "Open Builder adaptation of Anthropic code-simplifier",
    "version": "1.0.0",
    "description": "Simplify user-specified or newly modified code for clarity, consistency, and maintainability while preserving exact behavior. Follow AGENTS.md, CLAUDE.md, and established project conventions; avoid broad cleanup."
}

Code simplifier

Refine code so it is easier to read, reason about, test, and maintain without changing its behavior. Work only on code the user identified or code modified in the current request unless the user explicitly broadens the scope.

This Open Builder adaptation replaces fixed provider-specific style rules with the actual project's AGENTS.md, CLAUDE.md, formatter and lint configuration, nearby code, and established conventions. Source and license details are in SOURCE.md and LICENSE.txt.

Required boundaries

  1. Preserve behavior and contracts. Inputs, outputs, side effects, error semantics, ordering, public types, routes, selectors, stored formats, and performance-sensitive characteristics must remain intact unless the user asked to change them.
  2. Read before editing. Inspect the target, its callers and consumers, relevant tests, and project guidance. Do not infer a convention from generic preference when the repository provides evidence.
  3. Keep scope surgical. Do not opportunistically simplify untouched modules, rename public APIs, migrate libraries, or reformat unrelated files.
  4. Prefer the simplest sufficient code. Remove accidental complexity, not useful structure. Do not replace one clear abstraction with a clever one-liner or introduce speculative helpers for a single use.
  5. Verify equivalence. Run the narrowest relevant checks, then broader project gates in proportion to risk. Report any runtime or browser evidence not run.

What to improve

  • Reduce avoidable nesting with early returns when they make control flow clearer.
  • Replace repeated expressions with a well-named local value when it clarifies intent.
  • Consolidate genuinely duplicated logic while preserving distinct business rules.
  • Improve names that hide purpose or invariants without causing an unnecessary public rename.
  • Strengthen types and narrowing when it removes ambiguity without changing runtime behavior.
  • Delete dead branches, unused imports, obsolete comments, and helpers made redundant by this request.
  • Keep comments for invariants, tradeoffs, protocol details, and non-obvious workarounds; remove comments that merely restate the code.
  • Break apart functions or components only when they mix distinct responsibilities or become materially easier to test and understand.
  • Prefer explicit if/else, switch, or named predicates over deeply nested ternaries and dense boolean expressions.
  • Preserve existing error handling style unless it is itself the source of unnecessary complexity.

What not to do

  • Do not optimize for fewer lines.
  • Do not flatten useful domain abstractions or combine unrelated responsibilities.
  • Do not add generalized factories, registries, configuration, compatibility layers, or fallback paths without current consumers.
  • Do not change sync/async behavior, execution order, error types, logging, cancellation, caching, or concurrency semantics accidentally.
  • Do not silently broaden types, use any, suppress lint rules, or weaken validation to make code shorter.
  • Do not rewrite working code into a personal style that conflicts with the repository.
  • Do not add dependencies for a simplification that local language or project primitives can express clearly.
  • Do not modify generated files, vendored code, lockfiles, or migrations unless the requested simplification requires it.

Workflow

  1. Define the exact files or changed regions in scope.
  2. Read project instructions, tests, and nearby examples.
  3. State the behavior and invariants that must remain unchanged.
  4. Identify specific complexity with a concrete payoff for simplifying it.
  5. Make the smallest coherent edits.
  6. Review the diff for accidental behavior changes and unrelated churn.
  7. Run focused tests, type checking, linting, formatting, or build checks that cover the change.
  8. Summarize only material simplifications and any verification boundaries.

If the current code is already the clearest form, leave it alone and say so. A no-op is better than cosmetic churn.

版本历史

  • c07ad35 当前 2026-09-09 12:45

同 Skill 集合

public/skills/accessibility/SKILL.md
public/skills/code-review/SKILL.md
public/skills/debugging/SKILL.md
public/skills/design-taste-frontend/SKILL.md
public/skills/frontend-design/SKILL.md
public/skills/react-patterns/SKILL.md
public/skills/tailwind-helpers/SKILL.md
public/skills/typescript-patterns/SKILL.md

元信息

文件数
0
版本
c07ad35
Hash
f30d4a72
收录时间
2026-09-09 12:45

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 18:21
浙ICP备14020137号-1 $访客地图$