chore: update validation checks to enforce character limits for skill names and descriptions

This commit is contained in:
Mohan Raj Rajamanickam 2026-03-12 12:37:21 -07:00
parent 4c9a9afb80
commit 4b3e6e3263
No known key found for this signature in database
GPG Key ID: 7CE83B7611FA8B8B
2 changed files with 30 additions and 4 deletions

View File

@ -1,4 +1,4 @@
**References:** [Contributing guide](../CONTRIBUTING.md) · [Skill authoring guide](../README.md)
**References:** [Contributing guide](../CONTRIBUTING.md) · [Skill authoring guide](../README.md) · [Agent Skills spec](https://agentskills.io/specification)
## What changed
@ -35,9 +35,9 @@
### Automated checks
Enforced by CI ([`npm run validate:skills`](../scripts/validate-skills.ts)):
Enforced by CI ([`npm run validate:skills`](../scripts/validate-skills.ts)) per the [Agent Skills spec](https://agentskills.io/specification):
- Directory is one level deep, named in kebab-case, contains `SKILL.md`
- Frontmatter `name` matches directory name; `description` is present, ≥ 20 words, and includes trigger language
- Directory is one level deep, named in kebab-case (max 64 chars), contains `SKILL.md`
- Frontmatter `name` matches directory name; `description` is present, ≥ 20 words, ≤ 1024 characters, and includes trigger language
- Body is non-empty and under 500 lines
- Name uses gerund form ⚠ (warning — does not block merge)

View File

@ -81,6 +81,15 @@ const STRUCTURE_CHECKS: StructureCheck[] = [
return { errors: [] }
},
},
{
description: "Name must be at most 64 characters",
run(dirName) {
if (dirName.length > 64) {
return { errors: [`skills/${dirName}: name is ${dirName.length} characters (maximum 64)`] }
}
return { errors: [] }
},
},
{
description: "Name should use gerund form — first word should end in -ing (e.g. generating-apex-tests)",
run(dirName) {
@ -176,6 +185,17 @@ const CONTENT_CHECKS: ContentCheck[] = [
return { errors: [] }
},
},
{
description: "Description must be at most 1024 characters",
run({ dirName, frontmatter }) {
if (!frontmatter) return { errors: [] }
const len = frontmatter.description?.length ?? 0
if (len > 1024) {
return { errors: [`skills/${dirName}/SKILL.md: description is ${len} characters (maximum 1024)`] }
}
return { errors: [] }
},
},
{
description: 'Description must include trigger/activation language (contain "use")',
run({ dirName, frontmatter }) {
@ -319,6 +339,9 @@ function main(): void {
if (errors.length === 0) passed++
}
const hasIssues = allErrors.length > 0 || allWarnings.length > 0
const footer = " Spec: https://agentskills.io/specification · Authoring guide: https://github.com/forcedotcom/afv-library#readme"
if (allWarnings.length > 0) {
console.warn(`\n${allWarnings.length} warning(s):\n`)
for (const w of allWarnings) {
@ -333,9 +356,12 @@ function main(): void {
console.error(`${err}`)
}
console.error("")
console.error(footer)
console.error("")
process.exit(1)
} else {
console.log(`Skill validation passed: ${passed} of ${entries.length} skill(s) checked.`)
if (hasIssues) console.warn(footer)
}
}