Files
trailofbits__skills/.github
Dan Guido f3c8d2a73f Back three AGENTS.md enforcement claims with validator checks (#253)
* Back three AGENTS.md enforcement claims with validator checks

AGENTS.md lists these under "What the validator enforces, so you do not
have to", the heading that tells contributors and Claude to skip checking
by hand. The validator did not perform any of them.

- Hardcoded `/Users/…` and `/home/…` paths: moved out of the CI workflow
  and into find_hardcoded_paths(), so `make check` and pre-commit cover it
  too. Python's re has lookbehind natively, which drops the `grep -P`
  dependency BSD grep cannot satisfy. Same file types, same `*-shim.bats`
  exemption and `/path/to` and `/home/vscode` placeholders as before, and
  the scan carries the anti-vacuity guard across: zero files scanned is a
  hard failure, not a clean result.
- Command files: validate_agent_frontmatter() only ever opened agent and
  skill files, so the "and commands" half of the allowed-tools claim was
  unbacked. Renamed to validate_tools_frontmatter() now that it covers all
  three.
- subagent_type: the check returned early for a plugin with no agents/ dir
  and otherwise only flagged a bare name matching that plugin's own agent.
  It now resolves against a repo-wide agent registry, so a bare name
  borrowed from another plugin reports that plugin's namespace, and one
  that names no agent at all is reported as a dispatch that fails at
  runtime.

Also documents three checks the validator already enforced but AGENTS.md
never listed: plugin.json name matching the directory, marketplace source
and description parity, and dependabot lockfiles.

All three flag zero violations against the repo as it stands, verified by
planting each defect and confirming the validator rejects it. Self-test
goes from 34 assertions to 43, and SELF_TEST_MINIMUM is now the exact
count rather than a loose floor.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Catch lowercase home directories in the hardcoded-path check

The pattern inherited from the CI step matched `/home/[a-z]` but
`/Users/[A-Z]`, so it only caught macOS paths whose account name starts
with a capital. Account short names are lowercase by convention, which
means the common form went undetected: `/Users/alice/...`, and this
repo's own `/Users/user/cc/skills`, all passed clean.

The check was missing the thing it exists to find, and my mutation test
did not catch that because I happened to plant `/Users/Someone` with a
capital S — the one spelling the pattern could see.

Both branches now accept either case. Widening turned up exactly one new
match across the repo, and it is a false positive: c-review's SKILL.md
uses "/Users/me/My Repo" to show that a path containing a space has to
stay quoted. That and `/Users/Shared`, a real macOS system directory,
join the placeholder list.

Self-test goes 43 -> 45: the lowercase path must be caught, and
`/Users/Shared` must not be.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 20:35:36 -04:00
..