dual-forge/cria-app/simplify-code

Claude Code and agent skill by dual-forge/cria-app

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Reduce complexity of over-engineered code. Identify unnecessary abstractions, remove dead code, flatten deep nesting, and simplify logic while preserving behavior.

Install

npx vskill@latest install dual-forge/cria-app/simplify-code

SKILL.md

The same SKILL.md was published earlier as hoan8386/mmo/simplify-code.

Simplify Code — Reduce Unnecessary Complexity

The best code is the code you don't have to write. The second best is the code anyone can read.

Core Principle

Complexity is a cost. Every abstraction, every indirection, every clever pattern
adds cognitive load. Simplify ruthlessly unless complexity serves a clear purpose.

Simplification Checklist

1. Unnecessary Abstractions
SmellSimplification
Wrapper class that just delegatesRemove wrapper, use the inner class directly
Factory that creates only one typeReplace with direct constructor
Strategy pattern with one strategyReplace with simple function
Interface with one implementationRemove interface, use the class
Abstract class with one childMerge into the child class
Config object for 2 valuesUse function parameters
2. Dead Code
SmellAction
Unused importsRemove
Unreachable branchesRemove (check tests first)
Commented-out codeRemove (it's in git history)
Unused variables/functionsRemove
TODO comments older than 6 monthsRemove or create issue
Feature flags for launched featuresRemove flag, keep the code
3. Deep Nesting
javascript
// ❌ Before: 4 levels deep
function process(data) {
if (data) {
if (data.items) {
for (const item of data.items) {
if (item.active) {
doSomething(item)
}
}
}
}
}
// ✅ After: Early returns + filter
function process(data) {
if (!data?.items) return
data.items
.filter(item => item.active)
.forEach(doSomething)
}
4. Over-Parameterized Functions
typescript
// ❌ Before: 8 parameters
function createUser(name, email, age, role, dept, active, verified, avatar) { }
// ✅ After: Object parameter
function createUser(opts: CreateUserOpts) { }
5. Premature Optimization
SmellSimplification
Custom cache for <100 itemsRemove cache, measure first
Memoization on cheap functionsRemove memo
Lazy loading for small modulesUse direct import
Complex state machine for 3 statesUse simple if/else or switch

Simplification Protocol

Step 1: Identify Complexity
- Count nesting levels (target: ≤3)
- Count function parameters (target: ≤4)
- Count lines per function (target: ≤30)
- Count abstractions per feature (target: ≤2)
- Check for dead code (target: 0)
Step 2: Verify Understanding

Before simplifying, ensure you understand:

  • What the code does (not what it looks like it does)
  • Why it was written this way (maybe there's a reason)
  • What tests cover it (simplification must not break tests)
Step 3: Simplify Incrementally
1. Remove dead code first (safest)
2. Flatten nesting with early returns
3. Inline trivial abstractions
4. Merge related functions
5. Simplify data structures
Step 4: Verify Behavior Preserved
bash
npm run test # All existing tests still pass
npm run build # Still compiles

When NOT to Simplify

SituationWhy Keep Complexity
Performance-critical hot pathOptimization may look complex but is necessary
Required by framework/libraryExternal constraints
Explicitly requested patternUser chose this architecture
Will need extension soonAbstraction prepares for known growth
Ask first: "This pattern seems over-engineered. Should I simplify it, or is there a reason for the abstraction?"

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dual-forge/cria-app/simplify-code/badge)](https://verified-skill.com/skills/dual-forge/cria-app/simplify-code)

Something wrong with this skill or its page? Tell us.