Skip to content

feat: add the optimize-audio and optimize-web skills - #48

Merged
ziyiunity merged 8 commits into
mainfrom
feat/migrate-input-audio-platform-skills
Aug 13, 2026
Merged

feat: add the optimize-audio and optimize-web skills#48
ziyiunity merged 8 commits into
mainfrom
feat/migrate-input-audio-platform-skills

Conversation

@ziyiunity

@ziyiunity ziyiunity commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Adds two skills covering audio and web builds.

Skill What it covers
optimize-audio Audio memory and DSP CPU cost — import settings, load types, sample rates, compression, mixer topology
optimize-web WebGL/WebGPU build size and load time — compression, stripping, memory sizing, frame rate, KTX textures

How these were adapted

These skills were written for an agent that ran C# in the Editor through its own built-in tool. Here they run through the Unity CLI (unity command eval against the project's com.unity.pipeline package), so they work in any agent that can run a shell.

optimize-audio carried no host-specific C#, but all 20 of its Editor interactions went through host tools, and three things were wrong independently of that:

  • Scene and asset queries were conflated. It looked for t:AudioMixer with a scene-object query, but an AudioMixer is a project asset. Now two recipes: FindObjectsByType for components, AssetDatabase.FindAssets for mixer assets.
  • Recipes logged instead of returning. Debug.Log only reaches the Editor console, so a caller reading stdout got nothing. They now return their values.
  • Recipes assumed variables already in scope. Each snippet runs in a fresh scope, so an audioSource or clip the recipe never resolves is a compile error. A resolution recipe was added.

Its pointers to skills that don't exist in this repo now name the underlying Unity tool instead — the Memory Profiler package and the Profiler's Audio module.

optimize-web had the same host-tool problem and, separately, three API names that don't exist. An agent following the original would have failed partway through its own pre-flight, and the failure would have looked like a broken snippet rather than a wrong instruction:

The skill said Exists? Correct form
PlayerSettings.WebGL.codeOptimization no UnityEditor.WebGL.UserBuildSettings.codeOptimization
PlayerSettings.WebGL.optimizationLevel no as above
PlayerSettings.managedStrippingLevel no PlayerSettings.GetManagedStrippingLevel(NamedBuildTarget.WebGL)

Its bundled WebOptimizer.cs had the correct forms all along — only the prose was wrong, so the two are now consistent and the skill carries a short table to stop the wrong spellings coming back. Its five See also pointers referenced skills that don't exist in this repo; those now name the underlying Unity tooling instead.

One line in that skill could not be verified: UserBuildSettings.codeOptimization lives in the WebGL build-support module, which wasn't installed in the Editor used for checking. The skill documents this and tells the agent to treat a resolution failure there as "the Web module isn't installed" rather than as a bad snippet.

Verification

Every C# snippet in both skills was compile-checked against Unity 6000.5.7f1 by prefixing if (true) return "OK";, which type-checks the whole block without executing it. A deliberately broken snippet was run as a control and failed with CS0103, so the passes are real rather than an unreachable-code artifact.

Also checked: every relative references/ and resources/ path resolves to a real file, all descriptions are within the 1,536-character listing cap, no frontmatter carries an author: field, and no skill refers to another as a slash command — they name each other instead, so the references work on hosts that don't expose skills as commands.

AlisonDoucet
AlisonDoucet previously approved these changes Aug 12, 2026

@AlisonDoucet AlisonDoucet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for Asset Transformer Toolkit skill

UnityAnthony
UnityAnthony previously approved these changes Aug 13, 2026

@UnityAnthony UnityAnthony left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

chris-addison
chris-addison previously approved these changes Aug 13, 2026

@chris-addison chris-addison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ziyiunity
ziyiunity dismissed stale reviews from chris-addison and UnityAnthony via 0080681 August 13, 2026 16:39
chris-addison
chris-addison previously approved these changes Aug 13, 2026
@ziyiunity
ziyiunity removed the request for review from DimaTym August 13, 2026 19:54
@ziyiunity ziyiunity changed the title feat: add the input, audio and platform skills feat: add the optimize-audio and optimize-web skills Aug 13, 2026
@ziyiunity
ziyiunity merged commit e6bb0b3 into main Aug 13, 2026
3 checks passed
@ziyiunity
ziyiunity deleted the feat/migrate-input-audio-platform-skills branch August 13, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants