simplify

Simplifies code for readability while preserving exact behavior and project conventions.

Updated Jun 16, 2022
One-click install
npx skills add https://github.com/SimonZimmer/dotfiles --skill simplify-simonzimmer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: simplify
Source: https://github.com/SimonZimmer/dotfiles/tree/main/.config/opencode/skills/simplify
Command: npx skills add https://github.com/SimonZimmer/dotfiles --skill simplify-simonzimmer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often ends up harder to read than it needs to be: deep nesting, long functions, nested ternaries, and duplicated logic slow down reviews and future changes. This Skill guides behavior-preserving refactoring so code becomes easier to understand without risking regressions. ## Core Features & Use Cases - Behavior-Preserving Refactoring: Every simplification must keep inputs, outputs, side effects, and error behavior identical, with explicit verification steps. - Five Guiding Principles: Preserve behavior, follow project conventions, prefer clarity over cleverness, avoid over-simplification, and scope changes to what recently changed. - Structured Four-Step Process: Understand the code first, identify simplification signals (deep nesting, dead code, misleading names), apply changes incrementally, then verify the final diff. - Use Case: After a feature passes its tests but the implementation feels heavy, run this Skill to flatten nested conditionals, rename unclear variables, and remove dead code while keeping the test suite green. ## Quick Start Ask the agent to simplify the recently modified function in the current file without changing its behavior, following the simplify skill.

Frequently Asked Questions about simplify

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code without changing its behavior?▼

Understand what the code does first, including callers, edge cases, and tests, then make one simplification at a time and verify behavior after each change. The Skill enforces identical inputs, outputs, side effects, and error behavior for every edit.

How to simplify deeply nested code and long functions?▼

Replace nested ternaries with readable control flow, split long functions into smaller focused helpers, and remove duplicated or dead code. Keep changes scoped to recently modified code and match the project's existing style.

When should I not simplify code?▼

Avoid simplifying code you do not yet understand, code that is already clean, performance-critical paths where the simpler version is measurably slower, or modules you are about to rewrite entirely.

Does code simplification require running tests?▼

Yes, the Skill requires a proportionate final-state verification plan for the final diff. Run the checks required by the repository and add evidence when the changed scope or uncertainty warrants it.

What are the risks of over-simplifying code?▼

Over-simplification can inline away meaningful names, merge unrelated logic, or remove abstractions that support testability and extensibility. The Skill warns against optimizing for line count over comprehension.