From 3b80a6e6c135a967a4ae568bd5c21578dba2b7ef Mon Sep 17 00:00:00 2001 From: Lukasz Boryn Date: Thu, 30 Jul 2026 14:42:21 +0200 Subject: [PATCH] feat(skills): lint skill line counts with skill-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 , 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 --- .../017-add-a-line-cap-lint-over-skills.md | 2 +- OKF/index.md | 2 +- skills/productivity/conjure-a-skill/SKILL.md | 2 +- .../conjure-a-skill/scripts/skill-check | 47 +++++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100755 skills/productivity/conjure-a-skill/scripts/skill-check diff --git a/OKF/blueprints/017-add-a-line-cap-lint-over-skills.md b/OKF/blueprints/017-add-a-line-cap-lint-over-skills.md index 2ffb848..dbe72bc 100644 --- a/OKF/blueprints/017-add-a-line-cap-lint-over-skills.md +++ b/OKF/blueprints/017-add-a-line-cap-lint-over-skills.md @@ -1,6 +1,6 @@ --- type: Blueprint -status: locked +status: implemented traces-to: user request 2026-07-30 sounded: 2026-07-30 cites: diff --git a/OKF/index.md b/OKF/index.md index d670469..d27f8a5 100644 --- a/OKF/index.md +++ b/OKF/index.md @@ -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 - [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 -- [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 diff --git a/skills/productivity/conjure-a-skill/SKILL.md b/skills/productivity/conjure-a-skill/SKILL.md index af54b0f..aefc496 100644 --- a/skills/productivity/conjure-a-skill/SKILL.md +++ b/skills/productivity/conjure-a-skill/SKILL.md @@ -85,7 +85,7 @@ description: . Use when . ## Output / done criteria - 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. - Skill appears in the skill list on next Claude Code session start. diff --git a/skills/productivity/conjure-a-skill/scripts/skill-check b/skills/productivity/conjure-a-skill/scripts/skill-check new file mode 100755 index 0000000..d41a6bb --- /dev/null +++ b/skills/productivity/conjure-a-skill/scripts/skill-check @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""Validate skill line counts. Usage: skill-check + +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 `//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 ", 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))