Skip to content
Development
Command

/devkit.refactor

Provides guided code refactoring capability with deep codebase understanding, compatibility options, and comprehensive verification. Use when restructuring or improving existing code.

From plugin
developer-kit
36935 skills44 agents35 commands2 MCP
> /plugin marketplace add giuseppe-trisciuoglio/developer-kit
> /plugin install developer-kit@developer-kit

Command definition

devkit.refactor.md
description: Provides guided code refactoring capability with deep codebase understanding, compatibility options, and comprehensive verification. Use when restructuring or improving existing code.
argument-hint: "[ --lang=java|spring|typescript|nestjs|react|python|general ] [ --scope=file|module|feature ] [ refactor-description ]"
allowed-tools: Task, Read, Write, Edit, Bash, Grep, Glob, TodoWrite, AskUserQuestion
model: inherit

Code Refactoring

Overview

You are helping a developer refactor existing code. Follow a systematic approach: deeply understand the codebase and its dependencies, clarify compatibility requirements, design safe refactoring strategies, implement incrementally, and verify thoroughly.

Usage

/developer-kit:devkit.refactor [--lang=java|spring|typescript|nestjs|react|python|general] [--scope=file|module|feature] [refactor-description]

Arguments

| Argument | Description | |--------------|------------------------------------------| | `$ARGUMENTS` | Combined arguments passed to the command |

Current Context

The command will automatically gather context information when needed:

  • Current git branch and status
  • Recent commits and changes
  • Available when the repository has history

Execution Instructions

**Agent Selection**: Based on the `--lang` parameter, select the appropriate agents:

Integration with Sub-agents

This command leverages four specialized sub-agents for comprehensive refactoring:

Language/Framework Selection

Parse $ARGUMENTS to detect the optional `--lang` parameter:

  • `--lang=spring` or `--lang=java`: Use Java/Spring Boot specialized agents
  • `--lang=typescript` or `--lang=ts`: Use TypeScript specialized agents
  • `--lang=nestjs`: Use NestJS specialized agents
  • `--lang=react`: Use React frontend specialized agents
  • `--lang=aws`: Use AWS specialized agents (architecture, CloudFormation, IaC)
  • `--lang=python` or `--lang=py`: Use Python specialized agents
  • `--lang=general` or no flag: Use general-purpose agents (default)

Scope Selection

Parse $ARGUMENTS to detect the optional `--scope` parameter:

  • `--scope=file`: Single file refactoring
  • `--scope=module`: Module/package level refactoring
  • `--scope=feature`: Cross-cutting feature refactoring (default)

**Agent Mapping by Language:**

| Phase | General (default) | Java/Spring Boot (`--lang=spring` or `--lang=java`) | TypeScript (`--lang=typescript` or `--lang=ts`) | NestJS (`--lang=nestjs`) | React (`--lang=react`) | AWS (`--lang=aws`) | Python (`--lang=python` or `--lang=py`) | |---------------------|--------------------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------|--------------------------------------------------------------|----------------------------------------------------|---------------------------------------------------------| | Deep Exploration | `developer-kit:general-code-explorer` | `developer-kit-java:spring-boot-backend-development-expert` | `developer-kit:general-code-explorer` | `developer-kit-typescript:nestjs-backend-development-expert` | `developer-kit-typescript:react-frontend-development-expert` | `developer-kit-aws:aws-solution-architect-expert` | `developer-kit:general-code-explorer` | | Refactoring Expert | `developer-kit:refactor-expert` | `developer-kit-java:java-refactor-expert` | `developer-kit-typescript:typescript-refactor-expert` | `developer-kit-typescript:typescript-refactor-expert` | `developer-kit-typescript:typescript-refactor-expert` | `developer-kit-aws:refactor-expert` | `developer-kit-python:python-refactor-expert` | | Architecture Review | `developer-kit:general-software-architect` | `developer-kit-java:java-software-architect-review` | `developer-kit-typescript:typescript-software-architect-review` | `developer-kit-typescript:typescript-software-architect-review` | `developer-kit-typescript:react-software-architect-review` | `developer-kit-aws:aws-solution-architect-expert` | `developer-kit-python:python-software-architect-expert` | | Code Review | `developer-kit:general-code-reviewer` | `developer-kit-java:spring-boot-code-review-expert` | `developer-kit:general-code-reviewer` | `developer-kit-typescript:nestjs-code-review-expert` | `developer-kit:general-code-reviewer` | `developer-kit-aws:aws-architecture-review-expert` | `developer-kit-python:python-code-review-expert` |

Core Principles

  • **Backward compatibility first — NEVER SKIP**: Phases marked with **[GATE]** MANDATORY STOP POINT are hard gates. You MUST

call the AskUserQuestion tool and wait for the user's response before proceeding. Skipping these phases or proceeding without user input is a workflow violation. Always clarify if breaking changes are acceptable before proceeding.

  • **Deep understanding required**: Refactoring requires comprehensive knowledge of dependencies, usages, and side

effects

  • **Incremental changes**: Prefer small, verifiable changes over large rewrites
  • **Test coverage awareness**: Understand existing test coverage before modifying code
  • **Structured user interaction**: You MUST use the AskUserQuestion tool for all decision points
  • **Use TodoWrite**: Track all progress throughout
  • **No time estimates**: DO NOT provide or request time estimates

---

Phase 1: Refactoring Discovery

**Goal**: Understand what needs to be refactored and why

**Initial request**: $ARGUMENTS

**Actio

Read more
@giuseppe-trisciuoglio
Ships withdeveloper-kit

Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI.

369116 skills44 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
369
Star history of giuseppe-trisciuoglio/developer-kit on GitHub, a chart by star-history.com

Other commands on developer-kit.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command