一键导入
refactor-bot
Suggest and apply code refactoring patterns — simplify complex code, extract functions, reduce duplication, improve naming, and modernize syntax.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Suggest and apply code refactoring patterns — simplify complex code, extract functions, reduce duplication, improve naming, and modernize syntax.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Handle typos and variations in brand/product names to discover correct terminology and find relevant information
Automated code review — analyzes source files for bugs, security issues, style violations, and improvement suggestions. Use when asked to review code, check quality, or find problems in files.
Intelligent debugging assistant — analyzes error messages, stack traces, logs, and runtime behavior to identify root causes and suggest fixes.
Generate documentation from source code — creates README, API docs, module summaries, and inline documentation. Use when asked to document code, generate docs, or explain a codebase.
Excel-based student grade analysis with percentage conversion, distribution charts, and detailed performance breakdown
Validate environment variables, dependencies, and system requirements. Diagnose missing configs, version mismatches, and setup issues.
| name | refactor-bot |
| description | Suggest and apply code refactoring patterns — simplify complex code, extract functions, reduce duplication, improve naming, and modernize syntax. |
Analyze code for refactoring opportunities and apply improvements. Simplifies complex logic, extracts reusable functions, eliminates duplication, and modernizes patterns.
write_file, preserving behaviorWhen a code block does a distinct task within a larger function:
Before: 50-line function with inline validation, processing, formatting
After: validate_input() + process_data() + format_output()
When similar code appears in multiple places:
Before: Same 10 lines repeated in 3 handlers with minor variations
After: Shared helper function called from all 3 handlers
When nested if/else chains are hard to follow:
Before: 4 levels of nested if/else
After: Early returns + guard clauses, flat structure
When names don't convey meaning:
Before: let x = get_d(p, 2);
After: let distance = calculate_distance(point, dimensions);
When literal values lack context:
Before: if retries > 3 { sleep(5000); }
After: const MAX_RETRIES: u32 = 3; const RETRY_DELAY_MS: u64 = 5000;
Language-specific modernizations:
? instead of match/unwrap chains, iterators instead of manual loopsBefore:
if condition {
if other_condition {
// actual work
}
}
After:
if !condition { return; }
if !other_condition { return; }
// actual work
For each refactoring:
## [Pattern Name] — file:line_range
**Why:** Brief explanation of the problem
**Before:** Original code snippet
**After:** Refactored code snippet
**Impact:** What improves (readability, maintainability, performance)