Code Simplifier
Runs a compression pass on AI-generated code — strips redundancy, simplifies logic, and cuts technical debt without changing what the code actually does.
Before & after
Same prompt, same agent — the only difference is the skill.
Code simplification typically involves removing redundancy, flattening abstraction layers, and consolidating related logic. For an auth module, you might have too many wrapper functions or unnecessary design patterns. I'd want to review your current code to understand the abstraction strategy. Is it over-engineered? Are there duplicate patterns? What's the test coverage like? Do you have performance concerns? Understanding the specific pain points would help me suggest targeted simplifications.
CODE SIMPLIFICATION: Auth Module Refactor
BEFORE STATE
→ Lines of code: 340
→ Functions: 28
→ Abstractions: 5 layers (Factory → Strategy → Adapter → Validator → Handler)
→ Test coverage: 65% (lots of integration tests, few unit tests)
→ Redundancy: 3 similar password-validation functions
→ Main issue: Hard to track which layer handles what
REFACTORED STATE
→ Lines of code: 180 (47% reduction)
→ Functions: 12 (57% reduction)
→ Abstractions: 2 layers (Core logic → Public API)
→ Test coverage: 92% (more unit tests, fewer integration tests)
→ Redundancy: 0 duplicates
→ Clarity: Straight-line auth flow, zero confusion
REMOVED PATTERNS
Layer 1: Unnecessary Factory Pattern
Before:
class AuthFactory {
static createValidator(): AuthValidator {
return new AuthValidator();
}
}
After: Direct instantiation, factories removed
const validator = new AuthValidator();
Reasoning: Single implementation, no polymorphism needed → factory adds zero value
Layer 2: Over-Abstracted Strategy Pattern
Before: 5 separate strategy classes (LocalStrategy, OAuthStrategy, MagicLinkStrategy, SamlStrategy, LdapStrategy)
Each strategy had identical error handling → copy-paste redundancy
After: Unified handleLogin() function with provider parameter
function handleLogin(provider: 'local' or 'oauth' or 'magic-link'): Promise<Token> {
const user = await validateCredentials(provider, input);
return createToken(user);
}
Reasoning: Strategy pattern was premature optimization; unified function is simpler
LAYER 3: Removed Adapter Pattern
Before: AuthAdapter → DatabaseAdapter → UserRepository (3-layer indirection)
After: Direct database calls in auth functions
const user = await db.users.findByEmail(email);
Reasoning: Adapter was for theoretical database swaps that never happened
CONSOLIDATED FUNCTIONS
Before (28 functions):
→ validatePassword()
→ validatePasswordStrength()
→ validatePasswordPolicy()
→ hashPassword()
→ comparePassword()
→ checkPasswordExpiry()
After (1 function):
function validatePassword(password, existingHash): boolean {
if (password.length < 8) throw new Error('Too short');
if (!hasLetter(password) or !hasNumber(password)) throw new Error('Weak');
return bcrypt.compare(password, existingHash);
}
Test cases for above:
test('rejects short passwords', () => expect(validatePassword('abc', hash)).toThrow());
test('accepts strong passwords', () => expect(validatePassword('SecurePass123!', hash)).toBe(true));
FILES BEFORE → AFTER
Before structure:
auth/
factory/
AuthFactory.ts
StrategyFactory.ts
AdapterFactory.ts
strategies/
LocalStrategy.ts
OAuthStrategy.ts
adapters/
DatabaseAdapter.ts
UserRepository.ts
validators/
PasswordValidator.ts
EmailValidator.ts
TokenValidator.ts
handlers/
LoginHandler.ts
LogoutHandler.ts
RefreshHandler.ts
utils/
...helpers.ts
Total: 18 files, 340 LOC
After structure:
auth/
auth.ts (main logic, 180 LOC)
types.ts (TypeScript interfaces)
tests/
auth.test.ts (comprehensive)
Total: 3 files, 180 LOC
CONCISE AUTH FLOW (New Code)
typed async function login(email: string, password: string): Promise<AuthToken> {
const user = await db.users.findByEmail(email);
if (!user) throw new Error('User not found');
if (!await validatePassword(password, user.passwordHash)) throw new Error('Invalid password');
const token = jwt.sign({userId: user.id}, process.env.JWT_SECRET, {expiresIn: '7d'});
await db.auditLog.create({userId: user.id, action: 'login', timestamp: now()});
return {token, expiresIn: 604800};
}
TEST COVERAGE IMPROVED
Before: 16 integration tests (slow, brittle)
After: 22 unit tests (fast, pinpoint failures)
test('login succeeds with valid credentials', async () => {
const token = await login('user@test.com', 'ValidPass123');
expect(token).toMatch(/^eyJ/);
});
test('login fails with invalid password', async () => {
await expect(login('user@test.com', 'WrongPass')).rejects.toThrow('Invalid password');
});
RESULTS
→ Build time: 2.3s → 0.8s (65% faster)
→ Test execution: 12.4s → 3.2s (74% faster)
→ Bundle size: -22KB (fewer abstractions)
→ Onboarding time for new devs: 2 hours → 30 minutes (code is obvious)
→ Bug regression: 0 (all tests pass during refactor)About this skill
name: code-simplifier description: Use when Runs a compression pass on AI-generated code — strips redundancy, simplifies logic, and cuts technical debt without changing what the code actually does.
Code Simplifier
AI-generated code — including Claude's own — is often bloated and overengineered. Code Simplifier runs a structured compression pass post-generation, stripping redundancy, simplifying logic, and eliminating technical debt without breaking functionality. For vibe coders shipping fast, this is how you stop your app from turning into spaghetti.
What you get
- Simplified codebase, redundancy removal, logic compression, technical debt reduction, same functionality with significantly less complexity.
Customize your output
- Set complexity thresholds and define which patterns to target: nested conditionals, duplicate logic, over-abstraction, unnecessary wrapper classes.
Example output
Auth module reduced from 340 lines to 180 lines — 3 layers of unnecessary abstraction removed, all 22 tests still passing.
Best for
Vibe coders, developers shipping fast who want to avoid compounding technical debt, anyone building with AI-generated code.
SKILL.md preview
---
name: code-simplifier
description: Use this skill to run a compression pass on AI-generated code that strips redundancy and simplifies logic without changing what the code does.
version: 1.0.0
category: Development / Code Quality
author: AgentVolt
license: proprietary
tags:
- development
- code-quality
- standard
---
# Code Simplifier
Runs a structured post-generation cleanup pass on AI-written code, cutting the overengineering and redundant abstraction that piles up when code gets generated fast instead of designed.
## When to use
… (sign up to view the full skill)