simplify

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

1|Updated Mar 15, 2025
One-click install
npx skills add https://github.com/adikpb/dotfiles --skill simplify-adikpb
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: simplify
Source: https://github.com/adikpb/dotfiles/tree/main/.config/opencode/skills/simplify
Command: npx skills add https://github.com/adikpb/dotfiles --skill simplify-adikpb

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, 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 recently modified code. - Structured Four-Step Process: Understand the code first, identify simplification signals (nested ternaries, dead code, boolean flag arguments), apply changes incrementally, then verify the final diff. - Use Case: After a feature passes its tests but the implementation feels heavy, use this Skill to flatten nested conditionals, rename misleading variables, and remove dead code while keeping the test suite 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 refactor code without changing its behavior?▼

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

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 simplify code?▼

Avoid simplifying when the code is already readable, when you do not yet understand what it does, when it is performance-critical and the simpler version is measurably slower, or when the module is about to be rewritten entirely.

How do I keep refactoring consistent with project conventions?▼

Read the project's AGENTS.md or convention docs and study how neighboring code handles similar patterns before editing. Match the existing style for imports, naming, function style, error handling, and type annotations.

Can simplification go too far?▼

Yes. Over-simplification includes inlining away meaningful names, merging unrelated logic into one function, removing abstractions that support testability, and optimizing for line count instead of comprehension.