Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Development

code-simplifier

Code simplification skill for improving clarity, consistency, and maintainability while preserving exact behavior. Use when simplifying code, reducing complexity, cleaning up recent changes, applying refactoring patterns, or improving readability. Triggers on tasks involving code cleanup, simplification, refactoring, or readability improvements.

pproenca · AI review on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add pproenca/dot-skills --skill code-simplifier

About this skill


name: code-simplifier description: Code simplification skill for improving clarity, consistency, and maintainability while preserving exact behavior. Use when simplifying code, reducing complexity, cleaning up recent changes, applying refactoring patterns, or improving readability. Triggers on tasks involving code cleanup, simplification, refactoring, or readability improvements.

Community Code Simplification Best Practices

Comprehensive code simplification guide for AI agents and LLMs. Contains 47 rules across 8 categories, prioritized by impact from critical (context discovery, behavior preservation) to incremental (language idioms). Each rule includes detailed explanations, real-world examples comparing incorrect vs. correct implementations, and specific impact metrics.

Core Principles

  1. Context First: Understand project conventions before making any changes
  2. Behavior Preservation: Change how code is written, never what it does
  3. Scope Discipline: Focus on recently modified code, keep diffs small
  4. Clarity Over Brevity: Explicit, readable code beats clever one-liners

When to Apply

Reference these guidelines when:

  • Simplifying or cleaning up recently modified code
  • Reducing nesting, complexity, or duplication
  • Improving naming and readability
  • Applying language-specific idiomatic patterns
  • Reviewing code for maintainability issues

Rule Categories by Priority

PriorityCategoryImpactPrefixRules
1Context DiscoveryCRITICALctx-4
2Behavior PreservationCRITICALbehave-6
3Scope ManagementHIGHscope-5
4Control Flow SimplificationHIGHflow-9
5Naming and ClarityMEDIUM-HIGHname-6
6Duplication ReductionMEDIUMdup-5
7Dead Code EliminationMEDIUMdead-5
8Language IdiomsLOW-MEDIUMidiom-7

Quick Reference

1. Context Discovery (CRITICAL)

  • ctx-read-claude-md - Always read CLAUDE.md before simplifying
  • ctx-detect-lint-config - Check for linting and formatting configs
  • ctx-follow-existing-patterns - Match existing code style in file and project
  • ctx-project-over-generic - Project conventions override generic best practices

2. Behavior Preservation (CRITICAL)

  • behave-preserve-outputs - Preserve all return values and outputs
  • behave-preserve-errors - Preserve error messages, types, and handling
  • behave-preserve-api - Preserve public function signatures and types
  • behave-preserve-side-effects - Preserve side effects (logging, I/O, state changes)
  • behave-no-semantics-change - Forbid subtle semantic changes
  • behave-verify-before-commit - Verify behavior preservation before finalizing

3. Scope Management (HIGH)

  • scope-recent-code-only - Focus on recently modified code only
  • scope-minimal-diff - Keep changes small and reviewable
  • scope-no-unrelated-refactors - No unrelated refactors
  • scope-no-global-rewrites - Avoid global rewrites and architectural changes
  • scope-respect-boundaries - Respect module and component boundaries

4. Control Flow Simplification (HIGH)

  • flow-early-return - Use early returns to reduce nesting
  • flow-guard-clauses - Use guard clauses for preconditions
  • flow-no-nested-ternaries - Never use nested ternary operators
  • flow-explicit-over-dense - Prefer explicit control flow over dense expressions
  • flow-flatten-nesting - Flatten deep nesting to maximum 2-3 levels
  • flow-single-responsibility - Each code block should do one thing
  • flow-positive-conditions - Prefer positive conditions over double negatives
  • flow-optional-chaining - Use optional chaining and nullish coalescing
  • flow-boolean-simplification - Simplify boolean expressions

5. Naming and Clarity (MEDIUM-HIGH)

  • name-intention-revealing - Use intention-revealing names
  • name-nouns-for-data - Use nouns for data, verbs for actions
  • name-avoid-abbreviations - Avoid cryptic abbreviations
  • name-consistent-vocabulary - Use consistent vocabulary throughout
  • name-avoid-generic - Avoid generic names
  • name-string-interpolation - Prefer string interpolation over concatenation

6. Duplication Reduction (MEDIUM)

  • dup-rule-of-three - Apply the rule of three
  • dup-no-single-use-helpers - Avoid single-use helper functions
  • dup-extract-for-clarity - Extract only when it improves clarity
  • dup-avoid-over-abstraction - Prefer duplication over premature abstraction
  • [dup-data-driven](references/dup-data-d
Read the complete source ↗