advanced-design-patterns

Transform monolithic Unity C# codebases into modular architectures using GoF and SOLID patterns.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/Criezzz/Gametopia2026 --skill advanced-design-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: advanced-design-patterns
Source: https://github.com/Criezzz/Gametopia2026/tree/main/.agent/skills/advanced-design-patterns
Command: npx skills add https://github.com/Criezzz/Gametopia2026 --skill advanced-design-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill converts monolithic, tightly-coupled Unity C# code into modular, testable, and maintainable architectures so teams can avoid God Classes, circular dependencies, and brittle gameplay logic.

Core Features & Use Cases

  • Pattern Templates: Ready-made interface and implementation templates for Strategy, Factory (with pooling), Observer, and Command patterns tailored for Unity.
  • Generator Script: A pattern_gen.py script to scaffold concrete classes, factories, subjects, and commands to accelerate development.
  • Best Practices & Audit: SOLID-focused guidance, lifecycle safety (unsubscribe in OnDisable/OnDestroy), pooling requirements, and an architecture audit checklist.
  • Use Case: Replace a monolithic EnemyController with injectable strategy behaviors, spawn pooled projectiles via a PooledFactory, and update UI via an Observer-based subject to eliminate tight coupling.

Quick Start

Generate a strategy for EnemyAI using the provided generator and wire the produced interfaces into your EnemyController to swap behaviors at runtime.

Frequently Asked Questions about advanced-design-patterns

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

FAQPage Schema
How do I decouple a monolithic Unity C# codebase to avoid circular dependencies?

Decouple monolithic Unity C# codebases by applying interface-first templates for Strategy, Factory, Observer, and Command patterns. This refactoring approach replaces God Classes with modular, testable architectures that enforce SOLID rules and eliminate circular dependencies.

What's the best way to implement interchangeable AI behaviors in Unity?

Implement interchangeable Unity AI behaviors using the Strategy pattern template. It provides injectable interfaces for your EnemyController, allowing you to swap decision logic at runtime without modifying the core MonoBehaviour implementation.

How to spawn pooled projectiles in Unity using the Factory pattern?

Spawn pooled projectiles via a PooledFactory template designed for Unity. It manages object pooling requirements to optimize memory usage and instantiation overhead, producing reusable projectile instances instead of constantly destroying and recreating objects.

Can I use ScriptableObject with the Observer pattern for Unity UI updates?

Yes, the Observer pattern template is compatible with both MonoBehaviour and ScriptableObject in Unity. It creates decoupled event subjects for UI updates and enforces safe event unsubscription during the OnDisable and OnDestroy lifecycle phases.

Does this approach support undo and redo command flows for Unity gameplay logic?

Yes, the Command pattern template explicitly supports undo and redo command flows for Unity gameplay logic. It produces interface-first command classes that encapsulate actions, allowing you to reverse or replay operations without tightly coupling systems.

How do I scaffold concrete classes and factories for Unity design patterns?

Scaffold concrete classes, factories, subjects, and commands using the included pattern_gen.py script. This generator accelerates Unity development by automatically producing boilerplate code that adheres to SOLID principles and ready-to-wire interfaces.