Skill
Community

code-simpler

Install
1
Install the plugin
$
npx claudepluginhub aimskr/aims-claude-toolkit --plugin aims-toolkit

Want just this skill?

Then install: npx claudepluginhub u/[userId]/[slug]

Description

코드 단순화, 복잡도 감소, 심플리파이, 가독성, KISS, 중첩 제거 - Simplifies overly complex code by reducing nesting, cyclomatic complexity, and unnecessary abstractions. Use when code exceeds complexity limits (nesting >3, function >50 lines) or after insight/review reports flag complexity. Do NOT use for full code reviews (use code-reviewer) or dead code removal (use refactor-cleaner).

Tool Access

This skill uses the workspace's default tool permissions.

Skill Content

Code Simpler - Complexity Reducer

Simplify overly complex code while preserving correctness.

When to Use

  • Insight 리포트에서 복잡도 지적이 나왔을 때
  • 중첩이 깊은 코드 (3단계 이상)
  • 함수가 50줄을 초과할 때
  • 불필요한 추상화가 감지될 때
  • 조건문이 과도하게 복잡할 때

Simplification Techniques

1. Early Return (Guard Clause)

// Before: deeply nested
function process(data) {
  if (data) {
    if (data.isValid) {
      if (data.items.length > 0) {
        // actual logic
      }
    }
  }
}

// After: flat
function process(data) {
  if (!data) return;
  if (!data.isValid) return;
  if (data.items.length === 0) return;
  // actual logic
}

2. Extract Method (Long Functions)

Split when a function does more than one thing:

  • Each function = one responsibility
  • Name describes WHAT, not HOW
  • Max 50 lines per function

3. Remove Unnecessary Abstraction

// Before: premature abstraction
class UserValidatorFactory {
  create(type) { return new UserValidator(type); }
}

// After: direct usage (if only one validator exists)
function validateUser(user) { ... }

4. Simplify Conditionals

// Before: complex boolean
if (user.age >= 18 && user.hasLicense && !user.isBanned && user.country === 'KR')

// After: named condition
const canDrive = user.age >= 18 && user.hasLicense && !user.isBanned;
const isKorean = user.country === 'KR';
if (canDrive && isKorean)

5. Replace Loop with Declarative

// Before: imperative
const results = [];
for (const item of items) {
  if (item.active) {
    results.push(item.name);
  }
}

// After: declarative
const results = items.filter(i => i.active).map(i => i.name);

6. Flatten Callback Hell

Replace nested callbacks/promises with async/await or pipeline.

Process

1. Identify complexity (insight report or manual scan)
   ↓
2. Measure: nesting depth, function length, cyclomatic complexity
   ↓
3. Apply simplification technique (one at a time)
   ↓
4. Verify: behavior unchanged, tests still pass
   ↓
5. Repeat until within limits

Complexity Limits

MetricLimitAction
Nesting depth3 levelsApply early return
Function length50 linesExtract method
Cyclomatic complexity10Split into smaller functions
File length200 linesSplit into modules
Parameters4Use object parameter

Principles

  1. One change at a time - simplify incrementally
  2. Preserve behavior - never change what the code does
  3. Verify with tests - run tests after each simplification
  4. Don't over-simplify - 3 similar lines > premature abstraction
  5. KISS - the simplest correct solution is the best

문서화 (작업 완료 후 자동 실행)

작업 완료 시 auto-documenter를 호출하여 프로젝트 문서를 업데이트한다.

Completion

모든 복잡도 지표가 한도 이내이고 테스트가 통과하면 완료.

Troubleshooting

Simplification breaks tests: Revert immediately. The simplification changed behavior, not just structure. Re-analyze before retrying. Unclear if abstraction is "unnecessary": Check usage count. If used once → likely unnecessary. If used 3+ times → keep it. Team disagrees on complexity threshold: Defer to project’s existing conventions. If none exist, propose thresholds and get team consensus before applying.

Stats
Stars0
Forks0
Last CommitMar 17, 2026

Similar Skills