code-simplifier
Skill4 starsChanged 5 months agoMITView on GitHub
Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when: after ANY implementation/refactor, user says "simplify this", "too complex", "make it cleaner", "hard to read", "refine this code", before meticulous-code-review in post-implementation chain. NOT for: adding new functionality, fixing bugs, or making behavioral changes.
42 other projects use a version of this, 12 of them edited.
Adopted by
Most recently taken up by
- kopp0510/claude-ddtheir own version, first seen Oct 5, 2026
- aktsmm/Agent-Skillstheir own version, first seen Oct 4, 2026
- yeisonrestrepo/code-conductortheir own version, first seen Oct 3, 2026
- wty-yy/skillstheir own version, first seen Oct 2, 2026
- zvadaadam/az-skillstheir own version, first seen Sep 28, 2026
- kaiohenricunha/dotbabeltheir own version, first seen Sep 24, 2026
Used with
Projects with it also use comment-analyzer, performance and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
lin30Skillcomment-analyzer
微博评论抓取与深度分析,生成可视化HTML报告。Use when user asks to analyze weibo comments, analyze social media comments, or requests sentiment analysis from weibo posts
Also in 3 projects that use this
pluginagentmarketplaceSkillperformance
Optimize application performance through caching strategies, load balancing, database scaling, and monitoring. Build systems handling thousands of concurrent users.
Also in 3 projects that use this
AWSSkillsetup-matt-pocock-skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
Also in 3 projects that use this
AWSSkillto-spec
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 9 projects that use this
NVIDIASkilldeep-research
Queue deep, multi-step research and analysis tasks to the DeepAgents worker. Supports execution depth presets, request-specific rubrics, SubAgent delegation, and RubricMiddleware cross-validation.
Also in 3 projects that use this
- +2 more from aws
Other versions42 projects use a version of this.
Word for word · 0
None found.
Edited · 12
- getsentry/skills★ 1k12% same
- roman01la/skills-agents★ 4812% same
- fanqingxuan/awesome-skills★ 2912% same
- ivanrvpereira/.agents★ 1812% same
- ferologics/pi-skills★ 1413% same
- WalletConnect/skills★ 1411% same
- jorgeasaurus/agent-skills★ 1312% same
- getsentry/webvitals.com★ 1212% same
- simonwong/skills★ 812% same
- b12consulting/skills★ 214% same
2 more not listed
Wrote their own version · 30
- rtk-ai/rtk★ 82ksame name
- Azure/azqr★ 793same name
- microsoft/ghqr★ 529same name
- feiskyer/codex-settings★ 244same name
- FlorianBruniaux/ccboard★ 96same name
- zvadaadam/az-skills★ 49same name
- 1024XEngineer/bytemind★ 43same name
- kumaran-is/claude-code-onboarding★ 36same name
- aktsmm/Agent-Skills★ 26same name
- icefrag/nbl★ 17same name
20 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analytics-cleanerSkill
- apply-review-feedbackSkill
- architect-designSkill
- battle-tested-patternsSkill
- code-deletionSkill
- consensus-boardSkill
- context-implementSkill
- deep-reviewSkill
- deliberate-thinkingSkill
- design-brainstormSkill
- exhaustive-testingSkill
- generate-docsSkill
- handoffSkill
- load-handoffSkill
- meticulous-code-reviewSkill
- optimizeSkill
- refactorSkill
- reflectSkill
- regression-safety-netSkill
- scope-creep-preventionSkill
- senior-reviewSkill
- ship-featureSkill
- subagent-buildSkill
- systematic-debuggingSkill
- test-first-developmentSkill
- verification-before-completionSkill
- verify-claimsSkill
- write-plansSkill
- write-promptSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 40 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 87
Before checking for code style issues, FIRST check for structural overengineering:
- Distinctive: line 113
If any answer is unfavorable → SIMPLIFY.
- Distinctive: line 219
Verify: all functionality remains unchanged
- Distinctive: line 221
Document: only significant changes
“Common” is measured: kept by at least 6 in 10 of the 40 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Simplifier
Core Philosophy: "Readable, explicit code over overly compact solutions. Clarity over brevity."
Frontend (React / TypeScript / Tailwind v4)? This skill is language-agnostic. For the React/Tailwind-specific slop patterns — giant components, reinvented hooks/primitives, JS breakpoints, imperative
style={{animation}}, dead@keyframes— also apply dedicated frontend clean-code guidance.
Why This Skill Exists
Even working code can be unnecessarily complex. This skill ensures code is:
- Clear and maintainable
- Consistent with project standards
- Free of unnecessary complexity
- Readable by future maintainers
The Iron Laws
1. PRESERVE FUNCTIONALITY - Never change what code does, only how
2. CLARITY OVER BREVITY - Explicit is better than compact
3. NO NESTED TERNARIES - Use if/else or switch instead
4. FOLLOW PROJECT PATTERNS - Consistency with existing codeRefinement Checklist
1. Functionality Preservation (CRITICAL)
□ All original features remain intact
□ All outputs are identical
□ All behaviors preserved
□ No side effects changed2. Project Standards Application
□ ES modules with proper import sorting and extensions
□ Prefer `function` keyword over arrow functions
□ Explicit return type annotations for top-level functions
□ React components with explicit Props types
□ Proper error handling patterns (avoid try/catch when possible)
□ Consistent naming conventions3. Clarity Enhancement
□ Reduced unnecessary complexity and nesting
□ Eliminated redundant code and abstractions
□ Clear variable and function names
□ Consolidated related logic
□ Removed unnecessary comments (code should be self-documenting)
□ NO nested ternary operators
□ Explicit code over dense one-liners4. Balance Check (Avoid Over-Simplification)
□ Did not reduce code clarity
□ Did not create "clever" solutions that are hard to understand
□ Did not combine too many concerns
□ Did not remove helpful abstractions
□ Did not prioritize "fewer lines" over readability
□ Code remains easy to debug and extendOverengineering Detection (PRIORITY CHECK)
Before checking for code style issues, FIRST check for structural overengineering:
Structural Red Flags (Fix These FIRST)
□ Class with only 1 method → Convert to function
□ Base class with only 1 subclass → Remove hierarchy, use concrete class
□ Factory that creates only 1 type → Replace with direct instantiation
□ Interface/ABC with only 1 implementation → Use concrete type
□ Registry/Plugin system for < 5 items → Use dict literal or if/else
□ Strategy pattern for 2 strategies → Use if/else or function parameter
□ Builder pattern for simple objects → Use constructor with defaults
□ Event system with 1 publisher + 1 subscriber → Direct function call
□ Config class for < 5 values → Use module-level constants
□ Generic<T> used with only 1 type → Use the concrete type
□ Service layer that just proxies to repository → Remove service, call repo directly
□ Middleware chain with 1 middleware → Direct function call
□ 3+ files created for something that fits in 1 → Merge filesThe Simplicity Audit
For each abstraction found, ask:
- How many concrete consumers exist RIGHT NOW? (not "might exist")
- Is the abstraction simpler than the concrete code it replaced?
- Could a junior dev understand this without explanation?
If any answer is unfavorable → SIMPLIFY. Remove the abstraction.
Overengineering Fix Examples
# OVERENGINEERED: Registry pattern for 2 formatters
class FormatterRegistry:
_formatters: dict[str, type[BaseFormatter]] = {}
@classmethod
def register(cls, name: str, formatter: type[BaseFormatter]):
cls._formatters[name] = formatter
@classmethod
def get(cls, name: str) -> BaseFormatter:
return cls._formatters[name]()
# SIMPLIFIED: Direct dict
FORMATTERS = {
"json": format_as_json,
"text": format_as_text,
}
def get_formatter(name: str):
return FORMATTERS[name]# OVERENGINEERED: Abstract validator hierarchy
class BaseValidator(ABC):
@abstractmethod
def validate(self, data: dict) -> bool: ...
class LengthValidator(BaseValidator):
def __init__(self, max_length: int):
self.max_length = max_length
def validate(self, data: dict) -> bool:
return len(data.get("text", "")) <= self.max_length
# SIMPLIFIED: Plain function
def validate_length(text: str, max_length: int) -> bool:
"""Check if text is within max length."""
return len(text) <= max_lengthAnti-Patterns to Fix
Nested Ternaries
// BAD
const result = a ? b ? 'x' : 'y' : c ? 'z' : 'w';
// GOOD
if (a) {
return b ? 'x' : 'y';
}
return c ? 'z' : 'w';
// OR use switch for multiple conditionsOver-Compact One-Liners
// BAD - Dense and hard to read
const data = items.filter(x => x.active).map(x => ({ ...x, processed: true })).reduce((a, b) => ({ ...a, [b.id]: b }), {});
// GOOD - Clear steps
const activeItems = items.filter(item => item.active);
const processedItems = activeItems.map(item => ({ ...item, processed: true }));
const dataById = processedItems.reduce((acc, item) => {
acc[item.id] = item;
return acc;
}, {});Unnecessary Abstraction
// BAD - Over-abstracted for single use
const createHandler = (fn) => (e) => fn(e.target.value);
const handleChange = createHandler(setValue);
// GOOD - Direct and clear
function handleChange(e) {
setValue(e.target.value);
}Arrow Functions Where Named Functions Are Clearer
// BAD - Anonymous and harder to debug
const processData = async (data) => {
// ...
};
// GOOD - Named, clearer in stack traces
async function processData(data) {
// ...
}Process
- Identify recently modified code sections
- Analyze for clarity and consistency opportunities
- Apply project-specific best practices
- Verify all functionality remains unchanged
- Confirm refined code is simpler and more maintainable
- Document only significant changes
Output Format
## Code Simplification Review
### Files Analyzed
- [file1.ts]: [brief description]
- [file2.py]: [brief description]
### Simplifications Applied
**1. [Location: file:line]**
- Before: [brief description of complex code]
- After: [brief description of simplified code]
- Reason: [why this improves clarity]
**2. [Location: file:line]**
...
### Functionality Verification
- [X] All original behaviors preserved
- [X] No side effects changed
- [X] Tests still pass (if applicable)
### Summary
[Brief summary of improvements made]Integration with Workflow
This skill runs AFTER writing code, BEFORE other reviews:
Order:
- Write/refactor code
- code-simplifier ← YOU ARE HERE (is code CLEAR?)
- meticulous-code-review (is code GOOD?)
- meticulous-code-review (does code have BUGS?)
- verification-before-completion (does code WORK?)
The Bottom Line
Simplify without sacrificing clarity.
- Complex code that "works" → Simplify
- Dense one-liners → Expand for readability
- Nested ternaries → Convert to if/else or switch
- Unnecessary abstractions → Remove
- Inconsistent patterns → Align with project standards
The goal is code that future maintainers will thank you for.
Example Flow
User: "Implement the access-level resolver"
→ Claude writes implementation with nested ternary: `const level = user ? user.role === 'admin' ? 'full' : 'limited' : 'none'`
→ code-simplifier activates in post-implementation chain
→ Identifies nested ternary → converts to if/else
→ Identifies dense chained `.filter().map().reduce()` → separates into named steps
→ Verifies: all original behaviors preserved, outputs identical
→ Passes simplified code to next review stepTroubleshooting
| Problem | Cause | Solution |
| Simplification changed behavior | Didn't verify outputs match | Always test with same inputs before and after; preserve ALL side effects |
| Code became harder to read after "simplifying" | Over-combined logic or removed helpful abstraction | Balance Check: did simplification reduce clarity? If yes, revert |
| Removed necessary comment | Assumed code was self-documenting | Only remove comments that state WHAT; keep comments that explain WHY |
| Project patterns not followed | Didn't check neighboring files | Read 2-3 similar files first to match conventions |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

