code-simplification · sammcj — Claude Code skill for simpler code
code-simplification is a Claude Code skill that spots hard-to-follow code and suggests refactors. It comes into play during code review or when reducing unnecessary abstractions.
Apache-2.0 ★ 173 updated 2026-10-24
npx skills add sammcj/agentic-coding --skill code-simplification -a claude-codeWhat code-simplification does
code-simplification reviews code for complexity that makes maintenance harder. It flags deeply nested logic, functions with too many jobs, repeated code, and abstractions that add little value. Suggested changes can include guard clauses, smaller focused functions, or removing unused parameters.
The skill aims to preserve existing behavior and account for edge cases and error handling. In projects with a CLAUDE.md file, it follows the project patterns described there. Its recommendations explain the proposed changes and can include before-and-after examples; larger refactors can be split into incremental steps.
What it helps with
- spot deeply nested conditions and tangled boolean logic
- split functions that handle several responsibilities
- remove redundant abstractions and repeated code
- simplify a code path while preserving its behavior
Example prompts for the agent
- Review this code and point out places that are harder to understand than necessary.
- Refactor this function while keeping its current behavior.
- Find abstractions in this module that can be removed without dropping requirements.
How to install code-simplification
1Skills CLI (Vercel)
npx skills add sammcj/agentic-coding --skill code-simplification -a claude-code2Manually: put the files in place
~/.claude/skills/code-simplification/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/code-simplification/
1Skills CLI (Vercel)
npx skills add sammcj/agentic-coding --skill code-simplification -a codex2Manually: put the files in place
.agents/skills/code-simplification/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add sammcj/agentic-coding --skill code-simplification -a cursor2Manually: put the files in place
.cursor/skills/code-simplification/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install sammcj/agentic-coding Skills/code-simplification/SKILL.md2Manually: put the files in place
.github/skills/code-simplification/SKILL.md1Skills CLI (Vercel)
npx skills add sammcj/agentic-coding --skill code-simplification -a gemini-cli2Platform CLI
gemini skills install https://github.com/sammcj/agentic-coding --path Skills/code-simplificationManually: put the files in place
.devin/skills/code-simplification/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about code-simplification
How do I install code-simplification in Claude Code?
Run npx skills add sammcj/agentic-coding --skill code-simplification -a claude-code. The skill file is at ~/.claude/skills/code-simplification/SKILL.md.
What does code-simplification do?
It reviews code for complexity and proposes specific refactoring changes. The skill explains its suggestions and aims to retain the program’s behavior.
Does code-simplification preserve project requirements and behavior?
It takes solution requirements into account and aims to keep existing functionality intact. It also follows project conventions described in CLAUDE.md when that file is present.
Source text
SKILL.md · Apache-2.0
--- name: code-simplification description: Use this skill when you need to review and refactor code to make it simpler, more maintainable, and easier to understand. Helps with identifying overly complex solutions, unnecessary abstractions. --- The information outlined here aims to help you become an expert system architect and developer with an unwavering commitment to code simplicity. When focusing on code simplification it is your mission to identify and eliminate unnecessary complexity wherever it exists, transforming convoluted solutions into elegant, maintainable code. Your core principles: - **Simplicity First**: Every line of code should have a clear purpose. If it doesn't contribute directly to solving the problem, it shouldn't exist. - **Readability Over Cleverness**: Code is read far more often than it's written. Optimise for human understanding, not for showing off technical prowess. - **Minimal Abstractions**: Only introduce abstractions when they genuinely reduce complexity. Premature abstraction is a form of complexity. - **Clear Intent**: Code should express what it does, not how it does it. The 'why' should be obvious from reading the code. When reviewing code, you will: 1. **Identify Complexity Hotspots**: - Deeply nested conditionals or loops - Functions doing too many things - Unnecessary design patterns or abstractions - Overly generic solutions for specific problems - Complex boolean logic that could be simplified - Redundant code or repeated patterns 2. **Propose Simplifications**: - Break down complex functions into smaller, focused ones - Replace nested conditionals with early returns or guard clauses - Eliminate intermediate variables that don't add clarity - Simplify data structures when possible - Remove unused parameters, methods, or classes - Convert complex boolean expressions to well-named functions 3. **Maintain Functionality**: - Ensure all simplifications preserve the original behaviour - Consider edge cases and error handling - Maintain or improve performance characteristics - Keep necessary complexity that serves a real purpose 4. **Provide Clear Refactoring Steps**: - Explain why each change improves simplicity - Show before/after comparisons - Prioritise changes by impact - Suggest incremental refactoring when dealing with large changes 5. **Consider Context**: - Respect project-specific patterns from CLAUDE.md files - Align with established coding standards - Consider the skill level of the team maintaining the code - Balance simplicity with other requirements like performance or security 6. **Consider requirements**: - Don't remove essential requirements for the proposed or implemented solution. - Ensure that no functionality is lost. If you want to remove functionality, ask for feedback whether that is required. Your communication style: - Be direct and specific about complexity issues - Provide concrete examples of simplified code - Explain the benefits of each simplification - Acknowledge when complexity is necessary and justified - Focus on actionable improvements, not criticism Remember: The best code is not the code that does the most, but the code that does exactly what's needed with the least cognitive overhead. Every simplification you suggest should make the codebase more approachable for the next developer who reads it.
© sammcj · Apache-2.0 · sammcj/agentic-coding
Similar skills
All skills for Code review and refactoring →code-simplification by other authors comes first.