code-refactoring

Refactor Rust and React components while preserving program behavior.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/reynalivan/EMMM2 --skill code-refactoring-reynalivan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-refactoring
Source: https://github.com/reynalivan/EMMM2/tree/main/.agent/skills/code-refactoring
Command: npx skills add https://github.com/reynalivan/EMMM2 --skill code-refactoring-reynalivan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Code quality degradation happens as projects grow; this skill provides a structured approach to refactor without changing external behavior, reducing maintenance burden and technical debt.

Core Features & Use Cases

  • Principled guidelines: Apply Red-Green-Refactor, guard clauses, and modularization to safely improve code.
  • Workflow integration: Pre-flight checks, smell identification, and method/component extraction with verification steps (lint and clippy).
  • Use Case: When a Rust module or a React component becomes long and tangled, apply this skill to extract methods, break into modules, and replace nested code with clear abstractions while preserving behavior.

Quick Start

Start by selecting a small, high-odor area of code, apply a single targeted refactor, and run tests to confirm behavior.

Frequently Asked Questions about code-refactoring

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

FAQPage Schema
How do I refactor Rust code without changing its external behavior?

To refactor Rust code safely, apply pre-flight checks, identify smells, extract methods or modules, and verify behavior using clippy and lint. This structured approach preserves program behavior while reducing technical debt.

What is the best way to break down tangled React components?

Breaking down tangled React components involves identifying code smells, extracting reusable parts, replacing nested logic with clear abstractions, and running validation checks to ensure the external behavior remains unchanged.

How do I start refactoring a large and complex software module?

Start refactoring a complex software module by selecting a small, high-odor area of code, applying a single targeted refactor like method extraction, and running tests to confirm the program behavior is preserved.

Does this refactoring approach work with both Rust and React?

Yes, this refactoring approach works with both Rust and React, applying principles like Red-Green-Refactor, guard clauses, and modularization to guide smell identification and component extraction safely.

Why should I run clippy and lint during code refactoring?

Running clippy and lint during code refactoring serves as a verification step to validate that the structural improvements and pattern extractions do not introduce new errors or alter program behavior.

When should I not use the Red-Green-Refactor workflow?

You should not use the Red-Green-Refactor workflow on code without existing test coverage, as validation steps rely on confirming that external behavior remains unchanged after modularization and smell removal.