unity-scriptdesign

Reviews Unity gameplay scripts for coupling, lifecycle boundaries, and maintainability.

Updated Jun 21, 2026
One-click install
npx skills add https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications --skill unity-scriptdesign-du-qwq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-scriptdesign
Source: https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications/tree/main/.agents/skills/unity-skills/skills/scriptdesign
Command: npx skills add https://github.com/du-qwq/Shader-Writing-Architecture-and-Specifications --skill unity-scriptdesign-du-qwq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unity gameplay scripts often grow into tightly-coupled god objects with unclear responsibilities, hidden dependencies, and mixed state lifecycles, making them hard to test, refactor, and hand off. This Skill provides a structured design review that catches these problems before they compound. ## Core Features & Use Cases - Design Review Checklist: Evaluates responsibility, MonoBehaviour vs ScriptableObject vs plain C# role choice, coupling, communication patterns, performance hotspots, lifecycle cleanup, Inspector UX, testability, and naming. - Data Lifecycle Boundary Analysis: Classifies every field as authoring-time, composition-time, or runtime-mutable state, with concrete assignment guidance (e.g., weapon stats in ScriptableObjects, cached Rigidbody references in Awake, HP exposed via read-only properties with events). - Structured Output Format: Delivers findings as Keep / Simplify / Refactor / Performance notes / Maintainability notes, focusing only on real hotspots rather than theoretical micro-optimizations. - Use Case: After generating a player controller and inventory system, run this review to discover that a public mutable speed field is being edited by both the Inspector and a power-up script, then refactor it into a runtime-mutable property with a change event. ## Quick Start Review my Unity gameplay scripts for coupling and maintainability issues and suggest the highest-value refactor.

Frequently Asked Questions about unity-scriptdesign

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

FAQPage Schema
How do I review Unity C# scripts for code quality?

Review Unity scripts by checking single responsibility, correct choice between MonoBehaviour, ScriptableObject, and plain C# class, explicit dependencies instead of hidden globals, and cleanup of subscriptions and async work. This Skill applies that checklist and reports findings in a structured format.

When should I use ScriptableObject vs MonoBehaviour in Unity?

Use ScriptableObject for authoring-time data decided by designers before Play, such as weapon damage or level music. Use MonoBehaviour for scene instances with runtime behavior, and plain C# classes for testable core logic that does not need the Unity lifecycle.

How do I reduce coupling between Unity gameplay scripts?

Reduce coupling by making dependencies explicit through constructor arguments or cached GetComponent calls in Awake instead of deep scene lookups or repeated Find calls. Choose deliberately between direct references, interface calls, and events for cross-script communication.

Why does my Unity value break when a designer tweaks it in the Inspector?

This happens when a field mixes authoring-time and runtime-mutable lifecycles, giving it two owners with no invariant. Move designer-tuned values into ScriptableObjects or serialized private fields, and expose runtime state through read-only properties with change events.

Does this Skill modify or rewrite my Unity code automatically?

No, it is documentation-only guidance that produces a review report with Keep, Simplify, Refactor, Performance, and Maintainability sections. It recommends the highest-value structural change rather than applying edits or executing scripts.