Perform structured refactoring operations: extract module, split file, inline abstraction, rename symbol across codebase, simplify complex code, or reduce coupling. Use when the user wants to refactor code, extract a module, split a large file, or reorganize code structure.
Perform structured refactoring operations guided by user intent. Supports common refactoring patterns across any language.
Perform the refactoring described in $ARGUMENTS. If no specific operation is given, analyze the target code and suggest the most impactful refactoring.
Before making any changes, gather context:
$ARGUMENTS (or infer it):
Present a brief plan to the user before executing:
## Refactoring Plan
**Type:** [extract | split | inline | rename | simplify | decouple | reorganize]
**Target:** [file or symbol being refactored]
### Changes
- [ ] [Description of each change, in order]
### Files affected
- [List every file that will be modified]
### Risks
- [Any behavioral changes, import path changes, or public API impacts]
Wait for user confirmation before proceeding. If the refactoring is trivial (single-file, no public API change), proceed directly.
Apply changes methodically:
Extract:
Split:
Inline:
Rename:
Simplify:
Decouple:
Reorganize:
After applying changes:
PyTorch深度学习模式与最佳实践,用于构建稳健、高效且可复现的训练流程、模型架构和数据加载。