Skip to content
Development
Skill

/cleaner

Clean up and audit a Unity project. 清理与审计 Unity 工程。

From plugin
unity-skills
1.6k74 skills5 commands
Install
$ npx -y skills add Besty0728/Unity-Skills --skill cleaner --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/cleaner

Context preview

The summary Claude sees to decide when to auto-load this skill.

Clean up and audit a Unity project. 清理与审计 Unity 工程。

SKILL.md

cleaner.SKILL.md
name: unity-cleaner
description: Clean up and audit a Unity project. 清理与审计 Unity 工程。

Triggers

  • Reducing project bloat
  • Hunting duplicate or orphaned assets
  • Auditing before a release
  • 给项目瘦身、排查重复或孤立资源、发布前审计

Unity Cleaner Skills

> **Safety**: `cleaner_delete_assets` uses a **two-step confirmToken handshake**. Call without `confirmToken` to preview; call again with the returned token (5-minute TTL) to actually delete. There is no `dryRun` parameter.

Guardrails

**Operating Mode** (v1.9 three-tier):

  • **Approval** (default): all analyze/query skills (`cleaner_find_unused_assets`, `cleaner_find_duplicates`, `cleaner_find_missing_references`, `cleaner_get_asset_usage`, `cleaner_find_empty_folders`, `cleaner_find_large_assets`, `cleaner_get_dependency_tree`) are SemiAuto — run directly.
  • **Auto** / **Bypass**: SemiAuto and FullAuto run directly.
  • Auto-forbidden in this module: `cleaner_delete_assets`, `cleaner_delete_empty_folders` (both carry `SkillOperation.Delete`). In Approval/Auto these return `MODE_FORBIDDEN` — they are reachable only under Bypass mode or via a user-managed Allowlist entry; the grant flow does **not** unlock them.
  • `cleaner_fix_missing_scripts` is an `Execute | Modify` operation (it replaces missing component references with null in place, no asset deletion), so it **does not** trigger the NeverInSemi gate. In Auto / Bypass it runs directly; in Approval it still requires the standard grant handshake before execution.
  • `cleaner_delete_assets` additionally uses a two-step `confirmToken` handshake even when the mode gate allows it — preview first (no token), then confirm with the returned token (5-minute TTL).

**DO NOT** (common hallucinations):

  • `cleaner_delete` / `cleaner_remove` do not exist → cleaner skills only find/report; use `asset_delete` to actually remove
  • `cleaner_fix` does not exist → use `cleaner_fix_missing_scripts` specifically for missing script references
  • `cleaner_scan` / `cleaner_find_unused` do not exist → use specific skills: `cleaner_find_unused_assets`, `cleaner_find_duplicates`, `cleaner_find_missing_references`, `cleaner_find_empty_folders`, `cleaner_find_large_assets`

**Routing**:

  • To delete found assets → use `asset` module's `asset_delete` / `asset_delete_batch`
  • For project validation → use `validation` module

Skills Overview

| Skill | Description | |-------|-------------| | `cleaner_find_unused_assets` | Find assets not referenced by others | | `cleaner_find_duplicates` | Find duplicate files by content hash | | `cleaner_find_missing_references` | Find missing scripts/asset references | | `cleaner_delete_assets` | Delete assets via two-step confirmToken (preview → confirm) | | `cleaner_get_asset_usage` | Find what references a specific asset | | `cleaner_find_empty_folders` | Find empty folders in the project | | `cleaner_find_large_assets` | Find largest assets by file size | | `cleaner_delete_empty_folders` | Delete all empty folders | | `cleaner_fix_missing_scripts` | Remove missing script components from GameObjects | | `cleaner_get_dependency_tree` | Get dependency tree for an asset |

---

Skills

cleaner_find_unused_assets

Find potentially unused assets of a specific type.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `assetType` | string | No | "Material" | Asset type filter | | `searchPath` | string | No | "Assets" | Search path | | `limit` | int | No | 100 | Max results |

**Returns**: `{success, assetType, potentiallyUnusedCount, assets: [{path, name, type, sizeBytes}]}`

# Find unused materials
result = call_skill("cleaner_find_unused_assets", assetType="Material")

# Find unused textures in a specific folder
result = call_skill("cleaner_find_unused_assets", 
    assetType="Texture2D", searchPath="Assets/Textures")

cleaner_find_duplicates

Find duplicate files by MD5 hash.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `assetType` | string | No | "Texture2D" | Asset type | | `searchPath` | string | No | "Assets" | Search path | | `limit` | int | No | 50 | Max groups |

**Returns**: `{success, duplicateGroupCount, totalWastedBytes, totalWastedMB, groups: [{count, sizeBytes, wastedBytes, files}]}`

# Find duplicate textures
result = call_skill("cleaner_find_duplicates", assetType="Texture2D")
print(f"Wasted space: {result['totalWastedMB']:.2f} MB")

cleaner_find_missing_references

Find components with missing scripts or null references.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `includeInactive` | bool | No | true | Include inactive objects |

**Returns**: `{success, issueCount, missingScripts, missingReferences, issues: [{type, gameObject, path, ...}]}`

# Scan for all missing references
result = call_skill("cleaner_find_missing_references")
print(f"Missing scripts: {result['missingScripts']}")
print(f"Missing references: {result['missingReferences']}")

cleaner_delete_assets

Delete specified assets with **two-step confirmation**.

> ⚠️ **Safety First**: Deletion requires TWO calls - first preview, then confirm.

**Step 1 - Preview** (no confirmToken):

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `paths` | string[] | Yes | Asset paths to delete |

**Returns**: `{action: "preview", confirmToken, assetsToDelete, message}`

**Step 2 - Confirm** (with confirmToken):

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `confirmToken` | string | Yes | Token from preview step |

**Returns**: `{action: "deleted", deletedCount, results}`

# Step 1: Preview what will be deleted
preview = call_skill("cleaner_delete_assets", 
    paths=["Assets/Unused/mat1.mat", "Assets/Unused/mat2.mat"])
print(preview['message'])  # Shows: "⚠️ PREVIEW ONLY
Read more
Ships withunity-skills

REST API-based AI-driven Unity Editor Automation Engine Let AI control Unity scenes directly through Skills 🎉 We are now indexed by DeepWiki! Got questions? Check out the AI-generated docs → The current official maintenance baseline is Unity 2022.3+.

Get the whole plugin