AgentSkillsCN

code-check-optimize

通过修复错误、添加类型提示、完善文档,并遵循最佳实践来分析和优化代码。当用户请求检查、优化或改进代码时,可调用此功能。

SKILL.md
--- frontmatter
name: "code-check-optimize"
description: "Analyzes and improves code by fixing errors, adding type hints, documentation, and following best practices. Invoke when user asks to check, optimize, or improve code."

Code Check and Optimize

When analyzing and improving code, perform the following actions:

  1. Fix any errors: Identify and resolve syntax errors, logical bugs, and runtime issues.
  2. Add proper type hints: Ensure all function arguments and return values have precise type annotations.
  3. Add documentation and comments:
    • Add docstrings to modules, classes, and functions.
    • Add inline comments for complex logic.
  4. Improve code structure and readability:
    • Refactor long functions.
    • Improve variable and function naming.
    • Ensure consistent formatting.
  5. Follow best practices and coding standards:
    • Adhere to PEP 8 (for Python) or relevant style guides.
    • Use appropriate design patterns.