Skip to content

Commit ba48956

Browse files
authored
fix: quote four skill descriptions that break YAML frontmatter, add a CI check
1 parent 4fc9c96 commit ba48956

7 files changed

Lines changed: 111 additions & 5 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Validate skills
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'skills/**'
7+
- 'scripts/check-skill-frontmatter.mjs'
8+
- '.github/workflows/validate-skills.yml'
9+
push:
10+
branches: [main]
11+
paths:
12+
- 'skills/**'
13+
14+
jobs:
15+
frontmatter:
16+
name: SKILL.md frontmatter
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
- run: npm install --no-save --no-audit --no-fund js-yaml@4
24+
- run: node scripts/check-skill-frontmatter.mjs skills

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ also shows `unity` as installed and enabled.
4747

4848
```
4949
PLUGIN STATUS VERSION
50-
unity@unity-agent-plugin installed, enabled 0.1.0-beta
50+
unity@unity-agent-plugin installed, enabled 0.1.6-beta
5151
```
5252

5353
### Manual install
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env node
2+
// Fails when any skills/*/SKILL.md has frontmatter that a strict YAML parser rejects,
3+
// or that lacks a non-empty `name` matching its folder or a non-empty `description`.
4+
// Agents parse the frontmatter with a real YAML parser and silently drop a skill that
5+
// fails, so this is the only place the defect becomes visible.
6+
import { readdirSync, readFileSync, existsSync } from 'node:fs';
7+
import { join } from 'node:path';
8+
import yaml from 'js-yaml';
9+
10+
const root = process.argv[2] ?? 'skills';
11+
let checked = 0;
12+
const failures = [];
13+
14+
for (const dir of readdirSync(root, { withFileTypes: true })) {
15+
if (!dir.isDirectory()) continue;
16+
const path = join(root, dir.name, 'SKILL.md');
17+
if (!existsSync(path)) {
18+
failures.push(`${path}: missing`);
19+
continue;
20+
}
21+
const text = readFileSync(path, 'utf8');
22+
const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
23+
if (!match) {
24+
failures.push(`${path}: no YAML frontmatter block`);
25+
continue;
26+
}
27+
let data;
28+
try {
29+
data = yaml.load(match[1]);
30+
} catch (error) {
31+
failures.push(`${path}: frontmatter is not valid YAML: ${error.message.split('\n')[0]}`);
32+
continue;
33+
}
34+
if (typeof data !== 'object' || data === null) {
35+
failures.push(`${path}: frontmatter is not a mapping`);
36+
continue;
37+
}
38+
if (typeof data.name !== 'string' || data.name.trim() === '') {
39+
failures.push(`${path}: missing or empty name`);
40+
} else if (data.name !== dir.name) {
41+
failures.push(`${path}: name "${data.name}" does not match folder "${dir.name}"`);
42+
}
43+
if (typeof data.description !== 'string' || data.description.trim() === '') {
44+
failures.push(`${path}: missing or empty description`);
45+
}
46+
checked += 1;
47+
}
48+
49+
if (failures.length > 0) {
50+
console.error(`${failures.length} problem(s) in ${checked} skill(s):`);
51+
for (const failure of failures) console.error(` ${failure}`);
52+
process.exit(1);
53+
}
54+
console.log(`${checked} skills: frontmatter OK`);

‎skills/physics-3d-collision/SKILL.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
name: physics-3d-collision
3-
description: 3D PhysX collision and trigger diagnostics for MonoBehaviour-based Unity projects. Primary scope: OnCollisionEnter / OnTriggerEnter not firing, objects passing through each other, Physics.Raycast missing, ragdoll explosion, AddForce stops working after settling, MeshCollider rules, and similar 3D PhysX symptoms. Adjacent topics (2D physics, OTS / Unity Physics package): provides a brief best-effort answer with a scope disclaimer and a documentation link, rather than refusing outright. When dedicated specialist skills (physics-2d, physics-dots) are installed, those should handle their respective domains and this skill defers to them.
3+
description: >-
4+
3D PhysX collision and trigger diagnostics for MonoBehaviour-based Unity projects. Primary scope:
5+
OnCollisionEnter / OnTriggerEnter not firing, objects passing through each other, Physics.Raycast
6+
missing, ragdoll explosion, AddForce stops working after settling, MeshCollider rules, and similar
7+
3D PhysX symptoms. Adjacent topics (2D physics, OTS / Unity Physics package): provides a brief
8+
best-effort answer with a scope disclaimer and a documentation link, rather than refusing
9+
outright. When dedicated specialist skills (physics-2d, physics-dots) are installed, those should
10+
handle their respective domains and this skill defers to them.
411
---
512

