Claude-skill-registry code-simplify
Simplify and refine recently modified code for clarity, consistency, and maintainability while preserving all functionality. Use this skill when asked to simplify code, clean up recent changes, refine implementations, reduce complexity, or improve readability of code that was just written or modified. Focuses on recently touched code unless explicitly directed to a broader scope.
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-simplify" ~/.claude/skills/majiayu000-claude-skill-registry-code-simplify && rm -rf "$T"
manifest:
skills/data/code-simplify/SKILL.mdsource content
Code Simplification
Enhance code clarity, consistency, and maintainability while preserving exact functionality. Prioritize readable, explicit code over compact solutions.
Scope
Focus only on recently modified code unless explicitly instructed otherwise. Use
git diff or git diff --cached to identify what changed. Read the project's AGENTS.md or CLAUDE.md for project-specific conventions and apply them consistently.
Simplification Principles
Reduce complexity
- Flatten unnecessary nesting
- Eliminate redundant code and premature abstractions
- Consolidate related logic
- Remove comments that describe obvious code
Improve clarity
- Use clear, descriptive variable and function names
- Avoid nested ternary operators - prefer switch statements or if/else chains for multiple conditions
- Choose explicit code over clever one-liners
- Clarity over brevity - three similar lines beats a confusing abstraction
Apply project standards
- Follow patterns established in AGENTS.md/CLAUDE.md
- Match existing naming conventions
- Use established abstractions where appropriate
What NOT to Do
- Change what the code does - only change how it does it
- Create overly clever solutions that are hard to understand
- Combine too many concerns into single functions
- Remove helpful abstractions that improve organization
- Prioritize "fewer lines" over readability
- Make code harder to debug or extend
- Over-simplify to the point of reducing maintainability
Process
- Identify recently modified code sections via git
- Read AGENTS.md/CLAUDE.md for project conventions
- Analyze for opportunities to improve clarity and consistency
- Apply refinements that preserve all functionality
- Verify the result is simpler and more maintainable