TL;DR: Editing an official AI agent skill directly (or copy-pasting a shared
SKILL.mdacross repositories) creates an instant maintenance trap: upstream updates either wipe out your fixes or stop happening altogether. The clean fix is skill inheritance by composition. Keep base and vendored official skills untouched, layer thin override add-ons on top usingextends:oroverrides:plus a pinnedbase_version:, let the narrower layer win on conflict, and never copy what the base already says.
┌───────────────────────────────────────────────────────────────────────────┐
│ SKILL INHERITANCE & OVERRIDE PRECEDENCE STACK │
├───────────────────────────────────────────────────────────────────────────┤
│ Layer 1 (Lowest Priority) : Official / Generic Base SKILL.md │
│ └─ Pristine upstream copy or portable cross-project workflow │
│ │
│ Layer 2 (Middle Priority) : Engine / Toolchain Override (*.addon.md) │
│ └─ Version differences, CLI flags, screen recording & prefab helpers │
│ │
│ Layer 3 (Highest Priority) : Project / App Add-On (*.addon.md) │
│ └─ Project scenes, build profiles, custom [CliCommand] endpoints │
│ │
│ Rule: Read 1 -> 2 -> 3. On conflict, the narrower layer always wins. │
│ Never restate the base; cite sections and state only the delta. │
└───────────────────────────────────────────────────────────────────────────┘
The moment a team adopts SKILL.md files for coding agents, two problems show up fast.
First, official skills from tool vendors never quite match your project. A vendor ships an official skill like Unity's unity-cli skill, and it works out of the box for generic project management. Then you upgrade to a newer package version where half the subcommands were renamed, or you add custom Editor commands for screen recording, pixel-diffing, and prefab editing. If you edit the official SKILL.md in place, the very next refresh overwrites your hard-won fixes. If you stop refreshing, you miss upstream improvements.
Second, shared internal skills get forked per repository. You write a clean gameplay-verification or release-checklist skill, copy it into three projects, tweak one for Unity, another for Godot, and a third for a web app. Two months later, someone fixes a major edge case in one repo and the other two copies quietly rot.
Software engineers solved this decades ago with inheritance, interfaces, and composition. AI skills need the exact same pattern: base skills plus thin override add-ons.
The Core Rules of Skill Inheritance
Skill inheritance does not require special runtime magic or a proprietary agent framework. Because coding agents read Markdown instructions sequentially, you can express inheritance cleanly with a simple directory convention, structured YAML frontmatter, and a deterministic reading order:
- Keep the base pristine: A generic base skill contains zero project names, zero machine-specific paths, and zero single-version hacks. A vendored third-party skill stays 100% untouched in a
vendor/directory so upstream updates can overwrite it wholesale. - Write deltas, not copies: An add-on file (
<skill>.addon.md) never restates what the base already explains. It cites the base section and records only what is different, corrected, version-gated, or added. - Define strict precedence: Agents read from general to specific (
Base -> Engine/Version Override -> Project Add-On). When two layers disagree, the narrower layer wins. - Pin
base_version: Every override declares the upstream commit, tag, or date it was checked against. When the base updates, any add-on with an olderbase_versiongets flagged for review before an agent trusts a stale workaround.
| Frontmatter Field | Purpose | Example |
|---|---|---|
type |
Identifies an override layer vs a standalone skill | skill-addon |
overrides |
Points to an official/vendored third-party skill | ../vendor/unity-cli/SKILL.md |
extends |
Points to a generic house base skill | ../../skills/gameplay-verification/SKILL.md |
base_version |
Upstream commit, package version, or date verified against | main @ e91a6c4f or 2026-11-18 |
verified_against |
Optional toolchain/runtime versions tested with this override | Unity 6000.6.6f1 / Pipeline 0.9.1-exp.1 |
disable-model-invocation |
Prevents automatic model loading/invocation so the skill is strictly on demand (true) |
true |
user-invocable |
Controls whether the skill appears in the user / command menu (true or false) |
true |
Controlling Auto-Loading: Making Inherited Skills On-Demand
Normally, modern harnesses use progressive disclosure: only name and description sit in ambient context until the model decides a prompt matches and auto-loads the full SKILL.md. That default is helpful for general habits, but dangerous or wasteful for specialized workflows such as production deploys, store submissions, destructive cleanup, or heavy Video Trim and recording captures. A broad description can cause the agent to auto-load the skill on unrelated tasks, adding noise to the context window and risking unprompted side effects.
To prevent auto-loading where needed so a skill runs only on demand, add invocation-control metadata to your skill, wrapper override, or harness config rather than stripping useful wording out of the description:
| Harness / Config File | Tag / Setting to Prevent Auto-Load | On-Demand Behavior |
|---|---|---|
Claude Code / Cursor / VS Code Copilot / Factory Droid (SKILL.md) |
disable-model-invocation: true |
Blocks automatic model loading, description matching, and subagent preloading; runs only when explicitly invoked via /skill-name |
Manual Menu Visibility (SKILL.md) |
user-invocable: true (or false for background-only skills) |
Keeps the command visible in the / menu when paired with disable-model-invocation: true, or hides background context skills from the manual menu when set to false |
Cursor / Windsurf Rules (.cursor/rules/*.mdc) |
alwaysApply: false (omit globs:) |
Opts out of always-on rule injection; omitting both globs: and description: restricts the rule to manual @rule-name invocation |
OpenAI Codex (agents/openai.yaml) |
policy: { allow_implicit_invocation: false } |
Sidecar skill policy that blocks implicit model triggers so the skill loads only when named explicitly ($skill-name) |
OpenCode (opencode.json) |
permission.skill.<name>: "ask" (or "deny") |
Prompts for explicit confirmation or blocks automatic loading per skill name |
Because you never edit a vendored base skill in place, inheritance lets you convert an aggressive upstream skill into a manual, on-demand workflow without losing upstream refreshes. Wrap it in a thin local entry skill (skills/unity-release/SKILL.md) with disable-model-invocation: true:
---
name: release-verify
description: On-demand release build and Unity verification checklist. Run only when invoked explicitly.
disable-model-invocation: true
user-invocable: true
metadata:
type: skill-addon
extends: ../../skills/gameplay-verification/SKILL.md
base_version: 2026-11-18
---
# On-Demand Release Verification
Read `../../skills/gameplay-verification/SKILL.md` when explicitly invoked via `/release-verify`, then run the release checklist.
That keeps your base skill intact while guaranteeing zero ambient auto-loading on everyday coding turns.
Example 1: Extending a Generic Base Skill Without Forking
Suppose you maintain a generic release-smoke-test or gameplay-verification skill that works for any interactive app or game. The base skill captures the universal rules: verify live frames rather than static logs, never mutate internal state to fake a pass, test cold boot separately from warm state, and clean up temporary test fixtures when finished.
Here is the generic base skill (skills/gameplay-verification/SKILL.md):
---
name: gameplay-verification
description: Universal runtime verification loop for interactive apps and games.
metadata:
type: skill
version: 2026-11-18
---
# Gameplay Verification (Base)
## 1. Verify against live frames, not dry code reads
Do not mark an interactive fix complete from a compile check alone. Boot the runtime, drive real inputs, and inspect the rendered output.
## 2. Test cold start separately from warm state
Static caches and in-memory singletons can mask initialization bugs across scene restarts. Reset process or script state before claiming a startup fix works.
## 3. Clean up synthetic test devices and scratch files
Any temporary cameras, mock controllers, or test captures created during verification must be removed or stored outside version-controlled asset folders.
Now, instead of duplicating those three sections inside every Unity project, a Unity-specific override extends the base with extends: and fills in only the engine mechanics:
---
name: gameplay-verification-unity
description: Unity engine override for gameplay-verification using unity-cli eval probes.
metadata:
type: skill-addon
extends: ../../skills/gameplay-verification/SKILL.md
base_version: 2026-11-18
verified_against: Unity 6000.6.6f1
---
# Gameplay Verification: Unity Override
Read `../../skills/gameplay-verification/SKILL.md` first, then apply these Unity rules. **This file wins on conflict.**
## Base Section 1 Override: Driving live frames via `unity-cli`
- Enable background ticking before probing an unfocused Editor: `UnityEngine.Application.runInBackground = true;`.
- Send synthetic gamepad input with `UnityEngine.InputSystem.InputSystem.AddDevice<UnityEngine.InputSystem.Gamepad>("ProbePad")` and remove it in cleanup (Base Section 3).
- For UI Toolkit buttons, verify both `panel.Pick(el.worldBound.center)` (hit testing) and `ClickEvent.GetPooled()` (handler wiring).
## Base Section 2 Override: Domain reload disabled
- When Enter Play Mode Options skips domain reload, statics survive `Stop` -> `Play`.
- Call `UnityEditor.EditorUtility.RequestScriptReload()` to test true cold-boot behavior.
Notice what is missing from the override: all the general philosophy from the base. If the team adds a new rule to Base Section 4 tomorrow (for instance, a requirement to verify audio focus transitions), every project immediately inherits it without touching a single override file.
Example 2: Overriding Unity's Official unity-cli Skill for Package Versions
Official vendor skills are the best argument for overrides:. Unity publishes official agent skills (such as Unity-Technologies/skills, which includes unity-cli/SKILL.md and its references/ directory) to help agents install editors, inspect scenes, run tests, and drive a live Editor via com.unity.pipeline.
In real production work, however, you run into version skew immediately:
- Projects on
com.unity.pipeline0.5.x - 0.7.x expose flat command names (editor_play,eval,console,set_autotick). - Newer projects on
com.unity.pipeline0.9.x group those commands under dotted/spaced namespaces (editor.playmode start,script eval --code,console get,editor set_auto_tick) and returnCommand Not Found ... renamedif an agent follows older docs. - Specific CLI builds also carry quirks that upstream docs lag behind on (for example,
--no-pagerfailing on a beta release whereUNITY_NO_PAGER=1works, orevalwrapping C# snippets inside a method body whereusingstatements fail to compile and compiler warnings are treated as errors).
Instead of hacking vendor/unity-cli/SKILL.md, keep vendor/unity-cli/ read-only and layer a version override add-on next to it:
---
name: unity-cli-version-override
description: Version-aware command mapping and eval compiler constraints over official unity-cli.
metadata:
type: skill-addon
overrides: ../vendor/unity-cli/SKILL.md
base_version: main @ e91a6c4f
verified_against: unity-cli 1.0.0-beta.13 / com.unity.pipeline 0.9.1-exp.1
---
# Unity CLI: Version & Eval Override
Read `../vendor/unity-cli/SKILL.md` first. **Where this file disagrees with the base, follow this file.**
## 1. Command mapping: Pipeline 0.5-0.7 vs 0.9.x
Check `unity command --query status` once per project. For `0.9.x` projects, replace the base skill's flat command names:
| Legacy (0.5 - 0.7) | Pipeline 0.9.x Replacement |
|---|---|
| `unity command editor_play` | `unity command editor.playmode start` |
| `unity command eval '<code>'` | `unity command script eval --code '<code>'` |
| `unity command console --tail 30 --level error` | `unity command console get --tail 30 --level error` |
| `unity command set_autotick --enable true` | `unity command editor set_auto_tick --enable true --interval_ms 32 --persist true` |
## 2. Unfocused Play Mode tick trap (0.9.x)
The base skill assumes Play Mode ticks automatically. In an unfocused Editor on `0.9.x`, `playerLoopTicking` stalls at `false` until you enable background execution:
- Run `unity command editor.playmode set_run_in_background --enable true`.
- Never call `editor focus` on a developer workstation while active input is live.
## 3. CLI flags and `eval` compiler rules
- **Pager**: Use `UNITY_NO_PAGER=1` in the environment instead of `--no-pager` on affected beta builds.
- **No `using` directives in `eval`**: Snippets compile inside a wrapper method body with warnings-as-errors. Fully qualify types (`UnityEngine.UIElements.UQueryExtensions.Q(...)`) and prefer `FindAnyObjectByType<T>()` over obsolete `FindFirstObjectByType<T>()`.
When Unity ships an update to unity-cli, you run one rsync into vendor/unity-cli/, inspect the diff, and check whether any rule in the override was fixed upstream. If upstream fixed the pager flag, delete two lines from the addon. Nothing else gets clobbered.
Example 3: Overriding unity-cli with Custom Studio Tools (Screen Recording, Prefab Handling & Profiling)
Version fixes are only half the story. The bigger win comes when your team builds custom [CliCommand] tools inside the Unity Editor and needs agents to prefer your custom commands over the built-in ones described in the official skill.
Three areas show up in almost every real Unity production pipeline: screen recording & visual verification, prefab & serialized asset handling, and frame profiling.
A. Screen Recording, Captures, and Visual Diffs
Out of the box, the official unity-cli capture command (capture_game_view) has two sharp edges for autonomous agents:
- Passing no save path returns a base64 PNG inline in JSON, dumping megabytes of tokens straight into the agent's context window and spiking thread cost.
- Passing a relative
--save_pathconfines writes insideAssets/(creating.metafiles and pollutinggit status), and--source camerasilently skips Screen Space Overlay and UI Toolkit layers.
If your project adds custom [CliCommand] tools (capture_to_file, capture_compare, capture_sequence), your add-on overrides the base capture workflow so agents never make those mistakes:
---
name: unity-cli-capture-recording-addon
description: Overrides built-in capture_game_view with scratch-path captures, pixel diffs, and MP4 screen recording.
metadata:
type: skill-addon
overrides: ../vendor/unity-cli/SKILL.md
base_version: main @ e91a6c4f
---
# Unity CLI: Capture & Screen Recording Override
## 1. Override: Never use bare `capture_game_view`
- **No inline base64**: Never call a capture command without a file output path.
- **No `Assets/` churn**: Replace `capture_game_view` with our custom `capture_to_file --path <scratch_dir>/shot.png` so temporary shots stay outside `Assets/` with zero `.meta` churn.
- **UI requires `--source screen` in Play Mode**: `--source camera` renders offscreen and drops Overlay canvases and UI Toolkit panels. Always use `--source screen` when checking menus, HUDs, or transitions.
## 2. Additional Tool: Pixel-Diff Baseline Checks (`capture_compare`)
Before and after a UI or shader edit, run a deterministic pixel comparison rather than eyeballing two separate images:
`unity command capture_compare --a baselines/hud-menu.png --b scratch/hud-menu-now.png --diff scratch/hud-diff.png`
## 3. Additional Tool: Screen Recording (`capture_sequence` -> MP4)
To record an animation, level transition, or gameplay loop:
1. Start a frame sequence capture: `unity command capture_sequence --dir scratch/seq --fps 30 --duration 4.0 --source screen`
2. Poll `unity command capture_sequence_status` until complete.
3. Encode with `ffmpeg -framerate 30 -i scratch/seq/frame_%04d.png -pix_fmt yuv420p scratch/clip.mp4` and run your video-trimming utility to strip dead pre-roll frames before review.
Once frames are encoded, passing the clip through a Video Trim pipeline automatically strips frozen compile waits and notification banners before review.
B. Prefab Handling, Scene Mutations, and Missing Profiler Commands
A similar override makes prefab editing and performance profiling safe and predictable:
- Prefab & Scene Handling: Official skills mention driving the Editor instead of hand-editing YAML, but teams often need stricter guardrails and custom helpers. Your add-on can add project commands (for example,
prefab_inspect,prefab_apply_override, orevalrecipes usingUnityEditor.PrefabUtility.LoadPrefabContents/SaveAsPrefabAssetandAssetDatabase.SaveAssets()) and explicitly ban direct regex edits to.prefabor.unityfiles whenever a Pipeline server is reachable. - Filling Missing Official Commands (Profiler): When the official
unity-cliskill has no built-in Profiler or Frame Debugger command, an add-on prevents agents from stalling on broken or slow bridges by supplying the verifiedevalrecipe directly (UnityEditorInternal.ProfilerDriver.GetRawFrameDataView(frame, thread)for per-sample CPU and GC allocation breakdown, orUnity.Profiling.ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Allocated In Frame")).
Automating Inheritance Checks (Zero-Token Validation)
Inheritance breaks down only if links rot silently. Just like compiler type checks verify class inheritance in code, a tiny deterministic script in standard-library Python (check_skill_addons.py) applies Zero-Token Architecture to validate your skill tree in milliseconds at $0.00 runtime token cost:
- Target exists: Every
extends:oroverrides:path in frontmatter resolves to a realSKILL.mdfile. - Version drift detection: Compares each add-on's
base_version:against the current base skill'sversion:(orVENDOR.md'svendored_ref) and warns when an upstream refresh outpaces an override. - Hygiene & portability: Flags absolute machine paths, leaked credentials, or missing
base_versionfields before changes are committed.
#!/usr/bin/env python3
"""Validate skill add-on extends/overrides targets and base_version alignment."""
from pathlib import Path
import re
import sys
FRONTMATTER_RE = re.compile(r"^---\r?\n([\s\S]*?)\r?\n---")
def parse_kv(text: str) -> dict:
match = FRONTMATTER_RE.match(text)
if not match:
return {}
out = {}
for line in match.group(1).splitlines():
if ":" in line and not line.strip().startswith("#"):
k, v = line.split(":", 1)
out[k.strip()] = v.strip().strip('"').strip("'")
return out
def main() -> int:
root = Path(sys.argv[1] if len(sys.argv) > 1 else "skills")
errors = []
for addon in sorted(root.rglob("*.addon.md")):
meta = parse_kv(addon.read_text(encoding="utf-8"))
if meta.get("type") != "skill-addon":
errors.append(f"{addon}: missing metadata type: skill-addon")
target_rel = meta.get("overrides") or meta.get("extends")
if not target_rel:
errors.append(f"{addon}: must declare overrides: or extends:")
continue
target = (addon.parent / target_rel).resolve()
if not target.exists():
errors.append(f"{addon}: target does not exist -> {target_rel}")
if not meta.get("base_version"):
errors.append(f"{addon}: missing base_version pin")
if errors:
for err in errors:
print(f"[FAIL] {err}")
return 1
print("PASS: All skill add-on inheritance targets and base_version pins verified.")
return 0
if __name__ == "__main__":
raise SystemExit(main())
Comparison: Forking Skills vs. Inheritance Add-Ons
| Dimension | Forking / Direct Edits | Base Skill + Override Add-On |
|---|---|---|
| Upstream Updates | Overwrites local fixes or stops updates completely | Clean wholesale replacement of vendor/ directory |
| Multi-Project Reuse | Copy-paste drift across every repo | Single generic base shared everywhere; tiny per-project delta |
| Version Migration | Hunt through 800 lines of mixed prose | Check one small table mapped by base_version |
| Custom Tool Adoption | Agent keeps calling built-in defaults | Override explicitly redirects to custom CLI commands |
| Token & Context Cost | Duplicated boilerplate across files | Base read once, add-on carries only what differs |
Conclusion
Treat AI agent skills with the same engineering discipline as application source code. Never fork an official skill or copy a shared team playbook just to change a flag, upgrade a package version, or wire in a custom screen-recording command.
Keep the base skill clean and portable, keep vendored vendor skills untouched, and express every version delta, custom tool redirect, and project rule inside a small override add-on pinned to base_version. You get upstream updates for free, zero copy-paste rot, and predictable agent behavior across every project and toolchain.
References, Standards & Verified Data
- Agent Skills Open Specification: agentskills.io - Open directory and YAML frontmatter convention (
SKILL.md+references/+scripts/) enabling portable agent skills across coding harnesses. - Official Unity Agent Skills Repository: Unity Technologies, Unity-Technologies/skills - Upstream source for official Unity agent skills including
unity-cli,new-unity-project,ui-uitk, andunity-package-management. - Unity
PrefabUtilityAPI: Unity Technologies, UnityEditor.PrefabUtility Documentation - Managed Editor APIs (LoadPrefabContents,SaveAsPrefabAsset,ApplyPrefabInstance) for deterministic prefab stage mutations without hand-editing serialized YAML. - Unity
ProfilerDriver&ProfilerRecorderAPIs: Unity Technologies, Unity.Profiling.ProfilerRecorder - Managed runtime and Editor counters for programmatic frame time and GC allocation sampling. - Open-Closed Principle (Composition Over Modification): Bertrand Meyer, Object-Oriented Software Construction (Prentice Hall, 1988) - Software entities should be open for extension, but closed for modification; skill add-ons apply this directly to Markdown agent instructions.
Revision History
- 2026-11-23 (Revision 4 - Current):
- Sections Modified: Article frontmatter metadata and bottom Revision History archive.
- Summary: Archived initial release snapshot as
v1and added per-commit revision summary and interactive diff links at bottom. - Links: View Revision v1 • Compare Diff vs v1
- 2026-11-23 (Revision 3 - Commit
9193ef0):- Sections Modified: On-Demand Skill Controls.
- Summary: Documented disable-model-invocation: true, user-invocable, alwaysApply: false, and Codex/OpenCode opt-out tags.
- 2026-11-23 (Revision 2 - Commit
5913a45):- Sections Modified: Internal Studio Interlinking.
- Summary: Linked related published Drawcode/Drawk studio engineering posts across sections.
- 2026-11-23 (Revision 1 - Initial Release (
7926d32)):- Sections Modified: Initial Release.
- Summary: Published AI skill inheritance architecture, unity-cli overrides, and validator script.
- Links: View Archived v1