dev-design-pattern-architect

Diagnoses Unity C# code smells and recommends Gang of Four design patterns with tradeoff matrices.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-design-pattern-architect-unity-upm-packages
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-design-pattern-architect
Source: https://github.com/Unity-UPM-Packages/Antigravity-skills/tree/main/.agents/skills/dev-design-pattern-architect
Command: npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-design-pattern-architect-unity-upm-packages

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity projects often accumulate spaghetti code, bloated MonoBehaviours, and tightly coupled systems that become hard to maintain. This Skill detects architectural anti-patterns in your codebase and prescribes the correct Gang of Four or game-specific design pattern to fix them. ## Core Features & Use Cases - Anti-Pattern Detection: Scans open or recently modified files for red flags like 150+ line MonoBehaviours, enum switch chains, direct cross-system references, and Instantiate calls in gameplay loops. - Pattern Decision Engine: Maps detected signals to concrete patterns (FSM, Object Pool, Observer, Event Bus, Service Locator, DI) with primary and fallback options tailored to project lifecycle and layer (Framework vs Domain). - Proactive Intervention: Interrupts mid-task when it detects bidirectional coupling, new Singletons, or missing state machines, and proposes a refactor path. - Use Case: You ask the AI to refactor an enemy AI script with a 6-branch enum switch; it halts, diagnoses the missing state machine, and delivers an FSM skeleton with a tradeoff matrix and integration checklist. ## Quick Start Ask the AI to review your current Unity script for architectural problems and recommend the right design pattern with a C# skeleton.

Frequently Asked Questions about dev-design-pattern-architect

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

FAQPage Schema
How do I choose the right design pattern for my Unity project?▼

Match your code signal to a decision table: enum state switches map to FSM, frequent spawning maps to Object Pool, and cross-system UI updates map to Observer or Event Bus. The Skill classifies your project layer and lifecycle first, then proposes one to three patterns with a tradeoff matrix.

How to refactor a bloated MonoBehaviour in Unity?▼

A MonoBehaviour exceeding roughly 150 lines signals a God Object anti-pattern. The Skill halts, extracts the distinct responsibilities, and prescribes a correcting pattern such as MVC/MVP separation, Strategy, or component-based modular design with a C# skeleton.

Should I use Singleton or Dependency Injection in Unity?▼

Dependency Injection via VContainer is preferred; Singleton is a last resort flagged with a warning. If a Singleton must be used, it should be interface-backed so it remains mockable in unit tests.

When should I use an Event Bus instead of direct references in Unity?▼

Use an Event Bus when multiple unrelated systems must broadcast or receive events globally without hard-coded references. For simpler one-to-one UI reactions, a C# event or Action<T> Observer pattern is sufficient.

Does this approach work for early prototypes versus shipping projects?▼

Yes, recommendations adapt to lifecycle stage. Early prototypes favor simplicity and basic patterns, mid-development enforces modularity with FSM and Observer, and late-stage projects prioritize zero-GC-overhead patterns for performance.