home / skills / besty0728 / unity-skills / validation

validation skill

/unity-skills/skills/validation

This skill helps you validate and clean Unity projects by locating missing scripts, unused assets, and structural issues to improve project health.

This is most likely a fork of the unity-skills skill from besty0728
npx playbooks add skill besty0728/unity-skills --skill validation

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.9 KB
---
name: unity-validation
description: "Validate and clean up Unity projects - find missing scripts, unused assets, and issues."
---

# Unity Validation Skills

Maintain project health - find problems, clean up, and validate your Unity project.

## Skills Overview

| Skill | Description |
|-------|-------------|
| `validate_scene` | Comprehensive scene validation |
| `validate_find_missing_scripts` | Find objects with missing scripts |
| `validate_fix_missing_scripts` | Remove missing script components |
| `validate_cleanup_empty_folders` | Remove empty folders |
| `validate_find_unused_assets` | Find potentially unused assets |
| `validate_texture_sizes` | Check texture sizes |
| `validate_project_structure` | Get project overview |

---

## Skills

### validate_scene
Comprehensive scene validation.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `checkMissingScripts` | bool | No | true | Check for missing scripts |
| `checkMissingPrefabs` | bool | No | true | Check for missing prefabs |
| `checkDuplicateNames` | bool | No | false | Check duplicate names |

**Returns**: `{success, sceneName, totalIssues, missingScripts, missingPrefabs, duplicateNames}`

### validate_find_missing_scripts
Find objects with missing script references.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `searchInPrefabs` | bool | No | false | Also check prefab assets |

**Returns**: `{success, count, objectsWithMissingScripts: [{name, path, missingCount}]}`

### validate_fix_missing_scripts
Remove missing script components.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `dryRun` | bool | No | true | Preview only, don't remove |

**Returns**: `{success, totalFixed, fixedObjects}`

### validate_cleanup_empty_folders
Remove empty folders from project.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `rootPath` | string | No | "Assets" | Starting folder |
| `dryRun` | bool | No | true | Preview only, don't delete |

**Returns**: `{success, count, foldersToDelete: [path]}`

### validate_find_unused_assets
Find potentially unused assets.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `assetType` | string | No | null | Filter: Texture/Material/Prefab/etc |
| `limit` | int | No | 100 | Max results |

**Returns**: `{success, count, unusedAssets: [path]}`

### validate_texture_sizes
Check for oversized textures.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `maxRecommendedSize` | int | No | 2048 | Warn if larger |
| `limit` | int | No | 50 | Max results |

**Returns**: `{success, totalChecked, oversizedCount, oversizedTextures: [{path, width, height, recommendation}]}`

### validate_project_structure
Get project folder structure overview.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `rootPath` | string | No | "Assets" | Starting folder |
| `maxDepth` | int | No | 3 | Max folder depth |

**Returns**: `{success, structure, summary: {totalFolders, totalAssets}}`

---

## Common Workflows

### Pre-Build Check
```python
import unity_skills

# Validate scene
scene_result = unity_skills.call_skill("validate_scene")
if scene_result['totalIssues'] > 0:
    print(f"Warning: {scene_result['totalIssues']} issues found")

# Check texture sizes
texture_result = unity_skills.call_skill("validate_texture_sizes", maxRecommendedSize=2048)
if texture_result['oversizedCount'] > 0:
    print(f"Warning: {texture_result['oversizedCount']} oversized textures")
```

### Project Cleanup
```python
import unity_skills

# 1. Preview missing scripts fix
preview = unity_skills.call_skill("validate_fix_missing_scripts", dryRun=True)
print(f"Would fix {preview['totalFixed']} objects")

# 2. Actually fix (if preview looks good)
unity_skills.call_skill("validate_fix_missing_scripts", dryRun=False)

# 3. Preview empty folder cleanup
preview = unity_skills.call_skill("validate_cleanup_empty_folders", dryRun=True)
print(f"Would delete {len(preview['foldersToDelete'])} folders")

# 4. Actually cleanup
unity_skills.call_skill("validate_cleanup_empty_folders", dryRun=False)

# 5. Review unused assets (manual review recommended)
unused = unity_skills.call_skill("validate_find_unused_assets")
for asset in unused['unusedAssets']:
    print(f"Potentially unused: {asset}")
```

## Best Practices

1. **Always use `dryRun=True` first** to preview changes
2. Run validation before major builds
3. Review unused assets manually before deletion
4. Keep texture sizes appropriate for target platform
5. Fix missing scripts before they cause runtime errors
6. Regular cleanup prevents project bloat

Overview

This skill validates and cleans Unity projects by finding missing scripts, unused assets, empty folders, oversized textures, and other structural issues. It provides preview (dry run) and fix actions to safely clean up projects and prevent runtime problems. Use it to maintain project health before builds and to reduce project bloat.

How this skill works

The skill inspects scenes, prefabs, and the Assets folder to locate missing MonoBehaviour references, orphaned prefabs, duplicate names, and empty directories. It analyzes asset references to surface potentially unused assets and checks texture dimensions against recommended sizes. Most actions support a dryRun mode so you can preview results before applying changes.

When to use it

  • Before major builds or releases to catch runtime issues early
  • During periodic maintenance to remove unused assets and empty folders
  • When preparing a project for handoff or version control cleanup
  • After large merges or package imports to detect missing script links
  • When optimizing for target platforms to find oversized textures

Best practices

  • Always run with dryRun=true first to preview destructive changes
  • Fix missing scripts before removing assets to avoid silent failures
  • Manually review assets flagged as unused before deletion
  • Set texture size thresholds appropriate to your target platform
  • Run scene validation and project structure checks as part of CI

Example use cases

  • Pre-build check: validate scenes and texture sizes to surface blocking issues
  • Project cleanup: preview and then remove missing script components and empty folders
  • Asset audit: list potentially unused prefabs, materials, or textures for manual review
  • Optimization pass: find oversized textures that should be resized or compressed
  • Structure report: generate folder depth and asset counts to guide refactoring

FAQ

Can I safely automate fixes?

Yes, but always preview with dryRun first and review results. Automated fixes are useful for repetitive cleanups but may remove items you expected to keep.

Will it delete assets referenced only at runtime or by scripts?

The unused-asset detection is conservative but not perfect. It may miss dynamic references. Always manually verify assets flagged as unused before deleting.