Skip to content

feat(validator): reject non-spec top-level frontmatter keys; link the per-agent configuration guide - #608

Merged
addyosmani merged 2 commits into
addyosmani:mainfrom
ayobamiseun:feat/lint-spec-frontmatter-keys
Oct 2, 2026
Merged

addyosmani merged 2 commits into
addyosmani:mainfrom
ayobamiseun:feat/lint-spec-frontmatter-keys

Conversation

@ayobamiseun

Copy link
Copy Markdown
Contributor

Summary

docs/advanced-per-agent-configuration.md landed in #316 as "the canonical reference for per-agent configuration". It states that vendor and runtime fields such as model, tools, max_turns, and context "must not appear at the top level of a skill" and belong under metadata or in a per-agent adapter file, because hosts do not promise to ignore unknown top-level keys and a strict client can reject the file.

Two gaps around that doc on main today:

  • Nothing links to it. No file in the repo references advanced-per-agent-configuration.md, so a contributor reading the anatomy doc, README, or CONTRIBUTING never learns the rule exists.
  • Nothing enforces it. skill-lint.js checks name and description and, since feat(validator): hold commands to the same frontmatter rules as skills #595, YAML validity, but has no notion of the specification's key set. A skill with model: claude-opus-5 at the top level passes CI.

Change

Docs (first commit). Link the guide from the three places a contributor actually reads: the Frontmatter rules in docs/skill-anatomy.md (as a rule, naming the six spec keys), the README contributing paragraph, and step 3 of "Creating the skill" in CONTRIBUTING.md.

Validator (second commit). skill-lint.js gains SPEC_FRONTMATTER_KEYS (name, description, license, compatibility, metadata, allowed-tools, per the guide and agentskills.io) and rejects any other top-level key with an error that names the key, lists the allowed set, and points at the guide. Only column-zero keys count: fields nested under metadata and list items are children of a spec key and are exactly where vendor fields are supposed to go, so they are not touched. topLevelFrontmatterKeys is exported for direct testing. validate-commands.js shares only frontmatterYamlErrors, so command frontmatter (context, allowed-tools in local copies) is unaffected.

This is an error, not a warning, following the #571 reasoning: all 25 skills use only name and description today, so the rule fires on nothing on main and can only catch something newly added.

One existing test changes: a skill declaring exempt: sections now gets two errors, the existing refusal and the new unknown-key error. The test asserts both.

Verification

node --test scripts/lib/skill-lint-test.js   # 42 pass (was 35)
node scripts/validate-skills.js              # 25 skills, 0 errors, 0 warnings
node --test scripts/*-test.js scripts/lib/*-test.js   # 114 pass
node scripts/run-evals.js --min-rank1 95     # rank-1 100%
node scripts/validate-commands.js            # 9 commands, 0 errors
git diff --check                             # clean

New tests cover: a vendor key rejected with the key named and the guide cited; every unknown key reported, not just the first; all six spec keys accepted; vendor fields under metadata accepted; the key scanner ignoring comments, nested lines, and body text; no frontmatter; CRLF.

Overlap

#603 and #605 also edit skill-lint.js, in frontmatterYamlErrors and the trigger-negation check respectively. This change adds a constant beside MAX_DESCRIPTION_LENGTH, a helper above parseFrontmatter, and a loop directly after the YAML-validity call, so none of the three hunks share lines. Happy to rebase in whichever order they land.

@addyosmani

Copy link
Copy Markdown
Owner

praise: this turns a contract the per-agent guide already states into a check, and linking the guide from CONTRIBUTING, the README and skill-anatomy fixes the bigger problem, which is that nobody could find it. The allowed keys match the guide word for word.

issue (blocking): it now conflicts with #571, which I just merged (adjacent constants in skill-lint.js, plus the test file). Mechanical rebase and I'll merge.

… CONTRIBUTING

docs/advanced-per-agent-configuration.md calls itself the canonical
reference for keeping SKILL.md frontmatter portable, yet nothing in the
repository links to it. Add the frontmatter rule it states to the anatomy
doc's Frontmatter section, and point at it from the README contributing
paragraph and CONTRIBUTING's frontmatter step, so contributors meet the
rule where they read the format.
…c set

docs/advanced-per-agent-configuration.md says vendor and runtime fields
such as model, tools, max_turns and context must not appear at the top
level of a SKILL.md: hosts do not promise to ignore unknown keys and a
strict client can reject the file. Nothing enforced it; a skill with
model: at the top level passed CI.

Add SPEC_FRONTMATTER_KEYS (name, description, license, compatibility,
metadata, allowed-tools) and an error for any other column-zero key,
naming the key and pointing at the guide. Nested lines under metadata and
list items are children of a spec key and are left alone. Export
topLevelFrontmatterKeys for direct tests. validate-commands.js shares only
frontmatterYamlErrors, so command frontmatter is unaffected.

All 25 skills use only name and description, so the rule fires on nothing
today and follows the addyosmani#571 pattern of errors for rules nothing violates.
The self-exemption test now expects two errors, since exempt: is also not
a spec key.
@ayobamiseun
ayobamiseun force-pushed the feat/lint-spec-frontmatter-keys branch from 16e92a9 to 0898b52 Compare September 26, 2026 17:53
@ayobamiseun

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (2686b62, the 0.6.11 bump) — head is now 0898b52, mergeable, no markers left.

All three conflicts were keep-both with #571 and #605: the MAX_SKILL_LINES constant now sits directly above SPEC_FRONTMATTER_KEYS, the test file's import line unions lintSkillLayout with topLevelFrontmatterKeys, and #571's layout tests precede the spec-key tests at the end of the file. Nothing from either landed PR was altered; the diff against main is the same 147 lines as before.

Verified on the rebased head:

node --test scripts/lib/skill-lint-test.js            # 52 pass (45 on main + the 7 from this PR)
node scripts/validate-skills.js                       # 25 skills, 0 errors, 0 warnings
node --test scripts/*-test.js scripts/lib/*-test.js   # 150 pass
node scripts/run-evals.js --min-rank1 95              # rank-1 100%

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

praise: thanks for the rebase. Still green on all 25 skills, and the allowed keys still match the per-agent guide word for word. Merging.

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.

2 participants