Skip to content

feat(skill-quality): actionable guidance for gating a marketplace-installed skill - #1167

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/1152-skill-quality-cache-resolution
Jul 23, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/1152-skill-quality-cache-resolution

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

Resolves the F2 finding from inbox item 20260723-090435-melodic-session-plugins-audit — as a deliberate re-scope, because primary-source evidence falsifies half the report. Reviewers should read the re-scope before the diff.

What the report got right (fixed here): skill-quality:check had no path for a marketplace-INSTALLED skill. check plugin:skill (or any name that lives only in the plugin cache) fell back to the project's .claude/skills and printed a bare "Skill not found", so the operator had to already know to set CHECK_SKILL_SKILLS_ROOT. Now:

  • A plugin:skill argument prints exactly how to gate the install — point CHECK_SKILL_SKILLS_ROOT at the cache skills dir — plus the note that the cache is a copy, not a git checkout, so the git-backed checks (3 trigger-preservation, 8 vendor, 9 stale-metadata) no-op there (a "new skill / skipped" result is expected).
  • A missing bare name now names the CHECK_SKILL_SKILLS_ROOT remedy.
  • SKILL.md documents the installed-skill resolution path. Tests cover both messages.

What the report got wrong (NOT fixed — falsified): it claimed the plugin cache "IS a git checkout of the marketplace repo, so HEAD exists" and asked to wire check 3's HEAD comparison to it. Evidence:

