跳到正文
agore-skill
参考

Lint 规则参考

全部十条规则的严重级别、精确触发逻辑与消息模板。

lint 对每个 Skill 运行十条规则,顺序始终不变。严重级别取值为 Error 和 Warning。ID 出现在 skill.lint.ignore 中的规则会被跳过。下列消息是精确模板,占位符为 % 风格(与实现的格式化方式一致)。

规则

SPEC-001 — frontmatter 有效性 (Error)

触发条件:SKILL.md 缺失、不以 ---\n 开头、没有闭合的 --- 行,其 YAML frontmatter 无法解析,或 frontmatter 含未知的顶层字段 —— 即不在允许集合 name、description、license、compatibility、allowed-tools、metadata 中的字段。典型的笔误是 allowed_tools(下划线);真正的键是 allowed-tools。字段名按排序、逗号连接输出:

SKILL.md must start with a valid YAML frontmatter block delimited by ---
unknown frontmatter field(s) %s (allowed: name, description, license, compatibility, allowed-tools, metadata)

SPEC-002 — name 有效性 (Error)

触发条件:frontmatter 的 name 为空、超过 64 个字符、不匹配 ^[a-z0-9]+(-[a-z0-9]+)*$,或与 Skill 目录的基本名称不一致。

frontmatter name "%s" must be kebab-case (1-64 chars) and match directory name "%s"

SPEC-003 — description 边界 (Error)

触发条件:description 去除首尾空白后为空、超过 1024 个字符,或 compatibility 超过 500 个字符。

description must be 1-1024 chars (got %d); compatibility must be <= 500 chars

LAYOUT-001 — 可发现的深度 (Error)

触发条件:Skill 目录相对于工作区根目录的路径既不是 .(根目录本身),也不是恰好两段(<anything>/<skill-name>),即嵌套超过一层。

skill directory "%s" is nested too deeply for skills.sh discovery (use root or skills/<name>)

TRIG-001 — 触发条件描述 (Warning)

触发条件:去除首尾空白后的 description 短于 40 个字符,或其小写形式不包含以下任何子串:use when、use this、trigger、when the user、when working、applies when、for (带尾随空格),以及 CJK 形式 适用于 和 当。

description should clearly state trigger conditions (e.g., "Use when...") and be at least 40 chars

CTX-001 — 上下文预算 (Warning)

触发条件(任一):L1 Token 超过 skill.lint.budgets.description_max_tokens;L2 Token 超过 body_max_tokens;L2 行数超过 body_max_lines。预算为零或更小时回退到默认值(120 / 2500 / 300)。

context budget exceeded: L1=%d/%d tokens, L2=%d/%d tokens (%d/%d lines)

CTX-002 — 失效引用 (Error)

按每个失效引用触发:从 SKILL.md 可达的相对路径在 Skill 目录中不存在。引用来自 Markdown 链接以及对 references/、scripts/ 和 assets/ 路径的显式提及;URL、锚点以及逃逸出 Skill 目录的路径被排除。引用提取容忍可选的 ./ 前缀(./references/guide.md),并剥离句尾标点,因此 Read references/guide.md. 与 Run `./scripts/run.sh`. 均能正确提取。可达性是传递的:从 SKILL.md 提及的引用出发,搜索沿 references/*.md 文件宽度优先地追踪引用(有环安全),并在 Skill 内解析相对链接 —— 因此缺失的多跳目标(SKILL.md → references/a.md → references/b.md)同样是失效引用。

referenced file "%s" does not exist in skill directory

CTX-003 — 披露孤儿 (Warning)

按每个孤儿文件触发:references/ 或 scripts/ 下的文件(仅这两类 —— assets/ 下的文件豁免)从未从 SKILL.md 可达 —— 无论是直接引用还是经由 references/*.md 引用图传递可达。被某个可达的引用文件提及的文件不是孤儿文件。

file "%s" is never referenced in SKILL.md (progressive disclosure orphan)

SEC-001 — 秘钥与本地路径 (Error)

按每个匹配触发,扫描 SKILL.md 和每个存在的附属文本文件,匹配正则 (sk-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36}|AKIA[0-9A-Z]{16}|/Users/[a-zA-Z0-9._-]+|/home/[a-zA-Z0-9._-]+|[A-Z]:\\Users\\)。 即:OpenAI 风格的 sk- 密钥、GitHub 个人访问令牌、AWS 访问密钥 ID,以及 /Users/ 或 /home/ 下的绝对路径或 Windows 用户目录。二进制文件 —— 前 512 字节内含 NUL 字节 —— 会被跳过,inspect/release 文件漏斗移除的文件同样被跳过。同一文件内的重复匹配只报告一次。

potential hardcoded secret or local absolute path detected in %s: %s

SEC-002 — 脚本卫生 (Warning)

按每个 scripts/ 下的脚本文件触发:缺少可执行权限(模式位 0111)或首行缺少 #! shebang。

script "%s" should have executable permissions (+x) and a #! shebang line

汇总表

规则 ID严重级别触发条件(简述)
SPEC-001Errorfrontmatter 缺失或无效,或含未知的顶层 frontmatter 字段
SPEC-002Errorname 不合法或与目录不一致
SPEC-003Errordescription 或 compatibility 为空或超长
LAYOUT-001Error目录深度超出根目录或一层父级
TRIG-001Warning描述过短且缺少触发条件措辞
CTX-001Warning超出 L1/L2 Token 或行数预算
CTX-002Error被引用的文件缺失,直接缺失或经 references/*.md 图缺失
CTX-003Warningreferences/ 或 scripts/ 下不可达的文件
SEC-001Error凭据或本地绝对路径模式(仅文本文件)
SEC-002Warning脚本缺少 +x 或 shebang

每条规则的修复指引见如何在 CI 中执行 lint。如何添加你自己的规则:如何添加 lint 规则。

本页目录