Skip to content

fix(skill-quality): align bundled scripts with the Agent Skills using-scripts checklist - #5493

Merged
kyle-sexton merged 6 commits into
mainfrom
fix/5293-skill-quality-scripts-checklist
Sep 30, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
fix/5293-skill-quality-scripts-checklist

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #5293

Summary

Audit of the five scripts in plugins/skill-quality/scripts/ against the eight-item scripts checklist
from the Agent Skills "using scripts" guidance: (1) no interactive prompts, (2) --help as the
discovery surface, (3) actionable error messages, (4) structured stdout with diagnostics on stderr,
(5) idempotency, (6) dry-run, (7) meaningful exit codes, (8) output-size truncation. Each cell was
judged with a file:line basis and after a git grep of every consumer of the script's stdout,
stderr and exit codes. Nine violations are cheap and fixed here; four are expensive and listed below
for the owner. No PEP 723 or uvx runners are introduced (house position on #3615).

Verdict per script per item (V-* ids link to the detail below; full basis for the passing cells is
in the audit notes, summarized in the pinned-consumer list):

Script 1 prompts 2 --help 3 errors 4 stdout/stderr 5 idempotency 6 dry-run 7 exit codes 8 truncation
check-skill.sh fail-cheap, fixed (V-CS1) fail-cheap, fixed (V-CS2) fail-cheap, fixed (V-CS3) fail-expensive (V-CS4) pass n/a (read-only) fail-expensive (V-CS5) fail-cheap, fixed (V-CS6); fail-expensive (V-CS7)
check-listing-budget.sh pass pass fail-cheap, fixed (V-LB1) pass pass n/a (read-only) pass pass
measure-invocation.sh pass pass fail-cheap, fixed (V-MI1) pass fail-cheap, fixed (V-MI2) n/a (only emit-plugin-eval writes, into a new or empty directory, never overwrites) fail-cheap, fixed (V-MI3) pass
check-evals-quality.sh pass pass fail-cheap, fixed (V-EQ1) pass pass n/a (read-only) pass fail-expensive (V-EQ2)
skill-frontmatter.sh (sourced library) pass n/a (no CLI; contracts sit above each function) pass pass pass n/a (no side effects) pass n/a

Pinned consumers checked before classifying anything: scripts/check-changed-skills.sh:150-172
(exit code, --require-evals, five CHECK_SKILL_* env seams), scripts/check-all-skills-verb-contract.sh:19-24
(greps description/verb-contract mismatch), ci.yml steps for check-skill, check-listing-budget,
check-evals-quality and measure-invocation validate (exit codes only, the last three
continue-on-error), scripts/check-summary-reader-parity.test.sh (whole skill-frontmatter.sh
API), skills/check/SKILL.md and the plugin README (FAIL:/WARN: prefixes, CHECK-SKILL <name>:
line, N passed, M failed rollup, score JSON shape). The claude-config, docs-hygiene and
claude-ops surfaces only mention these scripts in comments.

Fix

Cheap violations (local, no pinned output line or exit code changed, tested in the existing suites):

Id File Change Regression case
V-CS1 check-skill.sh (check 7) run each skill *.test.sh with </dev/null check-skill.test.sh
V-CS2 check-skill.sh header --help text names CHECK_SKILL_SKIP_MARKDOWNLINT check-skill.test.sh
V-CS3 check-skill.sh explicit usage message for a missing skill name instead of the bash ${1:?} prefix; exit 1 kept check-skill.test.sh
V-CS6 check-skill.sh (check 7) replay the last 100 lines of a failing skill test with a truncation line check-skill.test.sh
V-LB1 check-listing-budget.sh option-shaped argument reports unknown option; exit 2 unchanged check-listing-budget.test.sh
V-MI1 measure-invocation.sh score --method with no value has its own message; usage error points at --help measure-invocation.test.sh
V-MI2 measure-invocation.sh score temp dir removed by an EXIT trap, so the exit paths no longer leave tmp.* behind measure-invocation.test.sh
V-MI3 measure-invocation.sh compare input errors and emit-plugin-eval write errors return 2, the documented usage/environment code, instead of 1 measure-invocation.test.sh
V-EQ1 check-evals-quality.sh option-shaped argument reports unknown option; usage error points at --help; exit 2 unchanged check-evals-quality.test.sh

Contract change: one observable change. V-MI3 moves measure-invocation.sh compare (mismatched or
malformed reports) and emit-plugin-eval (mkdir or write failure) from exit 1 to exit 2, which is what
the script header already documents for usage and environment errors. Existing assertions on those paths
were "non-zero" only; no shell consumer reads them (ci.yml runs only validate). Every other fix
changes diagnostic text on an error path or adds behavior on a path that had none. The plugin is bumped
to 0.24.14 with a changelog entry.

Expensive violations (not fixed here; final call on each stays with the owner):

Id Script Item Basis Proposed change Affected consumers Size
V-CS4 check-skill.sh 4 stdout/stderr :527-539, :2218-2221 opt-in --format json routed through one emitter for err/warn/note, plus per-skill verdict and rollup objects. Findings (stderr) versus INFO/PASS/rollup (stdout) is already a consistent split; only a machine-readable mode is missing. none if opt-in; SKILL.md and README would document it M (about 1 day: multi-line err bodies at :586, :1113, :1020 need escaping, plus a root-mode wrapper and a new test group). Not worth doing until a consumer needs it.
V-CS5 check-skill.sh 7 exit codes :423, :592, :597; suite R9 :4460-4474, cases 4 and 4b exit 2 (not 1) for no-positional usage and for a missing skill or missing SKILL.md, matching the header's "2 = usage/env error"; update header, R9, cases 4/4b and the comment at check-changed-skills.sh:150-151 check-changed-skills.sh (counts any non-zero as failed, so the gate still fails), skills/check/SKILL.md:108-121 (says 1 = FAIL: lines), R9/4/4b S, but it is a documented exit-code contract change on a CI-pinned script
V-CS7 check-skill.sh 8 truncation :366-371 opt-in --quiet printing only FAIL/WARN lines, per-skill verdict and rollup. Root mode prints every skill's full block: 31 lines for two skills, about 5,000 for plugins/*/skills (307 skills). none if opt-in; check-changed-skills.sh runs per skill and could adopt it S-M (children print to the inherited stdout, so it needs capture-and-filter in the dispatch loop or an env seam the child reads)
V-EQ2 check-evals-quality.sh 8 truncation :124-132, :291 --max-findings N: first N per severity plus a count none (opt-in) S. Recommend won't fix: fleet-wide output is 271 lines, bounded by the number of eval sets, and a cap would hide the findings the step exists to list.

Verification

  • bash scripts/affected-tests.sh --run: 48 shell suites passed or were skipped, 0 failed (includes the four plugins/skill-quality/scripts/*.test.sh suites, check-changed-skills.test.sh, check-summary-reader-parity.test.sh). One selected suite is Python and outside that runner: python3 plugins/claude-ops/skills/audit-skill-visibility/scripts/test_audit_skill_visibility.py ran 162 tests, OK.
  • bash scripts/check-changelog-parity.sh --check --check-order: pass; --check-bump origin/main: pass.
  • bash scripts/validate-plugins.sh: all plugin manifests and the catalog validated.
  • markdownlint-cli2 plugins/skill-quality/CHANGELOG.md: 0 issues.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits September 29, 2026 18:37
check-skill.sh: close stdin for skill script tests, cap the failing-test
replay at 100 lines, replace the bash-internal usage error with a plain one,
and document CHECK_SKILL_SKIP_MARKDOWNLINT in --help.
check-listing-budget.sh and check-evals-quality.sh: name an unknown option
instead of reporting a missing root or file.
measure-invocation.sh: name a missing --method value, remove the score temp
dir on every exit, and exit 2 for compare input and emit write errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review September 29, 2026 23:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T23:08:19.730637Z 0650366 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 065036618e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@claude

claude Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 4m 48s —— View job


Code review (/review:code-review)

  • Gather context (PR body, diff, CLAUDE.md/AGENTS.md conventions)
  • Review changed scripts against stated fixes (V-CS1/2/3/6, V-LB1, V-MI1/2/3, V-EQ1)
  • Check test coverage for each fix
  • Verify CHANGELOG/version bump
  • Post findings

No blocking or high-signal findings. I read the full diff against origin/main (all 10 changed files in plugins/skill-quality/) and traced each claimed fix to its behavior:

  • check-skill.sh: stdin now closed for script tests (</dev/null), tail-100 truncation on a failing test, clean usage message for a missing skill name (exit code unchanged at 1), and --help documents CHECK_SKILL_SKIP_MARKDOWNLINT via the auto-derived header (usage() reads the comment block, so the two can't drift). Confirmed the positional-arg ordering relative to BASE_REF_ERR / dispatch-refusal checks is untouched, so no regression there.
  • check-listing-budget.sh / check-evals-quality.sh: option-shaped-argument rejection matches the described exit-2 usage-error path; verified against ci.yml (both steps run with continue-on-error: true), so the unchanged exit code contract holds.
  • measure-invocation.sh: score --method with no value now errors before touching tmp; the EXIT trap fix for cmd_score (dropping local from tmp so the trap — which runs in global scope — can still see it, plus switching to single-quoted trap 'rm -rf -- "$tmp"' EXIT) is already included at this head SHA via aeb5ba6, which resolves the Codex bot's inline finding about interpolating unescaped TMPDIR paths into the trap string. A regression test for a TMPDIR containing a literal quote is included (measure-invocation.test.sh, the "it's" dir case). compare/emit-plugin-eval now return 2 instead of 1 on input/write failures; confirmed via case "$ACTION" dispatch that exit $? propagates correctly, confirmed no shell consumer reads the old code (only validate runs in CI), and confirmed the script's own header already documented 2 as the usage/environment code.
  • Version bump (0.24.14 → 0.24.15) and CHANGELOG entry match the actual diff.

One thing I looked at but isn't a blocking finding: check-listing-budget.sh's new option check only inspects $1 (L88-91), so an option-shaped string in a later root position falls through to "skills root does not exist" instead of "unknown option" — both still exit 2 with an actionable message, so this is a message-wording nit rather than a defect.

@claude

claude Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 11s —— View job


Security review (/review:security-review)

  • Gather context (diff, changed files, custom instructions)
  • Run /review:security-review per its instructions
  • Post findings

Scope: origin/main...HEAD diff for this PR — plugins/skill-quality/scripts/*.sh and their *.test.sh files, plus plugin.json/CHANGELOG.md. Reviewed against the CI security-review criteria: logic flaws, authorization/access-control gaps, injection surfaces, unsafe handling of tokens/secrets/credentials. No workflow files changed, so GitHub Actions hardening is out of scope for this lane. No CLAUDE.md/AGENTS.md/rules/skill/agent bodies changed, so the instruction-surface-deletion lens doesn't apply either.

No open security issues.

One candidate was already caught and fixed within this PR's own history, so it is not a live finding — noted here only for the record:

  • measure-invocation.sh cmd_score originally set its cleanup trap as trap "rm -rf -- '$tmp'" EXIT (double-quoted, expanding $tmp at registration time). A TMPDIR containing a single quote would have broken the trap's shell syntax on every exit, producing an unexpected EOF error and leaving the temp directory behind — flagged by the Codex review on commit 0650366. Commit aeb5ba6 ("keep the score EXIT trap safe for quoted TMPDIR paths") switched it to a single-quoted trap, trap 'rm -rf -- "$tmp"' EXIT (current line), which defers $tmp expansion to trap-fire time and is no longer vulnerable to that path content. A regression test for a quoted TMPDIR was added at measure-invocation.test.sh#L302-L307.

Other changes in the diff (usage-error text, --help wording, exit-code changes for compare/emit-plugin-eval, stdin-closing for skill script tests, output truncation to the last 100 lines) are CLI ergonomics on trusted, repo-local inputs — no new injection, path-traversal, or privilege surface. Non-security observation only (out of scope for this lane, mentioned for completeness): dropping the local tmp declaration alongside the trap fix in cmd_score makes tmp a global rather than function-local variable; it's harmless here since the function runs once per invocation, but a code-quality/review:code-reviewer pass may want it re-scoped.

@kyle-sexton
kyle-sexton merged commit f3cf1f7 into main Sep 30, 2026
2 checks passed
@kyle-sexton
kyle-sexton deleted the fix/5293-skill-quality-scripts-checklist branch September 30, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scripts: audit skill-quality bundled scripts against the Agent Skills using-scripts checklist (child of #3615)

1 participant