simplifying-code
Simplifies, polishes, and declutters code without changing behavior. Use when asked to "simplify code", "clean up code", "polish code", "refactor"…
от iliaal★ 37 звёзд на GitHub
Установить simplifying-code в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Simplifying Code
Principles
| Principle | Rule |
|---|---|
| Preserve behavior | Output must do exactly what the input did — no silent feature additions or removals. Specifically preserve: async/sync boundaries, error propagation paths, and logging side effects |
| Explicit over clever | Prefer explicit variables over nested expressions. Readable beats compact |
| Simplicity over cleanliness | Prefer straightforward code over pattern-heavy "clean" code. Three similar lines beat a premature abstraction |
| Surgical changes | Touch only what needs simplifying. Match existing style, naming conventions, and formatting of the surrounding code |
| Surface assumptions | Before changing a block, identify what imports it, what it imports, and what tests cover it. Edit dependents in the same pass |
Process
- Read first — understand the full file and its dependents before changing anything
- Identify invariants — what must stay the same? Public API, return types, side effects, error behavior
- Identify targets — find the highest-impact simplification opportunities (see Smell → Fix table)
- Apply in order — control flow → naming → duplication → data shaping → types. Structural changes first, cosmetic last
- Verify — confirm no behavior change: tests pass, types check, imports resolve
Smell → Fix
| Smell | Fix |
|---|---|
| Deep nesting (>2 levels) | Guard clauses with early returns |
| Long function (>30 lines) | Extract into named functions by responsibility |
| Too many parameters (>3) | Group into an options/config object |
| Duplicated block (3+ occurrences) | Extract shared function. Two copies = leave inline; wait for the third |
| Magic numbers/strings | Named constants |
| Complex conditional | Extract to descriptively-named boolean or function |
| Dead code / unreachable branches | Delete entirely — no commented-out code |
Unnecessary else after return |
Remove else, dedent |
AI Slop Removal
When simplifying AI-generated code, specifically target:
- Redundant comments that restate the code (
// increment counterabovecounter++) — delete them - Unnecessary defensive checks for conditions that cannot occur in context — remove the guard
- Gratuitous type casts (
as any,as unknown as T) — fix the actual type or use a proper generic - Over-abstraction (factory for 2 objects, wrapper around a single call, util file with 1 function) — inline the code
- Inconsistent style that drifts from the file's existing conventions — match the file
Constraints
- Only simplify what was requested — do not add features, expand scope, or introduce new dependencies
- Leave unchanged code untouched — do not add comments, docstrings, or type annotations to lines that were not simplified
- If a simplification would make the code harder to understand, skip it
- When unsure whether a block is dead code, ask instead of deleting
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- manifest.json
FAQ
Что делает скилл simplifying-code?
Simplifies, polishes, and declutters code without changing behavior. Use when asked to "simplify code", "clean up code", "polish code", "refactor", "declutter", "reduce complexity", "remove dead code", "remove AI slop", "improve readability", or "tighten up this file".
Как установить скилл simplifying-code?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл simplifying-code запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…