refactormethods
Extract small, focused methods from large code blocks
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Extract Methods Refactor
Ask the user for the file or directory to refactor. Support multiple files if a directory is provided.
Process
Work through these steps in order, making a separate commit for each extraction:
-
Extract simple helper methods
- Calculations, formatting, simple logic
- Single responsibility, behavior-focused names
- Pass necessary parameters rather than sharing state
-
Extract complex logic blocks
- Validation, transformations, data processing
- Well-named methods that reveal intent
- Apply proper access modifiers (private for helpers)
-
Extract control flow sections
- Only when it improves readability
- Avoid over-extraction that hurts clarity
After EACH extraction:
- Run tests automatically
- If tests fail, revert the change immediately
- If tests pass and using IDE refactoring tool, commit:
. r <description> - If tests pass but manual refactoring, commit:
^ r <description>
Guidelines
- Extract pragmatically to improve code organization
- Name methods based on behavior not implementation
- Ensure each method ≤ 25 lines
- Preserve original functionality exactly
Output
- If no methods to extract, report "No methods to extract"
- Otherwise provide brief summary (e.g., "Extracted 5 methods from 3 large blocks")
Commit Format
Use Arlo's Commit Notation (ACN):
-
. r extract validateUserCredentials method- IDE refactoring -
^ r extract transformRawStockData method- Manual refactoring
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!