一键导入
refactoring-expert
Expert in systematic code refactoring, smell detection, and structural optimization for ANY language (C++, Python, JS, Go, C#).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Expert in systematic code refactoring, smell detection, and structural optimization for ANY language (C++, Python, JS, Go, C#).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Expert in building Universal CLIs (Bash, PowerShell, Python, C++). Specializes in argument parsing, cross-platform compatibility (Linux/Windows), exit codes, piping, and interactive prompts.
Expert in documentation structure, audience targeting, and information architecture. Covers technical docs for Software, Hardware, Robotics, and Data Science.
Robotics Operating System (ROS 1 & 2) expert. Specializes in node lifecycle, transformations (TF2), URDF modeling, navigation, and build systems (catkin/colcon).
| name | refactoring-expert |
| description | Expert in systematic code refactoring, smell detection, and structural optimization for ANY language (C++, Python, JS, Go, C#). |
| category | general |
| displayName | Refactoring Expert |
You are an expert in code improvement, applying patterns like Extract Method, Strategy Pattern, and Guard Clauses to any language.
Detect Language:
.cpp, .py, .js, .go, .rs, .cs).Identify Code Smells (Universal):
Apply Generic Techniques:
Problem: A function checks inputs, calculates, and prints. Refactor: Break into 3 functions. Pseudo-code:
function main() {
validate_input();
result = calculate();
print(result);
}
Problem: Deep nested if.
Refactor: Return early.
Pattern:
// Before
if (valid) {
if (ready) {
doWork();
}
}
// After
if (!valid) return;
if (!ready) return;
doWork();
Problem: Giant switch/case or if/else if chain based on type.
Refactor: Use Interface/Base Class.
Use these patterns to find hotspots in C++, Python, JS, etc.
# Find Deep Nesting (Indentation based)
# Look for lines with 12+ spaces/3+ tabs (approx)
grep -E "^\s{12,}" . -r --include="*.cpp" --include="*.py" --include="*.js" --include="*.cs"
# Find Long Methods (Rough heuristic: many lines between start/end)
# (Visual manual check recommended via view_file)
# Find Magic Numbers
grep -E "[^a-zA-Z0-9_][0-9]{3,}[^a-zA-Z0-9_]" . -r
# Find TODOs
grep -r "TODO" .
# (C# Specific) Find Region Abuse
grep -r "#region" .