返回 Skill 列表
extension
分类: 开发与工程无需 API Key

refactor-suggestions

建议对修改后的代码进行重构,重点关注安全性、可维护性、可读性和函数式编程的纯粹性

person作者: jakexiaohubgithub

Refactor Suggestions

Inspect the repository for code changes and recommend refactors.

Procedure

Phase 1 - Get the Changes

  1. Get all changes in this branch compared to the default branch since it diverged
  2. Scoped from those changes, analyze code from modified and added functions
  3. Suggest (do not re-write functions) refactors focused on:
    • Security
    • Maintainability
    • Readability
    • Logic flow
    • Functional programming purity

Refactor Categories to Consider

  • Increases purity and immutability
  • Reduces side effects and shared state
  • Improves readability and testability
  • Eliminates security anti-patterns
  • Simplifies complex conditionals
  • Extracts reusable utilities
  • Improves error handling

Phase 2 - Return Suggestions

Return Markdown structured as follows:

# Suggestions

**functionName**
location: src/path/to/file.ts `functionName`
description: Detailed explanation of why this function should be refactored
refactor strategy: Explain rationale explicitly
refactored code:

function() { // suggested implementation }


**anotherFunction**
...

Constraints

  • Analyze only within the given code. Do not invent missing context or external APIs
  • Be deterministic and concise
  • Focus on actionable, specific suggestions