Unity Refactor

Detect code smells and decompose Unity C# codebases into modular services.

7|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/JulianKerignard/Unity-Skills --skill unity-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Unity Refactor
Source: https://github.com/JulianKerignard/Unity-Skills/tree/main/skills/unity-refactor
Command: npx skills add https://github.com/JulianKerignard/Unity-Skills --skill unity-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Traditional Unity projects often grow into large, monolithic managers that become hard to reason about, test, and extend without introducing regressions. This skill offers a disciplined, incremental refactoring workflow that preserves behavior while progressively decoupling responsibilities into focused services.

Core Features & Use Cases

  • Code smell detection and risk-based prioritization: scans a Unity C# codebase to surface actionable smells and rank them by risk.
  • One-refactoring-at-a-time execution with verification: guides the user to implement a single, isolated change, then validates compilation and references before proceeding.
  • Structured plan presentation and governance: presents a complete, prioritized plan before any modification and enforces strict safety rules.
  • Reference-driven recipes and continuity: links to documented refactoring recipes to standardize outcomes across projects.
  • Use Case: a mid-size game project transitions from a mega-manager pattern to modular services (score, spawn, save) without altering gameplay behavior.

Quick Start

Scan your Unity project root, review the generated plan, and execute one safe refactor at a time.

Frequently Asked Questions about Unity Refactor

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

FAQPage Schema
How do I refactor a Unity C# codebase to modular services without breaking gameplay behavior?

Refactor Unity C# codebases safely by detecting code smells, prioritizing them by risk, and decomposing monolithic managers into modular services incrementally while preserving behavior. Execute one isolated change at a time and verify compilation before proceeding to the next step.

What are common Unity code smells in monolithic managers and how are they detected?

Common Unity code smells in monolithic managers include tightly coupled cross-cutting concerns. This skill scans your C# codebase to surface actionable smells and ranks them by risk, enabling a structured, prioritized plan for progressive decoupling into focused services.

Can I use incremental refactoring to split a mega-manager pattern in a mid-size Unity project?

Yes, incremental refactoring supports mid-size Unity projects transitioning from a mega-manager pattern to modular services like score, spawn, and save. It presents a complete prioritized plan before modification and enforces strict safety rules to ensure gameplay behavior remains unaltered.

What's the best way to ensure safe C# refactoring in Unity after each change?

The best way to ensure safe C# refactoring in Unity is to implement one isolated change at a time, then validate compilation and references before proceeding. This skill enforces strict safety rules and requires a workflow to verify compilation after each incremental modification.

Do I need a specific Unity project structure to start refactoring C# scripts?

You need a Unity project with C# scripts and a workflow to verify compilation after each incremental change. The skill scans your project root to generate a prioritized refactoring plan based on detected code smells before any modifications are made.

Why does my Unity project need reference-driven recipes for refactoring?

Reference-driven recipes standardize refactoring outcomes across multiple Unity projects. By linking to documented recipes, the skill ensures continuity and consistency when decomposing monolithic managers and cross-cutting concerns into focused, modular services.