一键导入
refactoring-advisor
Analyzes source code for refactoring opportunities, design smells, and improvement suggestions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyzes source code for refactoring opportunities, design smells, and improvement suggestions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | refactoring-advisor |
| description | Analyzes source code for refactoring opportunities, design smells, and improvement suggestions |
| version | 1.0.0 |
| author | go-on-team |
| tags | ["refactoring","code-quality","design-patterns","clean-code","best-practices"] |
| min_go_on_version | 1.0.0 |
Analyzes source code for common design smells, over-engineering, duplication, and violation of best practices. Produces prioritized, actionable refactoring suggestions with before/after examples and estimated effort.
| Parameter | Type | Description |
|---|---|---|
code | string | Source code to analyze |
language | string | Programming language (rust, python, ts, go, java) |
strictness | string | Analysis depth: basic, balanced, thorough (default: balanced) |
include_examples | boolean | Optional: include before/after code examples (default: true) |
{
"code": "fn process(data: &str) -> String {\n let parts: Vec<&str> = data.split(',').collect();\n let mut result = String::new();\n for (i, part) in parts.iter().enumerate() {\n let trimmed = part.trim();\n if trimmed.len() > 0 {\n if i > 0 {\n result.push_str(\", \");\n }\n if trimmed.starts_with(\"$\") || trimmed.starts_with(\"#\") {\n if trimmed.starts_with(\"$\") {\n result.push_str(&format!(\"VARIABLE:{}\", &trimmed[1..]));\n } else {\n result.push_str(&format!(\"META:{}\", &trimmed[1..]));\n }\n } else if trimmed.parse::<f64>().is_ok() {\n result.push_str(&format!(\"NUM:{}\", trimmed));\n } else {\n result.push_str(&format!(\"STR:{}\", trimmed));\n }\n }\n }\n result\n}",
"language": "rust",
"strictness": "balanced",
"include_examples": true
}
Example output (abbreviated):
# Refactoring Analysis
## 🔴 High Priority
### 1. God Function — process() does too much
**Lines:** 1-28 | **Effort:** ~30 minutes
The function handles splitting, type detection, formatting, and string building.
**Suggestion:** Extract type detection and formatting into separate functions.
```rust
enum Token { Variable(String), Meta(String), Numeric(f64), Text(String) }
fn classify_token(s: &str) -> Option<Token> {
let s = s.trim();
if s.is_empty() { return None; }
Some(if let Some(name) = s.strip_prefix('$') {
Token::Variable(name.to_string())
} else if let Some(name) = s.strip_prefix('#') {
Token::Meta(name.to_string())
} else if let Ok(n) = s.parse::<f64>() {
Token::Numeric(n)
} else {
Token::Text(s.to_string())
})
}
Lines: 11-12 | Effort: ~15 minutes
format!() on every iterationLines: 13-19 | Effort: ~10 minutes
Summary: 1 critical, 2 medium, 4 low suggestions found. Estimated total effort: ~2 hours.
Analyzes project structure, module dependencies, imports, and entry points to generate architecture diagrams in Mermaid format
Analyzes ETL and data pipeline code for optimization opportunities across Python (Pandas, PySpark), Rust (polars, datafusion), SQL, and general pipeline descriptions
Validates environment variable configurations and config files (YAML, TOML, JSON, .env) for missing required variables, type mismatches, deprecated keys, naming convention violations, secret exposure risks, and invalid value ranges
Analyzes code for performance bottlenecks including N+1 queries, O(n^2) or worse algorithms, unnecessary allocations, sync I/O in async contexts, excessive cloning, missing caching opportunities, and large payload transfers. Supports Rust, Python, TypeScript, and Go.
Analyzes, improves, and restructures LLM prompts for clarity, efficiency, and reliability
Analyzes source code for common security vulnerabilities including SQL injection, XSS, command injection, hardcoded secrets, insecure deserialization, path traversal, and SSRF