One-click install
npx skills add https://github.com/supermalang/ai-augmented-coding --skill refactor-supermalang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/supermalang/ai-augmented-coding/tree/main/.claude/skills/refactor
Command: npx skills add https://github.com/supermalang/ai-augmented-coding --skill refactor-supermalang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you improve the internal structure of working code when it has become hard to read, extend, or maintain, while keeping behaviour unchanged.

Core Features & Use Cases

  • Behaviour-preserving cleanup: Extract, rename, inline, move, and simplify code without altering observable outputs or public contracts.
  • Test-gated safety: Requires a green baseline and re-checks the relevant tests after each incremental change to prevent regressions.
  • Architecture upkeep: Keeps navigation docs accurate when modules are moved, renamed, or removed so code maps do not drift.
  • Use Case: A codebase with duplicated logic and confusing function names can be refactored into smaller, clearer modules while the test suite confirms everything still works.

Quick Start

Ask the refactor skill to clean up the selected code path without changing behaviour, and it will verify the test baseline before making small, safe improvements.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I refactor code without changing behavior?

Yes, you can safely untangle coupling and reduce code duplication by making incremental improvements and verifying the test suite after each change. This approach preserves observable behavior and keeps public contracts intact while restructuring modules.

Do I need a test suite to clean up existing code?

Yes, you need a green test baseline before cleaning up existing code to ensure behavior preservation. The test suite is re-checked after each incremental modification to catch regressions and verify that observable outputs remain unchanged during maintenance work.

What is the best way to restructure modules in an already-tested codebase?

The best way to restructure modules in an already-tested codebase is through incremental changes verified by a green test suite. You must update navigation documentation when files move or are renamed to ensure architecture docs do not drift from the actual code structure.

When should I not use refactoring on my codebase?

You should not use refactoring when your codebase lacks a green test baseline, as behavior preservation cannot be verified without tests. Additionally, if your goal is to alter observable outputs or change public contracts, this behavior-preserving cleanup approach is not appropriate.

Does refactoring update architecture docs when files are moved?

Yes, refactoring updates architecture docs when files are moved, renamed, or removed during module restructuring. This keeps navigation documentation accurate and prevents code maps from drifting away from the actual internal structure of the codebase.