feat(skills): lint skill line counts with skill-check

CLAUDE.md §5's 110-line cap on SKILL.md held only in prose, so it decayed
twice — 013 split moor and 016 deduped call-charon and commit-atomic-jj,
both hand-fixes. `okf-check` has enforced the same integer across OKF/
since 009; skills/ now gets its own gate.

A sibling script, not a flag on okf-check: the two trees share the
integer 110 and nothing else, and threading a tree-kind flag through a
275-line OKF-page-shaped validator to reuse a two-line comparison fails
sieve's Minimal test.

- feat(conjure-a-skill): add scripts/skill-check <skills-dir>, walking
  */*/SKILL.md — ERROR over 110, WARN in the 101-110 headroom band with
  the count and the room left. Mirrors okf-check's argv, WARN /ERROR
  prefixes, closing tally and 1/0/2 exit codes
- docs(conjure-a-skill): swap the done-criteria line asserting the cap in
  prose for the script invocation, as write-OKF obliges okf-check; one
  line for one, leaving the file at 105
- docs(blueprint): flip 017 to implemented and update its index line

The tree lands green: 0 errors, 9 warnings, with write-OKF and bdd at the
cap itself. Verify exercises the error leg against a synthetic over-cap
skill — a check that cannot fail is not a check.

implements blueprint 017
This commit is contained in:
Łukasz Boryń 2026-07-30 14:42:21 +02:00
parent 60953e9280
commit 3b80a6e6c1
4 changed files with 50 additions and 3 deletions

View File

@ -1,6 +1,6 @@
--- ---
type: Blueprint type: Blueprint
status: locked status: implemented
traces-to: user request 2026-07-30 traces-to: user request 2026-07-30
sounded: 2026-07-30 sounded: 2026-07-30
cites: cites:

View File

@ -38,7 +38,7 @@ your task needs. Humans welcome too.
- [014](blueprints/014-unify-skill-sibling-file-naming.md) — unify skill sibling-file naming on lowercase-kebab topic names — implemented - [014](blueprints/014-unify-skill-sibling-file-naming.md) — unify skill sibling-file naming on lowercase-kebab topic names — implemented
- [015](blueprints/015-record-session-check-discharges-on-the-blueprint.md) — record session-check discharges on the blueprint — implemented - [015](blueprints/015-record-session-check-discharges-on-the-blueprint.md) — record session-check discharges on the blueprint — implemented
- [016](blueprints/016-pull-two-skills-under-cap-and-level-commit-twins.md) — pull two skills under the line cap and level the commit twins — implemented - [016](blueprints/016-pull-two-skills-under-cap-and-level-commit-twins.md) — pull two skills under the line cap and level the commit twins — implemented
- [017](blueprints/017-add-a-line-cap-lint-over-skills.md) — add a line-cap lint over skills/ — locked - [017](blueprints/017-add-a-line-cap-lint-over-skills.md) — add a line-cap lint over skills/ — implemented
## Ferries ## Ferries

View File

@ -85,7 +85,7 @@ description: <what it does>. Use when <concrete trigger>.
## Output / done criteria ## Output / done criteria
- New `SKILL.md` exists at the right path, passes the checks in step 4. - New `SKILL.md` exists at the right path, passes the checks in step 4.
- `SKILL.md` is ≤ 110 lines. - **`scripts/skill-check skills/` run and its output pasted**, exiting 0.
- User has been told the exact `jj describe` command to run. - User has been told the exact `jj describe` command to run.
- Skill appears in the skill list on next Claude Code session start. - Skill appears in the skill list on next Claude Code session start.

View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Validate skill line counts. Usage: skill-check <skills-dir>
Errors (exit 1): a SKILL.md over the 110-line house cap. Warnings
(exit 0): a SKILL.md in the 101-110 headroom band — legal, but with
nowhere left to grow, so the next edit needs a topic-named sibling
rather than more lines.
The cap errors rather than warns because a legal move always exists:
push reference into a sibling. Only `<category>/<name>/SKILL.md` is
read — siblings load on demand and carry no cap.
"""
import sys
from pathlib import Path
CAP = 110
WARN_AT = 100
def main(argv):
if len(argv) != 2:
print("usage: skill-check <skills-dir>", file=sys.stderr)
return 2
root = Path(argv[1]).resolve()
if not root.is_dir():
print(f"not a directory: {root}", file=sys.stderr)
return 2
errors, warnings = [], []
for page in sorted(root.glob("*/*/SKILL.md")):
rel = page.relative_to(root.parent)
lines = page.read_text().count("\n") # `wc -l`, the count the cap is stated in
if lines > CAP:
errors.append(f"{rel}: {lines} lines, over the {CAP}-line cap")
elif lines > WARN_AT:
warnings.append(f"{rel}: {lines} lines, {CAP - lines} under the cap")
for line in warnings:
print(f"WARN {line}")
for line in errors:
print(f"ERROR {line}")
print(f"{len(errors)} error(s), {len(warnings)} warning(s)")
return 1 if errors else 0
if __name__ == "__main__":
sys.exit(main(sys.argv))