基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Hbin77/claude-code-kit --skill code-smells命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | code-smells |
| description | Analyze code for smells, anti-patterns, and refactoring opportunities. Read-only analysis, no code changes. |
Analyze code for smells, anti-patterns, and refactoring opportunities. Read-only analysis — no code changes.
Determine scope: Use $ARGUMENTS as target path. Default to current project root.
Automated scan: Run available tools based on project type:
JavaScript/TypeScript:
npx knip --reporter compact 2>/dev/null # unused exports/deps
npx depcheck 2>/dev/null # unused packages
wc -l $(find <scope> -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx') | sort -rn | head -20
Python:
pylint --disable=all --enable=R,C <scope> 2>/dev/null | head -30
wc -l $(find <scope> -name '*.py') | sort -rn | head -20
General (any language):
# Largest files (complexity indicator)
wc -l <files> | sort -rn | head -20
# Deep nesting
grep -rn '^\s\{12,\}' <scope> --include='*.ts' --include='*.py' | head -20
# Magic numbers
grep -rn '[^a-zA-Z0-9_]\([0-9]\{3,\}\)[^a-zA-Z0-9_]' <scope> | head -20
# TODO/FIXME/HACK markers
grep -rn 'TODO\|FIXME\|HACK\|XXX\|WORKAROUND' <scope> | head -30
Manual inspection: Read the top 5 largest files. Look for:
Dependency check: Grep for circular imports:
# Map imports to find circular references
grep -rn "import.*from\|require(" <scope> --include='*.ts' --include='*.js'
| Severity | Criteria | Action |
|---|---|---|
| Critical | Bugs likely, blocking testability, circular deps | Fix immediately |
| Major | Maintainability risk, high complexity, large duplication | Plan refactoring |
| Minor | Style issues, small duplication, naming inconsistency | Fix opportunistically |
| Info | Suggestions, potential improvements | Track for later |
## Code Smell Report: [scope]
### Quick Stats
- Files scanned: N
- Largest file: [path] (N lines)
- Deepest nesting: [path:line] (N levels)
- TODO/FIXME count: N
### Findings
#### Critical (N)
- **[Smell Type]** `path/file.ts:L` — [description]
→ Suggested: [refactoring pattern]
#### Major (N)
- **[Smell Type]** `path/file.ts:L` — [description]
→ Suggested: [refactoring pattern]
#### Minor (N)
- **[Smell Type]** `path/file.ts:L` — [description]
### Hotspot Files (most smells concentrated)
1. `path/file.ts` — N findings
2. `path/file.ts` — N findings
### Recommended Next Steps
1. [Most impactful action]
2. [Second priority]
3. Run `/refactor <scope>` to execute automated refactoring