Claude-skill-registry 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.

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/code-simplifier-pproenca-dot-skills" ~/.claude/skills/majiayu000-claude-skill-registry-code-simplifier && rm -rf "$T"
manifest: skills/data/code-simplifier-pproenca-dot-skills/SKILL.md
source content

Community Code Simplification Best Practices

Comprehensive code simplification guide for AI agents and LLMs. Contains 45 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 DiscoveryCRITICAL
ctx-
5
2Behavior PreservationCRITICAL
behave-
6
3Scope ManagementHIGH
scope-
5
4Control Flow SimplificationHIGH
flow-
7
5Naming and ClarityMEDIUM-HIGH
name-
5
6Duplication ReductionMEDIUM
dup-
5
7Dead Code EliminationMEDIUM
dead-
5
8Language IdiomsLOW-MEDIUM
idiom-
7

Quick Reference

1. Context Discovery (CRITICAL)

2. Behavior Preservation (CRITICAL)

3. Scope Management (HIGH)

4. Control Flow Simplification (HIGH)

5. Naming and Clarity (MEDIUM-HIGH)

6. Duplication Reduction (MEDIUM)

7. Dead Code Elimination (MEDIUM)

8. Language Idioms (LOW-MEDIUM)

Workflow

  1. Discover context: Read CLAUDE.md, lint configs, examine existing patterns
  2. Identify scope: Focus on recently modified code unless asked to expand
  3. Apply transformations: Use rules in priority order (CRITICAL first)
  4. Verify behavior: Ensure outputs, errors, and side effects remain identical
  5. Keep diffs minimal: Small, focused changes that are easy to review

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information