用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/FlorianBruniaux/claude-code-ultimate-guide --skill refactor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Comprehensive security audit with scored posture assessment
Quick configuration security check against known threats database
Delegate threat-intelligence research and updates to AgentSec, then validate the guide and landing mirrors.
基于 SOC 职业分类
正在显示 SKILL.md
| name | refactor |
| description | Analyze code for SOLID violations and suggest targeted improvements |
| argument-hint | <file_or_module> [--pattern <name>] |
| effort | medium |
| when_to_use | Use when a module has SOLID violations, code smells, or duplication to address. |
| disable-model-invocation | true |
Analyze code for SOLID violations and suggest targeted improvements.
Identify refactoring opportunities based on:
Determine the refactoring scope from user input:
# Get file/directory stats
if [ -f "$TARGET" ]; then
wc -l "$TARGET"
echo "Single file analysis"
elif [ -d "$TARGET" ]; then
find "$TARGET" -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) | wc -l
echo "Directory analysis"
fi
Look for:
# Find large files
find . -name "*.{ts,js,py}" -exec wc -l {} + 2>/dev/null | sort -rn | head -10
# Functions with high line count (approximate)
grep -rn "function\|def \|fn " --include="*.{ts,js,py,rs}" . | head -20
Look for:
Look for:
Look for:
Look for:
new Service())# Duplication patterns
grep -rn --include="*.{ts,js,py}" . 2>/dev/null | \
awk -F: '{print $3}' | sort | uniq -c | sort -rn | head -10
# Long parameter lists (> 4 params)
grep -rn "function.*,.*,.*,.*," --include="*.{ts,js}" . 2>/dev/null | head -10
# Deep nesting (4+ levels)
grep -rn "^\s\{16,\}" --include="*.{ts,js,py}" . 2>/dev/null | head -10
For each issue found, assess:
Target: [file/directory] Lines Analyzed: [count]
| Principle | Status | Issues Found |
|---|---|---|
| Single Responsibility | 🟡 | 3 large classes |
| Open/Closed | 🟢 | OK |
| Liskov Substitution | 🟢 | OK |
| Interface Segregation | 🔴 | 2 fat interfaces |
| Dependency Inversion | 🟡 | 5 direct instantiations |
UserServiceViolation: Single Responsibility Current: 450 lines handling auth + profile + notifications Suggested:
UserService.ts (450 lines)
↓ Extract
AuthService.ts (~150 lines)
ProfileService.ts (~150 lines)
NotificationService.ts (~100 lines)
Risk: Medium (update imports) Tests Needed: Update dependency injection in tests
Location: src/handlers/payment.ts:45
Current:
switch (paymentType) {
case 'card': // 50 lines
case 'bank': // 50 lines
case 'crypto': // 50 lines
}
Suggested: Strategy pattern with PaymentProcessor interface
Risk: Low (isolated change)
| Smell | Location | Severity |
|---|---|---|
| Long Method | api.ts:calculateTotal (120 lines) | 🟠 High |
| Duplicate Code | utils/*.ts (3 similar blocks) | 🟡 Medium |
| Deep Nesting | parser.ts:parse (6 levels) | 🟡 Medium |
validateEmail() to shared utils (used in 4 places)processOrder()Before applying suggestions:
Analyze specific file:
/refactor src/services/user.ts
Analyze directory:
/refactor src/api/
Focus on specific principle:
/refactor --focus=srp src/services/
With complexity threshold:
/refactor --threshold=high
$ARGUMENTS