Skip to content

feat(checks): add empty-body rule#18

Merged
protosphinx merged 1 commit into
mainfrom
bot/empty-body-check
May 17, 2026
Merged

feat(checks): add empty-body rule#18
protosphinx merged 1 commit into
mainfrom
bot/empty-body-check

Conversation

@protosphinx
Copy link
Copy Markdown
Member

Why

A skill file with valid frontmatter but no body gives Claude nothing to act on. The skill will be selected based on its description, then fail silently because there are no instructions to execute. This closes a gap in the rule set: every other authoring mistake (bad schema, wrong tool refs, trigger collisions) is caught, but a completely empty body slipped through.

What

  • src/checks.ts: adds checkEmptyBody(v), called in the main runChecks loop after schema validation. Fires warn / empty-body when v.body.trim().length === 0. Runs only on validated skills, so a schema-broken skill does not also get an empty-body warning.
  • src/sarif.ts: registers empty-body in the static RULES catalog so GitHub Code Scanning shows a stable description and severity rather than falling back to the synthetic entry.
  • test/checks.test.ts: four new cases covering empty string body, whitespace-only body, body with content (no warning), and invalid frontmatter with empty body (no warning).

Tests

  • warns when skill body is empty: passes "" as body, expects empty-body diagnostic.
  • warns when skill body is whitespace only: passes " \n\n " as body, expects empty-body diagnostic.
  • does not warn on empty-body when body has content: verifies no false positive for a normal skill.
  • does not fire empty-body when frontmatter is invalid: verifies the check is skipped when schema validation failed (the loop already continues past such skills).

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (added + removed)
  • no public-API surface change
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended

Generated by Claude Code

Warns when a skill file has valid frontmatter but no body content.
A body-less skill gives Claude nothing to act on at runtime, making
the skill silently useless. The check runs after schema validation so
it only fires on otherwise well-formed skills.

Also registers the rule in the SARIF rule catalog so GitHub Code
Scanning shows a stable description and severity for this rule ID.
@protosphinx protosphinx added the automated Opened by the daily bot label May 17, 2026 — with Claude
@protosphinx protosphinx merged commit b6ba0ec into main May 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant