unused-code-cleaner
1
总安装量
1
周安装量
#45249
全站排名
安装命令
npx skills add https://github.com/gihwan-dev/claude-code-gui --skill unused-code-cleaner
Agent 安装分布
mcpjam
1
claude-code
1
junie
1
windsurf
1
zencoder
1
crush
1
Skill 文档
Unused Code Cleaner
AI ì½ë ìì± í ë°ìíë ë¶íìí ì½ë를 ìëì¼ë¡ ì 리íë¤.
ìí¬íë¡ì°
1. ë³ê²½ë íì¼ íì¸
git diff --name-only HEAD
staged íì¼ í¬í¨ ì:
git diff --name-only HEAD --staged
í¹ì 커ë°/ë¸ëì¹ ë¹êµ ì:
git diff --name-only <base>..<target>
2. TS/JS íì¼ íí°ë§
íì¥ì íí°: .ts, .tsx, .js, .jsx
ì ì¸ ëì:
node_modules/.d.tsíì¼ (íì ì ì¸)- ì¤ì íì¼ (
*.config.ts,*.config.js)
3. íì¼ë³ ë¶ì ë° ìì (ì ìí ë³ë ¬í)
ë³ê²½ íì¼ ìì ë°ë¥¸ ë¶ì ì ëµ:
2ê° ì´í: ìì°¨ ë¶ì (기존 ë°©ì)
ê° íì¼ì ì§ì ì½ê³ ìë í¨í´ì ì°¾ì ì ê±°í©ëë¤.
3ê° ì´ì: ë³ë ¬ ë¶ì â ìì°¨ ìì
3-A: ë³ë ¬ ë¶ì
ê° íì¼ì unused ì½ë를 Task sub-agentë¡ ëì íì§í©ëë¤:
Task call:
subagent_type: "general-purpose"
model: "haiku"
description: "Detect unused code in [íì¼ëª
]"
run_in_background: true
prompt: |
Analyze the following file for unused code. DO NOT modify any files.
Only report what you find.
File to analyze: [íì¼ ê²½ë¡]
Check for these patterns:
1. Unused exports: Run `git diff HEAD -- [íì¼]` to find newly added exports,
then search the project for imports of each export name.
2. Unused functions: Functions defined but never called within the file or project.
3. Unused types/interfaces: Type declarations not referenced anywhere.
4. Commented code blocks: Code blocks that are commented out (preserve TODO/FIXME/NOTE comments).
5. Orphan console.log: Debugging console.log statements.
For unused exports, verify by searching the project:
- Check for dynamic imports: import() patterns
- Check barrel files (index.ts) for re-exports
- Check if used in test files
Output a JSON-like report:
{
"file": "[íì¼ ê²½ë¡]",
"findings": [
{"type": "unused_export", "name": "...", "line": N, "confidence": "high/medium"},
{"type": "unused_function", "name": "...", "line": N, "confidence": "high/medium"},
...
]
}
Only report findings with medium or high confidence.
모ë íì¼ì ë¶ì Taskê° ìë£ë ëê¹ì§ ë기í©ëë¤.
3-B: ìì°¨ ìì
ì¤ì¼ì¤í¸ë ì´í°ê° 모ë ë¶ì 결과를 ìì§í í:
- ê° findingì ê²í íì¬ false positive ì ê±° (í¹í cross-file ìì¡´ì± íì¸)
- confidenceê° “high”ì¸ ê²ë¶í° ìì°¨ì ì¼ë¡ íì¼ì ìì
- confidenceê° “medium”ì¸ ê²ì íë² ë íì¸ í ìì
ìì ì ë°ëì ì¤ì¼ì¤í¸ë ì´í°ê° ì§ì ìíí©ëë¤ (sub-agentì ëì íì¼ ìì ë°©ì§).
ì ê±° ëì (lint/TSë¡ ëª» ì¡ë ê²ë¤)
| í¨í´ | ì¤ëª |
|---|---|
| Unused exports | ìë¡ ì¶ê°ë export ì¤ íë¡ì í¸ ì´ëìë import ì ëë ê² |
| Unused functions | ì ì í í¸ì¶ëì§ ìë í¨ì |
| Unused types/interfaces | 참조ëì§ ìë íì ì ì¸ |
| Commented code blocks | 주ì ì²ë¦¬ë ì½ë ë¸ë¡ (ì¤ëª 주ìì ì ì§) |
| Orphan console.log | ëë²ê¹ ì©ì¼ë¡ ì¶ê°ë console.log |
Unused Export íì§ ë°©ë²
git diffë¡ ìë¡ ì¶ê°ë export ìë³:
git diff HEAD -- <file> | grep "^+" | grep -E "export (const|function|class|type|interface|enum)"
- íë¡ì í¸ ì ì²´ìì í´ë¹ exportê° importëëì§ íì¸:
grep -r --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" "import.*<export_name>.*from" .
grep -r --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" "{ <export_name>" .
- ì´ëìë import ì ëë©´ ìì
주ìì¬í
- ëì import (
import())ë¡ ì¬ì©ë ì ìì¼ë¯ë¡ í´ë¹ í¨í´ë ê²ì - barrel file (index.ts)ìì re-exportëë ê²½ì° ì¶ì
- 주ì ì¤ TODO, FIXME, NOTE, ì¤ëª 주ìì ì ì§
4. ìì ì ì©
íì¼ ìì í ë³ê²½ ì¬í ìì½ ì¶ë ¥:
- ì ê±°ë import ì
- ì ê±°ë ë³ì/í¨ì ì
- ì ê±°ë ì½ë ë¼ì¸ ì
- (ë³ë ¬ ë¶ì ì) ë¶ì ë°©ì ìì½: íì¼ ì, ë³ë ¬ ìì´ì í¸ ì
ì¬ì© ìì
ì¬ì©ì: ë°©ê¸ ìì
í ì½ë unused ì 리í´ì¤
ì¬ì©ì: git diff ë³´ê³ ë¶íìí ì½ë ìì í´
ì¬ì©ì: dead code í´ë¦°ì