code-refactor

Analyzes code structure and produces a refactor proposal without modifying files.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/hanh-nd/agent-kit --skill code-refactor-hanh-nd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-refactor
Source: https://github.com/hanh-nd/agent-kit/tree/main/plugins/agent-kit/.gemini/skills/code-refactor
Command: npx skills add https://github.com/hanh-nd/agent-kit --skill code-refactor-hanh-nd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate structural debt—wrong abstractions, misleading signatures, dead code, and misplaced dependencies—that simple cleanup cannot fix. This Skill diagnoses whether a component's design premise is sound and produces a structured, evidence-backed refactor proposal, so engineers can decide what to change before touching any code. ## Core Features & Use Cases - Premise-first diagnosis: Identifies the single upstream design decision causing multiple symptoms, rather than cataloguing surface-level issues one by one. - Four-phase workflow: Surveys callers and dependencies with real tools (ripgrep, language servers, ts-prune, knip), diagnoses root causes, proposes changes with confidence tiers, and reports in a structured Refactor Proposal format. - Hard-stop safety gates: Flags public exports, HTTP routes, database schemas, event payloads, and feature flags for explicit per-item sign-off before any change is recommended. - Use Case: Point it at a tangled module and ask "is this design right?"—it returns a proposal naming the wrong abstraction, the reversal that fixes it, real call-site counts, and confidence levels per change. ## Quick Start Ask the agent to refactor the module at src/booking and produce a refactor proposal without modifying any files.

Frequently Asked Questions about code-refactor

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

FAQPage Schema
How do I get a refactor plan for a legacy module without changing code?▼

Point the skill at the files, globs, or diff in question and request a refactor proposal. It surveys callers with tools like ripgrep and language servers, diagnoses root causes, and outputs a structured proposal with confidence tiers—no files are modified.

What is the difference between code-refactor and code-simplify?▼

code-simplify works within the existing structure, improving readability while preserving signatures and call sites. code-refactor questions the design itself, reshaping signatures, wrappers, and module boundaries when the decomposition is wrong.

Does code-refactor work with dynamic languages like Python or JavaScript?▼

Yes, but confidence is capped. In dynamic languages, exported symbols are treated as uncertain and never proposed for deletion without user confirmation, since reflection, DI containers, and route registries can hide callers.

When should I not use a structural refactor analysis?▼

Avoid it for style issues, long-but-well-designed functions, or speculative pattern extraction—those belong to readability-focused cleanup. It also refuses to remove feature flags or defensive code without production evidence from the user.

Why does the refactor proposal flag some changes as hard stops?▼

Hard stops cover surfaces where breaking changes are costly: public exports, HTTP routes, event schemas, database fields, and reflection targets. Each requires explicit per-item sign-off before being included in an approved plan.