refactoring

Guide post-test code refactoring with prioritized improvements and commit strategies.

Updated Nov 8, 2016
One-click install
npx skills add https://github.com/jscriptcoder/jshack.me --skill refactoring-jscriptcoder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring
Source: https://github.com/jscriptcoder/jshack.me/tree/main/.claude/skills/refactoring
Command: npx skills add https://github.com/jscriptcoder/jshack.me --skill refactoring-jscriptcoder

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of improving code structure and maintainability after tests have passed, ensuring code quality without introducing regressions.

Core Features & Use Cases

  • Post-Green Assessment: Guides the assessment of code for refactoring opportunities once tests are passing.
  • Refactoring Prioritization: Provides a classification system (Critical, High, Nice, Skip) for prioritizing refactoring efforts.
  • DRY Principle Guidance: Differentiates between abstracting knowledge versus abstracting code that looks similar.
  • Speculative Code Avoidance: Emphasizes writing code driven by failing tests and avoiding speculative additions.
  • Commit Strategy: Reinforces the critical practice of committing working code before refactoring.
  • Use Case: After successfully implementing a new feature and passing all tests, use this Skill to systematically review the code for clarity, efficiency, and adherence to best practices, ensuring the codebase remains clean and manageable.

Quick Start

Use the refactoring skill to assess the code for improvement opportunities after tests pass.

Frequently Asked Questions about refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve code quality after passing tests?

Code refactoring after passing tests involves systematically reviewing the codebase for clarity and maintainability. This skill guides prioritizing improvements using a classification system and the DRY principle without introducing regressions.

What is the best way to prioritize code refactoring efforts?

Prioritizing refactoring efforts requires classifying opportunities into Critical, High, Nice, or Skip categories. This structured approach ensures developers focus on the most impactful structural improvements for maintainability first.

When should I commit my code before refactoring?

Committing working code before refactoring is a critical practice to ensure a safe fallback point. It ensures that successful test execution results are preserved before attempting any structural changes or applying the DRY principle.

How does the DRY principle apply to abstracting code?

The DRY principle in refactoring differentiates between abstracting actual knowledge versus abstracting code that merely looks similar. It ensures maintainability improvements target genuine duplication rather than forcing false abstractions.

Why should I avoid speculative code during software development?

Avoiding speculative code during development ensures the codebase remains driven strictly by failing tests. This practice prevents unnecessary additions, keeping the software maintainable and focused on actual requirements.