From aims-toolkit
코드 단순화, 복잡도 감소, 심플리파이, 가독성, 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).
npx claudepluginhub aimskr/aims-claude-toolkit --plugin aims-toolkitThis skill uses the workspace's default tool permissions.
Simplify overly complex code while preserving correctness.
Detects and simplifies overly complex code using KISS principle. Flattens deep nesting (>3 levels), extracts long functions (>30 lines), reduces cyclomatic complexity (≤10), and applies simplification checklist.
Simplifies code for clarity by reducing complexity while preserving exact behavior. Use when refactoring functional but hard-to-read code, during reviews, or for maintenance.
Simplifies code by reducing nesting, extracting descriptive names, eliminating redundancy while preserving exact behavior. Triggers on simplify, refactor for clarity, readability issues, or code review complexity flags.
Share bugs, ideas, or general feedback.
Simplify overly complex code while preserving correctness.
// 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
}
Split when a function does more than one thing:
// Before: premature abstraction
class UserValidatorFactory {
create(type) { return new UserValidator(type); }
}
// After: direct usage (if only one validator exists)
function validateUser(user) { ... }
// 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)
// 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);
Replace nested callbacks/promises with async/await or pipeline.
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
| Metric | Limit | Action |
|---|---|---|
| Nesting depth | 3 levels | Apply early return |
| Function length | 50 lines | Extract method |
| Cyclomatic complexity | 10 | Split into smaller functions |
| File length | 200 lines | Split into modules |
| Parameters | 4 | Use object parameter |
작업 완료 시 auto-documenter를 호출하여 프로젝트 문서를 업데이트한다.
모든 복잡도 지표가 한도 이내이고 테스트가 통과하면 완료.
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.