unity-script-validator
Validates C# scripts for best practices, performance, and Unity patterns. Use when reviewing scripts or checking code quality.
When & Why to Use This Skill
The Unity Script Validator is a specialized Claude skill designed to automate the technical review of C# scripts within the Unity game engine. It focuses on identifying performance anti-patterns, enforcing Unity-specific best practices, and ensuring code maintainability. By analyzing field declarations, component caching, and execution loops, it provides developers with actionable refactoring examples and performance impact estimates to optimize game stability and frame rates.
Use Cases
- Automated Performance Audits: Identify high-overhead operations such as 'GetComponent' or 'GameObject.Find' inside Update loops that can cause significant frame drops.
- Best Practice Enforcement: Ensure consistent use of '[SerializeField] private' patterns and proper XML documentation across the codebase for better team collaboration.
- Physics and Logic Optimization: Validate the correct usage of Update vs. FixedUpdate to ensure physics calculations and game logic are handled efficiently.
- Code Quality Benchmarking: Use during the pull request process to quickly scan for string concatenation issues or missing component caching before code is merged into production.
- Legacy Code Modernization: Evaluate older Unity scripts for compatibility and optimization opportunities when upgrading projects to Unity 2019.4 LTS or Unity 6.
| name | Unity Script Validator |
|---|---|
| description | Validates C# scripts for best practices, performance, and Unity patterns. Use when reviewing scripts or checking code quality. |
| allowed-tools | Read, Grep, Glob |
Unity Script Validator
Validates Unity C# scripts against best practices and performance patterns specific to Unity game development.
What This Skill Checks
- Field declarations:
[SerializeField] privateinstead of public fields - Component caching: GetComponent in Awake/Start, not Update (~100x faster)
- String operations: StringBuilder for frequent concatenation
- GameObject.Find: Cache references, avoid in Update (O(n) operation)
- Code organization: #region directives, consistent ordering
- XML documentation:
<summary>tags on public methods - Update vs FixedUpdate: Appropriate usage for physics/non-physics
- Coroutines: Prefer for intermittent tasks over Update
Provides: Issues found, specific fixes, performance impact estimates, refactored code examples.
Compatibility
Applies to Unity 2019.4 LTS and later (including Unity 6).
See patterns.md and examples.md for detailed optimization techniques.
When to Use vs Other Components
Use this Skill when: Quick validation of existing Unity scripts for best practices and common issues
Use @unity-scripter agent when: Writing new code or implementing Unity features from scratch
Use @unity-refactor agent when: Improving code quality, applying design patterns, or modernizing legacy code
Use @unity-performance agent when: Deep performance profiling, memory optimization, or platform-specific tuning
Use /unity:new-script command when: Creating new scripts from production-ready templates
Related Skills
- unity-scene-optimizer: For scene-level performance analysis
- unity-template-generator: For generating validated script templates