feat(checks): add effort-unknown check for skill frontmatter - #46
Conversation
Validates the optional effort: field against the five recognized reasoning effort levels: low, medium, high, xhigh, max. Emits a warn diagnostic when an unrecognized value is present, matching the style and gating of the existing model-unknown check. - src/checks.ts: KNOWN_EFFORT_LEVELS set, checkEffortUnknown function, wired into runChecks after checkModelUnknown - src/sarif.ts: effort-unknown entry in RULES catalog - test/checks.test.ts: 10 new cases covering all valid levels, absent, empty-string, message content, and invalid-frontmatter guard - README.md: new row in the rules table
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed46a681d1
ℹ️ 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".
| function checkEffortUnknown(v: ValidatedSkill): Diagnostic[] { | ||
| const effort = v.frontmatter.effort; | ||
| if (effort === undefined) return []; | ||
| if (typeof effort !== "string" || effort.length === 0) return []; |
There was a problem hiding this comment.
Report invalid non-string and empty effort values
When otherwise-valid frontmatter contains effort: 123, effort: {}, or effort: "", the passthrough schema accepts it and this guard returns without a diagnostic. These values are not among the five recognized levels and will silently fall back at runtime—the exact authoring error this rule is intended to catch—so only an absent field should bypass the check; present values of the wrong type or an empty string should produce effort-unknown (or a schema error).
Useful? React with 👍 / 👎.
Present but invalid effort values (numbers, objects, empty string) were silently skipped. Only an absent field should bypass the check; any present value that is not one of the five recognized levels is an authoring error and should produce an effort-unknown diagnostic. Add two new test cases (number, object) and update the empty-string test to expect a warning. Badge updated: 87 -> 89 passing.
Why
Skill YAML files can include an
effort:frontmatter field that controls reasoning effort in the Claude Code runtime. There is currently no validation that the value is one of the recognized levels (low,medium,high,xhigh,max). An unrecognized value silently falls back to default behavior, which can be confusing during authoring.What
KNOWN_EFFORT_LEVELSconstant andcheckEffortUnknown()function insrc/checks.tsrunChecks()aftercheckModelUnknown()effort-unknownSARIF rule entry insrc/sarif.tssrc/schema.tsandsrc/index.tsare not touched;effortis read from the passthroughRecord<string, unknown>onv.frontmatterso the public API surface is unchanged.Tests
10 new tests in
test/checks.test.tsinside the existingdescribe("runChecks")block.Self-merge gate
src/index.ts.github/workflows/*changesGenerated by Claude Code