#!/usr/bin/env bash set -euo pipefail # Enforces agentskills.io's skill-authoring.md guidance: keep SKILL.md under 500 # lines and 5,000 tokens, so the full body doesn't crowd out conversation # history and other active skills once loaded into context. Vale can't express # a whole-file length ceiling (its checks operate on text patterns, not raw # file size), so this is a plain script instead of a Vale rule. # # Token counts aren't computed exactly here — word count (`wc -w`) is used as # a proxy. For English prose this typically runs somewhat below true BPE token # counts, so a 5,000-word file is already at or past 5,000 tokens in practice; # treat this as a conservative, cheap approximation, not an exact measure. MAX_LINES=500 MAX_WORDS=5000 FAIL=0 for f in "$@"; do [[ -f "$f" ]] || continue lines=$(wc -l < "$f") if (( lines > MAX_LINES )); then echo "ERROR: $f has $lines lines, exceeding the $MAX_LINES-line ceiling (agentskills.io skill-authoring.md)" >&2 FAIL=1 fi words=$(wc -w < "$f") if (( words > MAX_WORDS )); then echo "ERROR: $f has $words words (proxy for tokens), exceeding the $MAX_WORDS-token ceiling (agentskills.io skill-authoring.md)" >&2 FAIL=1 fi done exit $FAIL