AgentSkillsCN

refactor

在保持功能不变的前提下,重构代码以提升质量。当你需要优化代码结构、消除重复代码、提升性能,或在不改变原有行为的基础上增强代码的可维护性时,可选用此方法。

SKILL.md
--- frontmatter
name: refactor
description: Refactor code to improve quality while maintaining functionality. Use when you need to improve code structure, eliminate duplication, optimize performance, or enhance maintainability without changing behavior.

Refactor Code

Improve code quality while maintaining the same functionality.

Code Quality Improvements

  • Extract reusable functions or components
  • Eliminate code duplication
  • Improve variable and function naming
  • Simplify complex logic and reduce nesting

Performance Optimizations

  • Identify and fix performance bottlenecks
  • Optimize algorithms and data structures
  • Reduce unnecessary computations
  • Improve memory usage

Maintainability

  • Make code more readable and self-documenting
  • Add appropriate comments where needed
  • Follow SOLID principles and design patterns
  • Improve error handling and edge case coverage

Checklist

  • Extracted reusable functions or components
  • Eliminated code duplication
  • Improved variable and function naming
  • Simplified complex logic and reduced nesting
  • Identified and fixed performance bottlenecks
  • Optimized algorithms and data structures
  • Made code more readable and self-documenting
  • Followed SOLID principles and design patterns
  • Improved error handling and edge case coverage