simplify-code
하는 일
이 스킬은 AI가 코드에서 불필요한 복잡성을 찾아 없애도록 돕습니다. 코드가 커져서 읽기 어렵거나 관리하기 힘든 개발자를 위한 스킬입니다.
사용하는 경우
- ✓거의 아무 일도 하지 않는 래퍼 클래스나 추상화가 있을 때.
- ✓죽은 코드, 쓰지 않는 import, 따라가기 어려운 중첩 로직이 보일 때.
- ✓동작은 그대로 두면서 코드를 더 읽기 쉽게 만들고 싶은 경우.
스킬 링크
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/simplify-code/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 모듈을 단순하게 만들어 주세요. 쓰지 않는 것은 지우고 깊게 중첩된 로직은 펴 주되, 동작은 그대로 유지해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 흔한 복잡성 문제 목록에 맞춰 코드를 점검합니다. 필요 없는 부분은 지우거나 평평하게 펴며, 동작은 그대로 유지합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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
| Smell | Simplification |
|---|---|
| Wrapper class that just delegates | Remove wrapper, use the inner class directly |
| Factory that creates only one type | Replace with direct constructor |
| Strategy pattern with one strategy | Replace with simple function |
| Interface with one implementation | Remove interface, use the class |
| Abstract class with one child | Merge into the child class |
| Config object for 2 values | Use function parameters |
2. Dead Code
| Smell | Action |
|---|---|
| Unused imports | Remove |
| Unreachable branches | Remove (check tests first) |
| Commented-out code | Remove (it's in git history) |
| Unused variables/functions | Remove |
| TODO comments older than 6 months | Remove or create issue |
| Feature flags for launched features | Remove flag, keep the code |
3. Deep Nesting
// ❌ 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
// ❌ Before: 8 parameters
function createUser(name, email, age, role, dept, active, verified, avatar) { }
// ✅ After: Object parameter
function createUser(opts: CreateUserOpts) { }
5. Premature Optimization
| Smell | Simplification |
|---|---|
| Custom cache for <100 items | Remove cache, measure first |
| Memoization on cheap functions | Remove memo |
| Lazy loading for small modules | Use direct import |
| Complex state machine for 3 states | Use 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
npm run test # All existing tests still pass
npm run build # Still compiles
When NOT to Simplify
| Situation | Why Keep Complexity |
|---|---|
| Performance-critical hot path | Optimization may look complex but is necessary |
| Required by framework/library | External constraints |
| Explicitly requested pattern | User chose this architecture |
| Will need extension soon | Abstraction prepares for known growth |
Ask first: "This pattern seems over-engineered. Should I simplify it, or is there a reason for the abstraction?"
자주 묻는 질문
단순화하면 코드 동작이 바뀌나요?
동작을 보존하도록 설계되어 있으며, 분기를 지우기 전에 테스트를 확인합니다.
죽은 코드란 무엇인가요?
쓰지 않는 import, 쓰지 않는 변수와 함수, 도달할 수 없는 분기, 오래된 주석 처리 코드입니다.
기능 플래그도 지우나요?
이미 출시된 기능의 플래그는 제거를 제안하지만, 기능 코드 자체는 남긴다고 설명합니다.
상세 정보
작성자의 원본 설명
Reduce complexity of over-engineered code. Identify unnecessary abstractions, remove dead code, flatten deep nesting, and simplify logic while preserving behavior.
repo: vudovn/ag-kit
인기도
- GitHub 스타
- 8.2k
- 순위
- #12539
- 라이선스
- MIT
- 업데이트
- 2026. 10. 18.
댓글
- …
이 저장소의 다른 스킬
batch-operations
8.2k에이전트가 함수 이름 바꾸기나 오래된 import 교체처럼 같은 변경을 여러 파일에 한꺼번에 적용하도록 돕습니다.
brainstorming
8.2k에이전트가 새로운 것이나 복잡한 것을 만들기 전에 명확한 질문을 하도록 가르쳐 목표를 먼저 이해하게 합니다.
code-review-checklist
8.2k에이전트에게 정확성, 보안, 성능, 테스트, 문서를 검토하는 체크리스트를 주고, AI 관련 위험도 포함합니다.
code-review-graph
8.2k에이전트가 구조 지도를 이용해 큰 프로젝트의 코드를 검토하도록 돕고, 변경과 관련된 파일만 읽게 합니다.