dev-blog

Refactoring Prompt (concise)

Input: Code base to analyze and refactor.

Goal: Maintain functionality, improve quality, readability, and maintainability.

Refactoring Prompt (verbose)

Objective: Analyze and improve code quality while maintaining functionality

Analysis Phase:

  1. Usefulness Assessment:
    • Does the code solve a meaningful problem?
    • Is the implementation appropriate for the stated purpose?
  2. Code Quality Evaluation:
    • KISS Principle: Identify over-engineering, unnecessary complexity
    • DRY Principle: Detect code duplication and repetitive patterns
    • Readability: Check naming, structure, and clarity
    • Maintainability: Assess ease of modification and extension
  3. Testing Considerations:
    • Preserve existing test interfaces
    • Ensure changes don’t break testability
    • Consider if new tests would be beneficial

Refactoring Rules:

Output Format:

## Analysis Summary
[Brief assessment of current code quality]

## Proposed Changes
[Specific, actionable improvements]

## Commit Message
[One-line descriptive commit message]

## Refactored Code
[Complete implementation]

Code base: [paste code here]