/okf-skills:okf-qualityfrom okf-skills
Wire the quality gates for an OKF bundle repository — which checks run on every commit, which run on a schedule, and how to make the `okf` CLI fail a build, because it exits 0 on warnings. Use when creating a bundle repository, adding hooks or CI to an existing one, after a gate passed something it should have failed, or when scheduling the expiry sweep. Complements setup-git-hooks with the checks only a bundle needs.
Ships in okf-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A bundle repository needs the same gates as any repository — secret scanning, formatting, a hook
framework — and setup-git-hooks owns those. This skill adds the checks that exist only because the
repository holds an OKF bundle, and it exists because of one measured fact:
The
okfCLI reports most of what is wrong with a bundle as a warning, and exits 0.
A gate that runs okf validate and reads the exit code passes a concept whose source silently
vanished, a dead link, and a concept past its stale_after. Detection is good; failing is left
to you. That is what this skill wires.
bootstrap-project and setup-git-hooksNot for: writing a concept (okf-concept), bundle structure (okf-bundle), or the review cycle
that expiry triggers (okf-verify).
index.md (knowledge/ in the examples)launchd, cron or a CI schedule; expiry cannot be a hooksetup-git-hooks already covers, for any stack, and this skill does not repeat:
| Concern | Where |
|---|---|
| Hook framework install and the two-stage strategy | setup-git-hooks |
Secret scanning (gitleaks) and .editorconfig | setup-git-hooks |
| Licence compliance (REUSE) for public repositories | setup-git-hooks |
| CI hardening — SHA-pinned actions, least-privilege tokens | harden-github-actions |
| Hooks and CI running the same commands | validate-quality-config |
okf Does Not Fail OnMeasured against okf v0.5.0 on 2026-10-27, each fault planted in a fixture bundle, with a clean
control that produced no findings. Re-measure before trusting this table — the tool's coverage
moved between 0.2.1 and 0.5.0, and okf-gate's README (measured at 0.3.0) lists a broken
cross-link as an ERROR that exits 1, where a dead link in a concept body is now a WARN that
exits 0.
| Fault | Rule | Severity | okf validate exit |
|---|---|---|---|
| Footnote cited, never defined | okf/sources/footnote-undefined | WARN | 0 |
| Footnote defined, never cited | okf/sources/footnote-unreferenced | WARN | 0 |
Footnote label matches no sources[].id | okf/sources/footnote-unmatched | WARN | 0 |
| Dead link in a concept body | okf/links/broken | WARN | 0 |
Concept past stale_after | okf/lifecycle/stale | WARN | 0 |
title, description or tags absent | okf/frontmatter/*-recommended | WARN | 0 |
verified entry malformed (by, at) | okf/trust/* | WARN | 0 |
sources[] entry without resource | okf/sources/resource-required | ERROR | 1 |
Malformed stale_after | okf/lifecycle/stale-after-invalid | ERROR | 1 |
| A concept file with no frontmatter | (an error object, no findings) | — | 1 |
verified present, sources absent | no finding | — | 0 |
Dead link in the root index.md | no finding | — | 0 |
The last two rows are not detected at all. They need checks of their own, and the first of
them is below. The second — a dead link in a reserved file — is a gap in okf that this skill does
not close: check the root index by hand when you edit it.
Four checks. The first three are local to the commit; expiry is deliberately not among them — a concept going stale must not block an unrelated commit, which is the whole reason it is a scheduled check.
# okf-quality:lefthook
# .lefthook.yml — the three per-commit bundle gates. Set BUNDLE to the bundle root.
pre-commit:
commands:
okf-findings:
run: |
B="${BUNDLE:-knowledge}"
for t in okf yq; do
command -v "$t" >/dev/null 2>&1 || { echo "okf-quality: $t not on PATH - $B is UNCHECKED" >&2; exit 1; }
done
out=$(mktemp) || exit 1
trap 'rm -f "$out"' EXIT
okf validate "$B" >"$out"; rc=$?
if [ "$rc" -ne 0 ]; then
yq -p=json -o=json -r '.error.message // ([.findings[]? | select(.severity == "ERROR") | .rule + " " + .concept_id] | join("\n"))' "$out" >&2
exit "$rc"
fi
bad=$(yq -p=json -o=json -r '.findings[]? | select(.rule != "okf/lifecycle/stale") | .severity + " " + .rule + " " + .concept_id' "$out") \
|| { echo "okf-quality: could not read okf output" >&2; exit 1; }
if [ -n "$bad" ]; then printf '%s\n' "$bad" >&2; exit 1; fi
verified-coherence:
run: |
B="${BUNDLE:-knowledge}"
command -v yq >/dev/null 2>&1 || { echo "okf-quality: yq not on PATH - verified/sources UNCHECKED" >&2; exit 1; }
list=$(mktemp) || exit 1
trap 'rm -f "$list"' EXIT
find "$B" -name '*.md' ! -name index.md ! -name log.md >"$list"
fail=0
while IFS= read -r f; do
r=$(yq -f extract '(.verified // [] | length) > 0 and (.sources // [] | length) == 0' "$f") \
|| { echo "okf-quality: cannot parse $f" >&2; fail=1; continue; }
if [ "$r" = "true" ]; then echo "FAIL $f: verified with no sources to have checked" >&2; fail=1; fi
done <"$list"
exit "$fail"
release-map:
run: |
B="${BUNDLE:-knowledge}"
[ -f "$B/log.md" ] || { echo "okf-quality: $B/log.md missing" >&2; exit 1; }
grep -qE '^\*\*Releases\*\*' "$B/log.md" || { echo "FAIL: no release map in the $B/log.md preamble" >&2; exit 1; }
What each one is for:
okf-findings fails on every finding except expiry, including the recommended-field
warnings. That is a local call, stricter than the specification: the OKF v0.2 spec requires only
type, and a bundle that treats title, description and tags as optional should narrow the
select to the rule families it cares about. It propagates okf's own exit code when the tool
fails, rather than turning a crash into a pass. A missing okf or yq fails.verified-coherence closes the first undetected row: verified is an act of checking, and a
stamp with no sources cannot have been one. It uses yq -f extract, which reads the frontmatter
as its own document — see process-structured-data for why a YAML tool pointed at the whole file,
or a split('---'), is the wrong tool.release-map applies only to a bundle that carries release tags. A detached copy of the
bundle cannot name its version unless log.md says so (okf-bundle, Versioning). okf already
rejects non-date headings in log.md (§9), so this checks only that the map exists.# okf-quality:expiry-sweep
# Run unattended, daily or weekly, from the bundle repository root. Exits 1 if anything is past
# stale_after — and also if the bundle is too broken to tell, because silence there is not success.
B="${BUNDLE:-knowledge}"
for t in okf yq; do
command -v "$t" >/dev/null 2>&1 || { echo "okf-quality: $t not on PATH - expiry UNCHECKED" >&2; exit 1; }
done
out=$(mktemp) || exit 1
trap 'rm -f "$out"' EXIT
okf validate "$B" >"$out"; rc=$?
[ "$rc" -eq 0 ] || { echo "okf-quality: okf exited $rc - expiry cannot be determined" >&2; exit "$rc"; }
stale=$(yq -p=json -o=json -r '.findings[]? | select(.rule == "okf/lifecycle/stale") | .concept_id' "$out") \
|| { echo "okf-quality: could not read okf output" >&2; exit 1; }
if [ -n "$stale" ]; then
echo "okf-quality: past stale_after:" >&2
printf '%s\n' "$stale" >&2
exit 1
fi
Expiry is a function of today's date, not of a diff. A concept expires on a repository nobody is
committing to, so no commit hook will ever fire for it. Schedule this with launchd, cron or a CI
schedule, and make its failure visible somewhere a human looks — a scheduled job that fails into a
log nobody reads is the same as no job. This skill does not ship a scheduler wrapper; the command
above is what was run and tested, and the wrapper is yours to wire and to verify fires.
None of these is a baseline, and the evidence for each is a bundle that needed it:
setup-git-hooks owns it.okf cannot do it. This skill ships none.README.md and the root index.md are not covered by okf
(see the table above).okf validate --format sarif emits SARIF 2.1.0, measured to carry
one result per finding with ruleId and level. The upload step was not exercised here.Prove the gates can fail. A gate that has only ever passed is unproven. This plants one fault of
each kind in a copy of your bundle and expects every gate to object. Run it from the bundle
repository root, with the gates above saved as .lefthook.yml:
# okf-quality:selftest
B="${BUNDLE:-knowledge}"
here=$PWD
run() { # run <gate> in the (possibly planted) copy at $1
( cd "$1" && yq ".pre-commit.commands[\"$2\"].run" "$here/.lefthook.yml" | BUNDLE="$B" sh ) >/dev/null 2>&1
}
sweep() { ( cd "$1" && BUNDLE="$B" sh "$here/.okf-expiry.sh" ) >/dev/null 2>&1; }
work=$(mktemp -d) || exit 1
trap 'rm -rf "$work"' EXIT
fail=0
expect() { # expect <label> <want: 0|1> <got>
if [ "$3" -eq "$2" ]; then echo "ok $1"; else echo "WRONG $1 (wanted exit $2, got $3)"; fail=1; fi
}
# the clean control must pass, or every "fails" below proves nothing
mkdir -p "$work/clean"; cp -R "$B" "$work/clean/"
run "$work/clean" okf-findings; expect "clean: okf-findings" 0 $?
run "$work/clean" verified-coherence; expect "clean: verified-coherence" 0 $?
sweep "$work/clean"; expect "clean: sweep" 0 $?
first=$(find "$B" -name '*.md' ! -name index.md ! -name log.md | head -1)
plant() { # plant <name> <shell edit of $copy>
rm -rf "$work/p"; mkdir -p "$work/p"; cp -R "$B" "$work/p/"
copy="$work/p/$first"; eval "$2"
}
plant footnote 'printf "\n[^zz]: planted\n" >> "$copy"'; run "$work/p" okf-findings; expect "planted unmatched footnote -> okf-findings fails" 1 $?
plant deadlink 'printf "\nSee [x](nope.md).\n" >> "$copy"'; run "$work/p" okf-findings; expect "planted dead link -> okf-findings fails" 1 $?
plant verified "yq -f process -i 'del(.sources) | .verified = [{\"by\": \"human:test\", \"at\": \"2026-01-01T00:00:00Z\"}]' \"\$copy\""
run "$work/p" verified-coherence; expect "planted verified-without-sources -> verified-coherence fails" 1 $?
plant expired "yq -f process -i '.stale_after = \"2020-01-01\"' \"\$copy\""
run "$work/p" okf-findings; expect "planted expiry -> commit gate STILL passes (expiry is not a commit concern)" 0 $?
sweep "$work/p"; expect "planted expiry -> sweep fails" 1 $?
exit "$fail"
Expected on a sound setup: every line begins ok, exit 0. Any WRONG line means a gate does not
do what this skill says, and the exit is 1. Save the sweep as .okf-expiry.sh first.
Run the hook for real once, with a fault staged. lefthook skips every command when nothing
is staged, so lefthook run pre-commit on a clean tree exits 0 having checked nothing — measured
with lefthook 2.2.2: it passed with a dead link in the tree, and lefthook run pre-commit --force
failed on the same tree. A real git commit always has something staged; a manual run, or a CI
step, needs --force. --all-files does not force these commands, because they take no file
list.
okf validate as the whole gate. It exits 0 on every row of the table above except two.okf or yq is absent. Silence reads as success. Every gate here
fails closed.lefthook run pre-commit with nothing staged as proof the bundle is clean. It skips every
command and exits 0. Use --force.$? after a pipeline. It reports the last command, not the one you meant. The gates capture
okf's exit code directly, then read the output in a separate step.setup-git-hooks — the hook framework, secret scanning and everything stack-independentvalidate-quality-config — that hooks and CI run the same commandsokf-bundle — structure, versioning and the release mapokf-concept — authoring, and the entry formats okf enforcesokf-verify — what to do when the sweep reports expiryprocess-structured-data (from structured-data-skills) — yq -f extract and -f processWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
okf-skills@jrjsmrtn-skills is listed by jrjsmrtn/jrjsmrtn-skills — review the source before installing
npx claudepluginhub jrjsmrtn/jrjsmrtn-skills --plugin okf-skills4 skills in this plugin
/okf-bundleScaffold or restructure an Open Knowledge Format bundle — the directory layout, the reserved files and their constraints, link conventions, versioning, and gate wiring. Use when creating a new OKF bundle, extracting one from a parent repository, or auditing an existing bundle's structure.
/okf-conceptAuthor or revise a single concept in an Open Knowledge Format bundle. Use when adding a concept to an OKF bundle, correcting one, deciding whether a subject earns a file at all, choosing its `stale_after`, or wiring per-claim attribution between footnotes and `sources`.
/okf-verifyRun the re-verification cycle over an OKF bundle — triage by expiry, re-check claims against upstream, run a version-currency sweep, prune what no longer earns its place, and stamp the release. Use when concepts are approaching `stale_after`, after a scheduled gate reports expiry, or before cutting a bundle release.