613
# Skill: physics-3d-collision (PhysX MonoBehaviour)

‎skills/tilemap-ruletile-createfromsegment/SKILL.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
name: tilemap-ruletile-createfromsegment
3-
description: Use when the user wants tiles that auto-tile (autotile) as they paint, wants a RuleTile built from existing terrain or edge sprites, or asks to make sprites "tile correctly" or "connect properly". Also converts sprite-segment-3x3grid output patterns into Unity RuleTile TilingRules: 3x3 grid text patterns (X, ., *) become TilingRule neighbor configurations, mapping '.' to 'This' rules and 'X' to 'DontCare', sorted by specificity (more 'This' rules first). Use when creating RuleTiles from sprite analysis or defining tile neighbor rules programmatically. Sprites must be provided as input.
3+
description: >-
4+
Use when the user wants tiles that auto-tile (autotile) as they paint, wants a RuleTile built from
5+
existing terrain or edge sprites, or asks to make sprites "tile correctly" or "connect properly".
6+
Also converts sprite-segment-3x3grid output patterns into Unity RuleTile TilingRules: 3x3 grid
7+
text patterns (X, ., *) become TilingRule neighbor configurations, mapping '.' to 'This' rules and
8+
'X' to 'DontCare', sorted by specificity (more 'This' rules first). Use when creating RuleTiles
9+
from sprite analysis or defining tile neighbor rules programmatically. Sprites must be provided as
10+
input.
411
required_packages:
512
com.unity.2d.tilemap: ">=1.0.0"
613
com.unity.2d.tilemap.extras: ">=4.0.0"

‎skills/ui-imgui/SKILL.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
name: ui-imgui
3-
description: Unity IMGUI (Immediate Mode GUI) expert for legacy editor tools using OnGUI/immediate mode. Generates and modifies IMGUI EditorWindows, custom Inspectors, PropertyDrawers, and scripts with IMGUI code (OnGUI, OnInspectorGUI). Use when maintaining existing IMGUI editor code or when user explicitly requests IMGUI/OnGUI. Do not use for NEW editor windows or tools: new editor UI defaults to UI Toolkit (ui-uitk) unless the project already uses IMGUI exclusively or the user asks for OnGUI by name.
3+
description: >-
4+
Unity IMGUI (Immediate Mode GUI) expert for legacy editor tools using OnGUI/immediate mode.
5+
Generates and modifies IMGUI EditorWindows, custom Inspectors, PropertyDrawers, and scripts with
6+
IMGUI code (OnGUI, OnInspectorGUI). Use when maintaining existing IMGUI editor code or when user
7+
explicitly requests IMGUI/OnGUI. Do not use for NEW editor windows or tools: new editor UI
8+
defaults to UI Toolkit (ui-uitk) unless the project already uses IMGUI exclusively or the user
9+
asks for OnGUI by name.
410
---
511

612
**Before proceeding:** If the user is asking about creating a **new** editor window, custom inspector, or PropertyDrawer without explicitly mentioning IMGUI/OnGUI, recommend using UI Toolkit (CreateGUI) instead, as it's the modern approach. Only proceed with IMGUI if:

‎skills/ui/SKILL.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
---
22
name: ui
3-
description: Unity UI expert for menus, HUDs, screens, panels, buttons, labels, and all visual interface elements. Handles questions about UI in scenes or prefabs (how many elements, what exists, structure analysis), styling changes (colors, borders, backgrounds, fonts, spacing, rounded corners), layout adjustments, and UI generation. Routes to UI Toolkit, uGUI, or IMGUI based on project context. Use for ANY request to build, edit, or understand game UI (menus, HUDs, settings or pause screens) when no framework is named: consult this skill to detect which UI system the project uses before writing any UI code, even for a request that looks simple enough to build directly.
3+
description: >-
4+
Unity UI expert for menus, HUDs, screens, panels, buttons, labels, and all visual interface
5+
elements. Handles questions about UI in scenes or prefabs (how many elements, what exists,
6+
structure analysis), styling changes (colors, borders, backgrounds, fonts, spacing, rounded
7+
corners), layout adjustments, and UI generation. Routes to UI Toolkit, uGUI, or IMGUI based on
8+
project context. Use for ANY request to build, edit, or understand game UI (menus, HUDs, settings
9+
or pause screens) when no framework is named: consult this skill to detect which UI system the
10+
project uses before writing any UI code, even for a request that looks simple enough to build
11+
directly.
412
---
513

614
Determine the appropriate UI system for the project and route to the correct specialized skill.

0 commit comments

Comments
 (0)