What is deliberately NOT built (anti-coupling): auto-resolving plugin:skill against the cache. The sub-layout <marketplace>/<plugin>/<version>/skills is undocumented (only the cache's existence is), and the version dir changes every update. skill-quality is a repo-agnostic marketplace plugin — reverse-engineering an internal path is exactly the coupling the repo's portability gate guards against. The target root stays operator-provided; first-class installed-skill resolution is deferred to #1166 (open design question: no documented cross-plugin install-path lookup exists today).

skill-quality 0.10.0.

Test plan

  • check-skill.test.sh — full suite green, incl. new assertions: missing bare name hints CHECK_SKILL_SKILLS_ROOT; plugin:skill name gets the installed-skill guidance (leaf name echoed, cache path shown, no cache-layout resolution attempted).
  • shellcheck -x check-skill.sh clean.
  • Self-check: skill-quality:check check PASS (0 errors, 0 warnings); SKILL.md 128/500 lines, markdownlint clean.
  • Spot-check: check source-control:setup prints the actionable guidance and exits 1.

Related

Closes #1152

🤖 Generated with Claude Code

…talled skill

The `check` action resolves a bare skill name under one skills root and had
no path for a marketplace-INSTALLED skill: `check plugin:skill` (or any name
that lives only in the plugin cache) fell back to the project's .claude/skills
and reported a bare "Skill not found", so the operator had to already know to
set CHECK_SKILL_SKILLS_ROOT.

- A plugin:skill argument now prints exactly how to run the gate against the
  install (point CHECK_SKILL_SKILLS_ROOT at the cache skills dir) plus the
  note that the cache is a COPY, not a git checkout, so the git-backed checks
  (3/8/9) no-op there — a "new skill / skipped" result is expected.
- A missing bare name now names the CHECK_SKILL_SKILLS_ROOT remedy.
- SKILL.md documents the installed-skill resolution path.
- Tests cover both messages.

Deliberately NO cache-layout reverse-engineering: the sub-layout
<marketplace>/<plugin>/<version>/skills is undocumented and version-dir
churns every update, and skill-quality is repo-agnostic — the target root
stays operator-provided. First-class installed-skill resolution is deferred
to #1166.

Re-scope: the originating report (#1152) is partly falsified. It claimed the
cache "IS a git checkout of the marketplace repo, so HEAD exists" and asked to
wire check 3 to it. Docs say Claude Code COPIES marketplace plugins into
~/.claude/plugins/cache ("rather than using them in-place") and the on-disk
cache has no .git — so check 3's "new skill / skipped" on a cache path is
correct behavior, not a bug, and is not "fixed".

skill-quality 0.10.0.

Closes #1152

Co-Authored-By: Claude Fable 5 <[email protected]>
@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

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


Code Review

  • Gather context and understand request
  • Read PR diff and changed files
  • Review check-skill.sh logic
  • Review check-skill.test.sh coverage
  • Review SKILL.md documentation
  • Review CHANGELOG.md and plugin.json

The re-scope rationale is sound — the "cache IS a git checkout" claim in the audit report is falsified by both the docs and on-disk evidence, and the decision not to auto-resolve the internal <marketplace>/<plugin>/<version> path is correct portability gatekeeping. The change is well-targeted.

check-skill.sh

Minor — indentation inconsistency in the multiline err string.
The continuation lines inside the double-quoted err call use 4 spaces of leading whitespace for the command example, then 2 spaces for the prose sentence. Since err emits everything via printf 'FAIL: %s\n', those literal spaces appear in the terminal output and look uneven:

FAIL: Skill not found: 'source-control:setup'. ... point the root at its installed skills dir:
    CHECK_SKILL_SKILLS_ROOT=...   ← 4 spaces
  The cache is a copy...          ← 2 spaces

Both continuation lines should use a consistent indent (2 or 4 spaces). Fix this →

Permalink: check-skill.sh#L169-L171


Observation — inline comment block weight.
Lines 155–166 add a 12-line comment block explaining why the cache layout is not auto-resolved. The WHY is genuinely non-obvious and worth preserving, but this is notably heavier than the one- or two-liner comments above each other check in the same file. No change required, just worth noting if the style is ever consolidated.


Logic correct. Leaf extraction via ${SKILL_NAME##*:} is correct (strips the longest prefix matching *:, so a:b:c → c). The exit 1 after err is consistent with the existing "SKILL.md not found" early-exit pattern. The FAILED counter increment inside err is never printed in the early-exit path (summary block is skipped), but that's identical to the prior behavior for the "SKILL.md not found" path, so no regression.


check-skill.test.sh

The new tests are well-placed and cover the right paths. Test 4a confirms the CHECK_SKILL_SKILLS_ROOT hint for a bare missing name; 4b confirms exit 1, the plugin:skill name phrase, the cache path hint, and the leaf echo.

Minor observation — test 4b's leaf assertion is somewhat loose. grep -q 'setup' confirms the word setup appears somewhere in the output, but it would pass even if the leaf appeared in unrelated prose. A tighter check — e.g. grep -q 'check-skill.sh setup' — would pin that the leaf appears specifically in the suggested invocation command. Low risk in practice (the error message is short and controlled), but worth considering.

Permalink: check-skill.test.sh#L116


Style cleanup in the run function and the two other command blocks is a net improvement. Moving && to the end of the continuing line (rather than using \ continuation + leading &&) is standard shell style and reads more clearly.


SKILL.md

Documentation is clear, accurate, and correctly emphasizes the "copy, not a git checkout" property. The example command uses ${CLAUDE_PLUGIN_ROOT} (correct plugin-form variable) and a <marketplace>/<plugin>/<version> placeholder (correct, since the exact path is undocumented). The note that checks 3/8/9 no-op there is directly useful for operators who'd otherwise be confused by a "new skill / skipped" result.


CHANGELOG.md

Cosmetic — two consecutive blank lines at the end of the 0.10.0 scope-note paragraph (lines 30–31). Keep a Changelog's format doesn't require them; a single blank line before the next bullet is standard.

Permalink: CHANGELOG.md#L30-L31

The scope note is appropriate to include — the falsification of the audit finding is load-bearing context for anyone who reads this entry and then looks at #1152. Worth keeping.


plugin.json

Minor bump to 0.10.0 is correct. This is a user-facing behavior change (new error messages, new SKILL.md section), so a minor bump is appropriate over a patch.


Summary

The change is correct, well-scoped, and ships with appropriate test coverage and documentation. Two cosmetic fixes (indentation in the err string, double blank lines in CHANGELOG) and one optional test tightening are the only things to consider before merge. No correctness or security issues found.

@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

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


Security Review

  • Gather PR diff and changed files
  • Review shell scripts for injection surfaces
  • Review SKILL.md for sensitive data exposure
  • Review plugin.json and CHANGELOG.md
  • Report findings

Finding 1 — SUGGESTION · Confidence: Medium

Unquoted user-supplied value echoed in a copy-paste example command

check-skill.sh line 170

leaf="${SKILL_NAME##*:}"
err "Skill not found: '$SKILL_NAME'. …
    CHECK_SKILL_SKILLS_ROOT=~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/skills bash check-skill.sh $leaf
  …"

$leaf is derived directly from the CLI argument $1 with no sanitization. It is embedded unquoted in a multi-line string that the user is expected to copy-paste into a shell. If the argument contains shell metacharacters — e.g. plugin:setup && rm -rf ~ — the err output would read as a valid shell command sequence:

CHECK_SKILL_SKILLS_ROOT=~/.claude/plugins/cache/…/skills bash check-skill.sh setup && rm -rf ~

A user who blindly pastes the error message would execute the injected payload.

Mitigating factors that keep this at SUGGESTION rather than IMPORTANT:

  • The attacker must control the argument the victim passes to the script — a somewhat contrived pre-condition.
  • The victim must also paste the error output without reading it.

Fix: wrap $leaf in shell-safe single quotes inside the example command, and escape any single quotes within $leaf:

safe_leaf="${leaf//\'/\'\\\'\'}"   # escape embedded single quotes
err "… bash check-skill.sh '$safe_leaf' …"

Or use printf '%q' to let bash produce the safest quoting:

err "… bash check-skill.sh $(printf '%q' "$leaf") …"

Fix this →


No other security issues found

The remaining changes are safe:

  • err() / printf format string — printf 'FAIL: %s\n' "$*" uses a fixed format literal; $* is the data argument. No format-string injection is possible.
  • Path construction (SKILL_DIR="$SKILLS_ROOT/$SKILL_NAME") — a : in SKILL_NAME produces an invalid filesystem path; the [[ ! -d "$SKILL_DIR" ]] guard triggers before any git command can run on that path, and the script exits 1 cleanly.
  • Test additions — use grep -q with herestrings (<<<"$out"), no untrusted execution.
  • SKILL.md — documentation only; no executable surface.
  • plugin.json — version bump only.
  • CHANGELOG.md — documentation only.

@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: 5d84b3d103

ℹ️ 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".

…ty fixes

- CHANGELOG: restore the `## [0.9.0]` section header the 0.10.0 edit
  accidentally consumed (the check-3 move-exception entry had merged under
  0.10.0); also clears the MD012 consecutive-blank hygiene failure.
- plugin:skill guidance: point the rerun command at
  ${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh (Codex P2 — a bare
  check-skill.sh isn't on PATH from a consumer project cwd).
- plugin:skill guidance: %q-escape the suggested leaf (Codex P2 — a
  malformed name whose leaf carries shell syntax must not become an
  executable substitution when the operator pastes the command).
- Tests: assert the PLUGIN_ROOT-anchored command form and leaf paste-safety.

Co-Authored-By: Claude Fable 5 <[email protected]>
@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

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


Code Review

  • Gather context and understand request
  • Read PR diff (both commits: 5d84b3d + 0fb80ad fixup)
  • Review check-skill.sh changes
  • Review check-skill.test.sh coverage
  • Review SKILL.md documentation
  • Review CHANGELOG.md and plugin.json
  • Post findings

The fixup commit (0fb80ad) properly addresses both Codex P2 findings and the prior security review's Finding 1:

  • Rerun path fixed — bare check-skill.sh → "${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh", runnable from a consumer-project cwd.
  • Paste safety fixed — printf '%q' escaping for the leaf variable is in place; test 4c verifies a metachar leaf ($(touch pwn)) is escaped in the pasteable command and creates no file.
  • CHANGELOG restored — the double blank line / missing ## [0.9.0] header from the first review cycle is fixed.

Still open from the first review cycle

Cosmetic — indentation inconsistency in the multiline err string.

The command line and the prose sentence following it use different leading whitespace inside the double-quoted err argument. Since err emits via printf 'FAIL: %s\n' "$*", those literal spaces appear in terminal output:

FAIL: Skill not found: '...'. ...point the root at its installed skills dir:
    CHECK_SKILL_SKILLS_ROOT=...   ← 4 spaces
  The cache is a copy...          ← 2 spaces

Permalink: check-skill.sh#L173-L174

Align both continuation lines to the same indent (2 or 4 spaces). Fix this →


Minor — test 4b's leaf assertion is still loose.

grep -q 'setup' <<<"$out"

This passes if setup appears anywhere in the output, including unrelated prose. A tighter check pins the leaf to the suggested invocation specifically:

grep -qF 'check-skill.sh setup' <<<"$out"

Permalink: check-skill.test.sh#L117

Low risk in practice (the error message is short and controlled), but worth tightening. Fix this →


Everything else is correct

  • Logic: leaf extraction (${SKILL_NAME##*:}), q_leaf construction, exit 1 placement, and the err/FAILED counter behavior are all correct and consistent with the existing pattern.
  • SKILL.md: accurate, clear, cites the right doc URL, and correctly flags that checks 3/8/9 no-op on a cache path (expected, not a defect).
  • plugin.json: minor bump to 0.10.0 is appropriate for a user-visible behavior change.
  • Test 4c paste-safety check: The [[ -e "$TMP/pwn" ]] belt-and-suspenders guard is a solid addition.
  • CHANGELOG scope note: the falsification of the audit finding is load-bearing and worth keeping for anyone reading entry skill-quality: check resolves plugin-cache installs (plugin:skill) + HEAD keyword comparison for cache roots #1152.

Two cosmetic items (indentation, loose grep) before merge; no correctness or security issues.
| Branch

@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

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


Security Review

  • Gather context and understand request
  • Read PR diff and changed files
  • Review check-skill.sh injection surfaces and paste-safety
  • Review check-skill.test.sh test-side execution risks
  • Review SKILL.md, CHANGELOG.md, plugin.json
  • Report findings

The two security issues previously flagged (bare $leaf in the pasteable command line; bare check-skill.sh path requiring a specific cwd) were both fixed in 0fb80ad2. The current HEAD is clean. Details below.

Leaf injection — RESOLVED

check-skill.sh L171–174

q_leaf=$(printf '%q' "${SKILL_NAME##*:}")
err "… bash \"${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh\" $q_leaf …"

printf '%q' is the bash builtin for shell-safe quoting and is the correct tool here. A leaf like $(touch pwn) is quoted to \$\(touch\ pwn\) before it reaches the pasteable command line. The raw $SKILL_NAME still appears in the diagnostic prefix ('$SKILL_NAME') but that is display-only — it goes through printf 'FAIL: %s\n' "$*", so no execution path exists there.

Test 4c exercises this directly: passes x:$(touch pwn) as the argument, then asserts (a) the suggested command does not contain a bare $(touch pwn), (b) touch still appears (confirming the leaf is present in escaped form), and (c) $TMP/pwn was not created. The three-way assertion is tight enough to catch a regression that either drops the leaf entirely or leaves it unescaped.

${CLAUDE_PLUGIN_ROOT} path in suggested command — RESOLVED

The suggested rerun command uses \"${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh\" inside a double-quoted string, where \$ produces a literal $ in output. The rendered text the operator sees is "${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh" — a shell variable reference they expand at paste time in their own environment, not a bare script filename requiring a specific cwd.

Remaining surfaces — no issues found

Surface Verdict
err() format string — printf 'FAIL: %s\n' "$*" Fixed format literal; $* is data argument. No format-string injection.
$SKILL_DIR in else-branch message Display-only via printf '%s'. No execution.
git -C "$SKILL_DIR" rev-parse (L128) Path comes from $SKILLS_ROOT/$SKILL_NAME; a : in SKILL_NAME produces a non-existent path, which the [[ ! -d "$SKILL_DIR" ]] guard catches before any git invocation.
Test 4c run 'x:$(touch pwn)' Argument is passed as "$@" → "$1" → SKILL_NAME assignment. ${SKILL_NAME##*:} is a parameter expansion, not a subshell — the $(touch pwn) token is never executed.
SKILL.md, CHANGELOG.md, plugin.json Documentation and version bump only; no executable surface.

No security issues found in current HEAD

@kyle-sexton

Copy link
Copy Markdown
Member Author

Pre-merge CI classification — all required checks green, 0 failing / 0 pending.

  • Functional gates (hygiene, plugin-gate, skill-quality-gate, portability-lint, changelog-parity, pr-title, pr-issue-linkage, etc.): PASS. First push failed hygiene on MD012 (a CHANGELOG edit had merged the 0.9.0 section under 0.10.0 and left double blanks) — fixed in 0fb80ad by restoring the ## [0.9.0] header.
  • claude-review / claude-security-review: PASS this run (no ci: claude-review + claude-security-review workflows infra-fail instantly (0-1s, cost 0) on every attempt #1122 infra-fail observed).
  • Codex review: 2 P2 findings, both VALID and fixed (rerun command anchored at ${CLAUDE_PLUGIN_ROOT}/scripts/check-skill.sh; suggested leaf %q-escaped for paste-safety). Latest pass returned no new findings; both threads resolved.
  • Tests: check-skill.test.sh full suite green (incl. new bare-name-hint, plugin:skill-guidance, and leaf-escape assertions); shellcheck -x clean; self-check check PASS.

Scope note carried from the PR body: the originating report (#1152) is partly falsified — the plugin cache is a documented COPY, not a git checkout, so check 3's "new skill / skipped" on a cache path is correct behavior, not a bug. First-class installed-skill resolution deferred to #1166.

Merging per the standing drive-to-MERGED directive.

@kyle-sexton
kyle-sexton merged commit 0bf1a8a into main Jul 23, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the fix/1152-skill-quality-cache-resolution branch July 23, 2026 18:03
kyle-sexton added a commit that referenced this pull request Jul 23, 2026
…rd injection-block decision (#1173)

## Summary

Resolves the F3 finding from inbox item
`20260723-090435-melodic-session-plugins-audit` **as a re-scope: the
finding is a measurement artifact, verified three ways.** Reviewers
should read the re-scope before the diff.

**F3's premise ("2 of 3 marketplace skills fail the marketplace's own
gate → the gate isn't in CI") is false in this repo:**

1. **The CI gate already exists.** `skill-quality-gate`
(`.github/workflows/ci.yml`) runs `check-changed-skills.sh
origin/$BASE_REF` on every PR, invoking the skill-quality checker over
each changed skill. The "run the gate in CI over changed skills" ask was
already satisfied.
2. **Skill markdown IS gated in CI — by the hygiene lane, under repo
config.** `check-changed-skills.sh` deliberately skips markdownlint
(`CHECK_SKILL_SKIP_MARKDOWNLINT=1`, documented division of labor); the
hygiene lane lints all repo markdown incl. SKILL.md under
`.markdownlint-cli2.jsonc`. (It caught a real MD012 on PR #1167 this
session.)
3. **`planning:interview` passes under repo config** —
`skill-quality:check interview` with the repo's config → **0 errors, 2
warnings** (264-line hub soft-cap; no `Use when:` phrasing). The
producer's MD041/MD013/MD060 FAILs are exactly the rules
`.markdownlint-cli2.jsonc` disables — i.e. from linting without repo
config.

**What ships (doc-only):** a `check` SKILL.md gotcha that encodes the
deliberate decision the report asked for and prevents the recurring
false alarm:
- Check 6 (markdownlint) defers to the consuming repo's markdownlint
config, discovered from the cwd. Running from outside the repo, or
against a plugin-cache install (no config), applies markdownlint
DEFAULTS → spurious MD013/MD041/MD060 on skills that pass in-repo. This
is the usual "shipped skill fails the gate" report.
- **Injection blocks are not special-cased**: a declared `shell:` block
with long lines is MD013-subject like any content; whether it fails is
the consumer markdownlint config's call, never overridden by this gate.
- Documents this marketplace's CI division of labor (skill-quality gate
skips markdownlint; hygiene lane lints markdown under repo config).

**Deferred (noted, not bundled):** the two advisory WARNs on
`planning:interview` (264-line hub → progressive-disclosure split; add
`Use when:` phrasing) are real but optional, live in a different plugin,
and a description edit risks trigger drift. Left for planning-plugin
maintenance; happy to file if wanted.

skill-quality **0.10.1** (doc-only; no behavior change).

## Test plan

- [x] Repro: `CHECK_SKILL_SKILLS_ROOT=plugins/planning/skills
check-skill.sh interview` from repo root → PASS (0 errors, 2 warnings) —
confirms the producer's FAILs were a wrong-config artifact.
- [x] Self-check: `skill-quality:check check` PASS (0 errors, 0
warnings); SKILL.md 141/500 lines.
- [x] `markdownlint-cli2` (repo config) clean on both changed files.

## Related

- Inbox item `20260723-090435-melodic-session-plugins-audit` finding F3
(falsified — see Summary).
- Companion audit issues: #1151 (merged), #1152 (merged), #1154.
- CI gate already in place: `skill-quality-gate` job in
`.github/workflows/ci.yml`.

Closes #1153

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <[email protected]>
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.

skill-quality: check resolves plugin-cache installs (plugin:skill) + HEAD keyword comparison for cache roots

1 participant