klh-code-simplifier

Simplifies recently modified code for clarity and maintainability while preserving functionality.

1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/klh/skills --skill klh-code-simplifier-klh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: klh-code-simplifier
Source: https://github.com/klh/skills/tree/main/.well-known/agent-skills/klh-code-simplifier
Command: npx skills add https://github.com/klh/skills --skill klh-code-simplifier-klh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code that works but is hard to read accumulates technical debt: nested ternaries, redundant abstractions, and overly compact one-liners slow down reviews and future changes. This Skill refines recently modified code for clarity and consistency without altering its behavior. ## Core Features & Use Cases - Functionality-Preserving Refinement: Restructures code for readability while guaranteeing identical behavior, outputs, and features. - Project Standards Enforcement: Applies established conventions such as ES modules, explicit return types, function declarations, and consistent naming. - Complexity Reduction: Eliminates nested ternaries, redundant abstractions, dead code, and unnecessary nesting in favor of explicit, readable structures. - Use Case: After finishing a feature branch, ask the agent to review the modified files; it rewrites dense expressions like chained ternaries into clear switch or if/else statements and removes redundant helper functions. ## Quick Start Ask the agent to simplify and clean up the code you just modified in this session while keeping all functionality unchanged.

Frequently Asked Questions about klh-code-simplifier

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

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

Refactor only structure, not logic: replace nested ternaries with if/else chains, break dense one-liners into named intermediate steps, and remove redundant wrappers. This Skill follows a preserve-functionality principle so all outputs and behaviors remain identical.

How to refactor nested ternary operators in TypeScript?

Replace nested ternaries with a function using early returns or a switch statement. For example, convert chained conditional expressions into explicit if statements returning each status, which improves readability and debugging.

When should I avoid simplifying code?

Avoid simplification when it reduces clarity, creates overly clever one-liners, merges unrelated concerns, or removes helpful abstractions. Readability takes priority over fewer lines, and code outside the recently modified scope should be left untouched.

Does code simplification work with existing project style guides?

Yes, the refinement process applies project-specific standards such as those defined in CLAUDE.md, including ES module imports, function keyword preference, explicit return type annotations, and consistent naming conventions.

What is the difference between simplifying code and fixing bugs?

Simplification restructures working code for readability without changing behavior, while bug fixing changes behavior to correct defects. Simplify first, then run a bug audit so the review operates on cleaner, easier-to-analyze code.