simplify

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

Updated May 23, 2021
One-click install
npx skills add https://github.com/Favot/.dotfiles --skill simplify-favot
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: simplify
Source: https://github.com/Favot/.dotfiles/tree/main/.config/opencode/skills/simplify
Command: npx skills add https://github.com/Favot/.dotfiles --skill simplify-favot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often accumulates unnecessary complexity—deep nesting, long functions, unclear names, and duplicated logic—that slows down maintenance and review. This Skill provides a disciplined process for reducing that complexity without changing what the code does. ## Core Features & Use Cases - Behavior-Preserving Refactoring: Every simplification must keep inputs, outputs, side effects, error behavior, and edge cases identical. - Five Guiding Principles: Preserve behavior, follow project conventions, prefer clarity over cleverness, maintain balance, and scope changes to what changed. - Structured Four-Step Process: Understand the code first, identify simplification signals, apply changes incrementally, and verify the final diff. - Use Case: After a feature passes its tests but the implementation has nested ternaries and a 100-line function, use this Skill to break it into readable, well-named helpers while keeping all tests green. ## Quick Start Ask the agent to simplify the recently modified function in your current file for readability without changing its behavior.

Frequently Asked Questions about simplify

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

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

Understand the code's responsibility, callers, and edge cases first, then apply one simplification at a time. After each change, verify that outputs, error behavior, and side effects remain identical using tests or a proportionate final-state verification plan.

What are the signs that code needs simplification?▼

Common signals include deep nesting, long functions with mixed responsibilities, nested ternaries, boolean flag arguments, repeated conditionals, misleading names, duplicated logic, dead code, and wrappers that add no value.

When should I not refactor code for readability?▼

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

Does this refactoring approach work with TypeScript projects?▼

Yes, the guidance explicitly favors straightforward TypeScript over clever compression, explicit names, and smaller focused helpers. It also requires matching existing project conventions for imports, naming, error handling, and type annotations.

How do I verify a refactor preserved behavior?▼

Run the checks required by the repository and release instructions against the final diff, and confirm outputs, error handling, and side effects are unchanged. Add extra evidence only when the changed scope or a stated uncertainty warrants it.