Use when the user wants to find and remove unused code in the current repository, or says: dead code 정리, 미사용 코드 삭제, unused code cleanup, dead code removal, 안 쓰는 코드 정리
From dead-code-removernpx claudepluginhub dokdo2013/claude-code-skills --plugin dead-code-removerThis skill uses the workspace's default tool permissions.
Guides browser automation with Playwright, Puppeteer, Selenium for e2e testing and scraping. Teaches reliable selectors, auto-waits, isolation to fix flaky tests.
Provides checklists to review code for functionality, quality, security, performance, tests, and maintainability. Use for PRs, audits, team standards, and developer training.
Enforces A/B test setup with gates for hypothesis locking, metrics definition, sample size calculation, assumptions checks, and execution readiness before implementation.
현재 레포의 미사용 코드를 탐지하고, 사용자 확인 후 안전하게 삭제한 뒤 빌드/테스트로 검증.
digraph workflow {
"Step 1\nProject Detection" -> "Step 2\nDead Code Detection";
"Step 2\nDead Code Detection" -> "Step 3\nResults Table";
"Step 3\nResults Table" -> "User approves?" [shape=diamond];
"User approves?" -> "Step 4\nRemoval" [label="yes"];
"User approves?" -> "Done (no action)" [label="no"];
"Step 4\nRemoval" -> "Step 5\nBuild & Test";
"Step 5\nBuild & Test" -> "Pass?" [shape=diamond];
"Pass?" -> "Done (committed)" [label="pass"];
"Pass?" -> "Rollback\ngit checkout" [label="fail"];
}
현재 레포의 언어, 프레임워크, 빌드/테스트 도구를 자동으로 파악한다.
확인 대상:
package.json, tsconfig.json → TypeScript/JavaScript (NestJS, React, Next.js)go.mod → Goproject.yml, *.xcodeproj → Swift (iOS)build.gradle.kts → Kotlin (Android)pyproject.toml, requirements.txt → PythonCargo.toml → Rust파악할 것:
npm run build, go build, xcodebuild build 등npm test, go test ./..., xcodebuild test 등src/, app/, lib/ 등 (빌드 산출물, vendor 제외)분석 대상 디렉토리를 모듈/디렉토리 단위로 나누어 Explore 서브에이전트를 병렬 디스패치한다 (최대 7-8개).
서브에이전트 프롬프트 템플릿:
조사만 수행. 코드 수정하지 말 것.
[레포명]의 [담당 디렉토리] 내 미사용 코드를 탐지.
프로젝트 정보:
- 언어/프레임워크: [감지 결과]
- 엔트리포인트: [파일 목록]
탐지 대상:
1. 미사용 import/require
2. 미사용 함수/메서드 (선언만 있고 호출 없음)
3. 미사용 클래스/타입/인터페이스
4. 미사용 변수/상수
5. 미사용 export (레포 내 어디에서도 import하지 않는 export)
반드시 보존할 것 (false positive 방지):
- 프레임워크 데코레이터/어노테이션이 붙은 것 (@Controller, @Injectable, @Component 등)
- DI 컨테이너에 등록된 것
- 라우트/엔드포인트 핸들러
- 이벤트 리스너, lifecycle hook
- 테스트 파일 내 코드
- 설정/migration 파일
- public API로 export된 것 (라이브러리인 경우)
- 동적 참조 가능성 (reflect, getattr, dynamic import 등)
경로: [절대 경로]
결과를 JSON으로 정리:
{
"directory": "담당 디렉토리",
"findings": [
{
"file": "파일 경로",
"type": "import|function|class|type|variable|export",
"name": "심볼명",
"line": 라인번호,
"confidence": "high|medium",
"reason": "미사용 판단 근거"
}
]
}
confidence 기준:
- high: 레포 전체에서 참조가 전혀 없음
- medium: 참조가 없으나 동적 사용 가능성 있음
서브에이전트 결과를 취합하여 테이블로 출력한다.
## Dead Code Analysis Results
레포: `meloming-back`
분석 디렉토리: 8개 | 탐지된 dead code: 14건
### 🔴 High Confidence (삭제 안전) — 10건
| # | 파일 | 종류 | 이름 | 라인 | 근거 |
|---|------|------|------|------|------|
| 1 | src/song/song.service.ts | function | `legacyCalculate` | 142 | 레포 내 호출 0건 |
| 2 | src/utils/format.ts | import | `dayjs` | 3 | import 후 미사용 |
| 3 | src/dto/old-response.dto.ts | class | `OldResponseDto` | 1 | 전체 파일 미참조 |
| ... | | | | | |
### 🟡 Medium Confidence (확인 후 삭제) — 4건
| # | 파일 | 종류 | 이름 | 라인 | 근거 |
|---|------|------|------|------|------|
| 1 | src/common/helpers.ts | export | `parseConfig` | 28 | 직접 참조 없으나 동적 로딩 가능성 |
| ... | | | | | |
사용자에게 확인 요청:
"High confidence 10건을 삭제할까요? Medium 항목도 포함하시겠습니까?"
사용자 확인 없이 절대 삭제하지 않는다.
사용자가 승인한 항목만 코드에서 제거한다.
# 1. 빌드 실행
[감지된 빌드 명령어]
# 2. 빌드 성공 시 테스트 실행
[감지된 테스트 명령어]
빌드 또는 테스트 실패 시:
git checkout .으로 롤백모두 통과 시:
"Dead code 삭제 완료. 빌드 ✅ 테스트 ✅. 커밋하시겠습니까?"
git checkout .만 사용 — git reset --hard 사용 금지