Repository navigation
feat(validator): reject non-spec top-level frontmatter keys; link the per-agent configuration guide - #608
Conversation
|
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.
16e92a9 to
0898b52
Compare
|
Rebased onto current main ( All three conflicts were keep-both with #571 and #605: the Verified on the rebased head: |
addyosmani
left a comment
There was a problem hiding this comment.
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.
Summary
docs/advanced-per-agent-configuration.mdlanded in #316 as "the canonical reference for per-agent configuration". It states that vendor and runtime fields such asmodel,tools,max_turns, andcontext"must not appear at the top level of a skill" and belong undermetadataor 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
maintoday:advanced-per-agent-configuration.md, so a contributor reading the anatomy doc, README, or CONTRIBUTING never learns the rule exists.skill-lint.jschecksnameanddescriptionand, 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 withmodel: claude-opus-5at 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.jsgainsSPEC_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 undermetadataand list items are children of a spec key and are exactly where vendor fields are supposed to go, so they are not touched.topLevelFrontmatterKeysis exported for direct testing.validate-commands.jsshares onlyfrontmatterYamlErrors, so command frontmatter (context,allowed-toolsin local copies) is unaffected.This is an error, not a warning, following the #571 reasoning: all 25 skills use only
nameanddescriptiontoday, so the rule fires on nothing onmainand can only catch something newly added.One existing test changes: a skill declaring
exempt: sectionsnow gets two errors, the existing refusal and the new unknown-key error. The test asserts both.Verification
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
metadataaccepted; the key scanner ignoring comments, nested lines, and body text; no frontmatter; CRLF.Overlap
#603 and #605 also edit
skill-lint.js, infrontmatterYamlErrorsand the trigger-negation check respectively. This change adds a constant besideMAX_DESCRIPTION_LENGTH, a helper aboveparseFrontmatter, 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.