feat(checks): add empty-body rule#18
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: addscheckEmptyBody(v), called in the mainrunChecksloop after schema validation. Fireswarn / empty-bodywhenv.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: registersempty-bodyin the staticRULEScatalog 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, expectsempty-bodydiagnostic.warns when skill body is whitespace only: passes" \n\n "as body, expectsempty-bodydiagnostic.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 alreadycontinues past such skills).Self-merge gate
Generated by Claude Code