# 코드 단순화 (code-simplification)

> 동작을 그대로 유지하면서 복잡도를 줄여 읽기, 수정, 디버깅이 쉬운 코드로 만듭니다.

- 카테고리: [리팩터링](https://www.myskills.tools/ko/categories/refactoring/)
- 출처: 커뮤니티 · Addy Osmani
- 저장소: https://github.com/addyosmani/agent-skills/tree/main/skills/code-simplification (commit f1f6fbf)
- SKILL.md: https://github.com/addyosmani/agent-skills/blob/main/skills/code-simplification/SKILL.md
- 설치 명령: `npx skills add addyosmani/agent-skills --skill code-simplification`
- 라이선스: MIT
- 호환 도구: Claude Code, Codex, Cursor, Copilot, Gemini CLI
- 권한: read-repo ✓, write-files ✓, shell ✓, network ✗
- 상태: 스캔 통과
- 규칙 스캔으로 모든 위험을 찾을 수는 없습니다. 설치 전에 이 스킬의 SKILL.md를 읽고 권한을 확인하세요.

## 핵심 규칙

동작을 정확히 유지하며, 동작이 보존되는지 확신할 수 없는 단순화는 하지 않습니다.

## 실행 단계

1. **먼저 이해하기** — 체스터턴의 울타리 원칙에 따라 책임, 호출 관계, 엣지 케이스, 테스트, git blame 맥락을 파악한 뒤 수정합니다.
2. **단순화 지점 찾기** — 프로젝트 규칙에 맞춰 깊은 중첩, 긴 함수, 중첩 삼항 연산자, 모호한 이름, 중복, 죽은 코드, 불필요한 추상화를 찾습니다.
3. **점진적 적용** — 단순화는 하나씩 하고 매번 테스트를 실행하며 실패하면 되돌립니다. 리팩터링은 기능·버그 수정과 분리해 제출합니다.
4. **결과 검증** — 전후를 비교해 실제로 이해하기 쉽고 일관적인지 확인하고, 기존 테스트가 수정 없이 통과하며 빌드와 lint에 문제가 없는지 봅니다.

## 권한 설명 (SKILL.md 기준)

| 기능 | 필요 여부 | 설명 |
|---|---|---|
| 파일 쓰기 | 필요 | 범위 내 코드를 수정하며, 기본은 최근 변경된 부분입니다. |
| 명령 실행 | 필요 | 테스트, 빌드, lint, git blame을 실행하고 대규모 변경에는 codemod 스크립트를 쓸 수 있습니다. |
| 네트워크 송신 | 필요 없음 | 스킬은 네트워크 접근을 요구하지 않습니다. |

## SKILL.md 프런트매터(YAML)

```yaml
---
name: code-simplification
description: Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity. Use when asked to simplify, clean up, or reduce the nesting of a function or module that already works, even when the code is pasted inline and nothing else needs to change.
---
```

홈: https://www.myskills.tools/ko/ · URL: https://www.myskills.tools/ko/skills/code-simplification/
