Drop SKILL.md size budgets and document doc layering

This commit is contained in:
gitea committed 2026-10-25 17:55:03 +08:00
1 parent f5b66be85f
commit 43fced7c72
4 files changed
+16 -49

No files matched your search

+1 -18
View File
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test"
import { readdirSync, readFileSync } from "node:fs"
import { join } from "node:path"
import { SKILL_MAX_H2_SECTIONS, SKILL_MAX_LINES, validateSkillDoc } from "./check-skill-md.js"
import { validateSkillDoc } from "./check-skill-md.js"
const REFERENCE_FILES = ["references/alpha.md", "references/beta.md"]
@@ -31,23 +31,6 @@ describe("validateSkillDoc", () => {
expect(validateSkillDoc(cleanSkill(), REFERENCE_FILES)).toEqual([])
})
test("enforces the line budget as a hard error", () => {
const padded = Array.from({ length: SKILL_MAX_LINES }, () => "filler line")
const content = `${cleanSkill()}\n${padded.join("\n")}`
const issues = validateSkillDoc(content, REFERENCE_FILES)
expect(issues.some((issue) => issue.rule === "skill-budget-lines")).toBe(true)
})
test("enforces the H2 section budget as a hard error", () => {
const sections = Array.from(
{ length: SKILL_MAX_H2_SECTIONS + 1 },
(_, index) => `## Section ${index + 1}`
)
const content = `${lines("# Demo Skill", "")}\n${sections.join("\n\n")}`
const issues = validateSkillDoc(content, REFERENCE_FILES)
expect(issues.some((issue) => issue.rule === "skill-budget-h2")).toBe(true)
})
test("flags routing that points at a missing reference file", () => {
const content = lines(
"# Demo Skill",
+5 -30
View File
@@ -3,9 +3,11 @@
* Governance checks for skills/seal-use/SKILL.md (the user/agent-facing
* traffic-routing hub, per .agents/rules/skill-documentation.md).
*
* Scope: the routing-hub charter as hard numbers (size budget) and routing
* integrity (every reference file on disk is routed; every routed reference
* exists on disk). Not checked here: wording quality, table formatting.
* Scope: structure and routing integrity — every reference file on disk is
* routed from SKILL.md; every routed reference exists on disk. Size is
* deliberately NOT gated: where detail belongs (hub vs references/) is a
* review-time judgment, and an arbitrary numeric cap would erode the gate's
* credibility with false positives.
*
* Invoked as `bun run verify:skill-md` (CI + pre-commit) and with `--soft`
* from the ZCode SessionStart hook, which emits hook-safe JSON and never
@@ -24,14 +26,6 @@ import {
export const SKILL_DOC_RELATIVE_PATH = "skills/seal-use/SKILL.md"
export const REFERENCES_DIR_RELATIVE_PATH = "skills/seal-use/references"
/**
* The charter says SKILL.md is a lightweight routing hub, never a feature
* billboard. These budgets turn that into hard numbers; raising them must be
* a deliberate, reviewable diff, not silent growth.
*/
export const SKILL_MAX_LINES = 200
export const SKILL_MAX_H2_SECTIONS = 12
/** Backticked skill-relative references only: `references/<name>.md`. */
const REFERENCE_MENTION = /`(references\/[A-Za-z0-9._-]+\.md)`/g
@@ -43,27 +37,8 @@ export function validateSkillDoc(content: string, referenceFiles: readonly strin
issues.push(...checkSingleLeadingH1(headings, file))
issues.push(...checkHeadingHierarchy(headings, file))
const lineCount = content.split("\n").length
if (lineCount > SKILL_MAX_LINES) {
issues.push({
file,
rule: "skill-budget-lines",
message: `SKILL.md is ${lineCount} lines (budget ${SKILL_MAX_LINES}); move detail into references/ per the routing-hub charter`
})
}
const h2Count = headings.filter((heading) => heading.level === 2).length
if (h2Count > SKILL_MAX_H2_SECTIONS) {
issues.push({
file,
rule: "skill-budget-h2",
message: `SKILL.md has ${h2Count} H2 sections (budget ${SKILL_MAX_H2_SECTIONS}); consolidate before adding more`
})
}
const diskReferences = new Set(referenceFiles)
const mentioned = new Set<string>()
for (const match of content.matchAll(REFERENCE_MENTION)) {
mentioned.add(match[1]!)
if (!diskReferences.has(match[1]!)) {
issues.push({
file,