feat(skills): add --relaxed flag to ease skill packaging checks #177

Merged
CoreRasurae merged 1 commit from feature/m1-skill-packer-relaxed-mode into develop 2026-11-20 10:38:30 +00:00
Member

Summary

  • Add a --relaxed flag to utils/pack_skill.py that eases exactly two checks while iterating on a draft skill: the 1024-character maximum on description is not enforced, and unsupported SKILL.md frontmatter keys are tolerated and passed through instead of raising. Every other check stays exactly as strict as today.
  • Threaded as an explicit, opt-in relaxed keyword argument through SkillDirectoryPacker.pack and SkillValidator.validate, so strict validation remains the unconditional default for every other caller.
  • Since a relaxed-packed skill must still round-trip through unpack_skill.py, the same --relaxed flag and the same two relaxed checks are threaded through SkillDirectoryUnpacker as well. An unsupported top-level field now survives the round trip via a new Skill.extra_fields, populated only under relaxed validation and re-emitted into the written SKILL.md frontmatter.

Test plan

  • nox -s lint — green
  • nox -s format -- --check — green
  • nox -s typecheck — green (0 errors)
  • nox -s security_scan — green (bandit + semgrep, 0 findings)
  • nox -s dead_code — green
  • nox -s unit_tests — 159 features, 3340 scenarios, 15381 steps passed
  • nox -s coverage_report — 97.3% (threshold 96.5%)
  • New Behave scenarios cover: relaxed description length (pack + unpack), relaxed unknown frontmatter key pass-through and round-trip, and confirmation that every other rejection still fires under --relaxed (reserved field, allowed-tools conflict, minimum description length)

Closes #171

## Summary - Add a `--relaxed` flag to `utils/pack_skill.py` that eases exactly two checks while iterating on a draft skill: the 1024-character maximum on `description` is not enforced, and unsupported `SKILL.md` frontmatter keys are tolerated and passed through instead of raising. Every other check stays exactly as strict as today. - Threaded as an explicit, opt-in `relaxed` keyword argument through `SkillDirectoryPacker.pack` and `SkillValidator.validate`, so strict validation remains the unconditional default for every other caller. - Since a relaxed-packed skill must still round-trip through `unpack_skill.py`, the same `--relaxed` flag and the same two relaxed checks are threaded through `SkillDirectoryUnpacker` as well. An unsupported top-level field now survives the round trip via a new `Skill.extra_fields`, populated only under relaxed validation and re-emitted into the written `SKILL.md` frontmatter. ## Test plan - [x] `nox -s lint` — green - [x] `nox -s format -- --check` — green - [x] `nox -s typecheck` — green (0 errors) - [x] `nox -s security_scan` — green (bandit + semgrep, 0 findings) - [x] `nox -s dead_code` — green - [x] `nox -s unit_tests` — 159 features, 3340 scenarios, 15381 steps passed - [x] `nox -s coverage_report` — 97.3% (threshold 96.5%) - [x] New Behave scenarios cover: relaxed description length (pack + unpack), relaxed unknown frontmatter key pass-through and round-trip, and confirmation that every other rejection still fires under `--relaxed` (reserved field, `allowed-tools` conflict, minimum description length) Closes #171
CoreRasurae added this to the v2.1.0 milestone 2026-11-19 19:16:33 +00:00
feat(skills): add --relaxed flag to ease skill packaging checks
Some checks failed
CI / lint (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m23s
CI / security (pull_request) Successful in 1m50s
CI / build (pull_request) Successful in 1m58s
CI / quality (pull_request) Successful in 2m17s
CI / integration_tests (pull_request) Successful in 4m5s
CI / unit_tests (pull_request) Successful in 7m32s
CI / benchmark (pull_request) Failing after 33m23s
CI / coverage (pull_request) Successful in 5m28s
CI / status-check (pull_request) Successful in 2s
318b0a8baf
Add a --relaxed CLI flag to pack_skill.py that eases the 1024-character
description maximum and the unsupported-frontmatter-field check while
iterating on a draft skill. Every other validation rule stays exactly
as strict as today, so --relaxed cannot be used to smuggle a genuinely
invalid skill past review.

A skill packed with --relaxed must still round-trip through
unpack_skill.py, so the same flag and the same two relaxed checks are
threaded through SkillDirectoryUnpacker as well; an unsupported
top-level field survives the round trip via a new Skill.extra_fields
carried only under relaxed validation.

Both flags are explicit, opt-in keyword arguments on
SkillDirectoryPacker.pack, SkillDirectoryUnpacker.unpack, and
SkillValidator.validate rather than a global switch, so strict
validation remains the unconditional default for every other caller
(e.g. agent skill loading, ADR-2034 D-5).

ISSUES CLOSED: #171
hurui200320 left a comment

PR Review: !177 (Ticket #171)

Verdict: Approve

Single atomic commit matching the ticket's Metadata (message, branch) exactly. The implementation satisfies the ticket's core requirements: --relaxed eases exactly the two specified checks (description max-length, unknown frontmatter keys), is opt-in and threaded explicitly through SkillDirectoryPacker.pack, SkillValidator.validate, and SkillDirectoryUnpacker.unpack, while every other caller (agent skill loading via skills.py:239, the pack_skill_directory facade) keeps unconditional strict validation. Reserved-field, allowed-tools-conflict, min-length, name, resource-path, and safe_mode checks all fire before/ independently of the relaxed bypass. _RESOLVER_METADATA_KEYS are correctly excluded from extra_fields, so registry-internal keys never leak into SKILL.md and Package ID computation is consistent; the round-trip Package-ID stability scenario passes. to_context_dict() deliberately excludes extra_fields, so unknown draft data cannot leak into LLM context. Docs and CHANGELOG updated. Verified locally: both affected feature files pass (85 scenarios / 317 steps green); full suite and coverage (97.3% ≥ 96.5 configured threshold) green per the PR report. No prior review comments existed; nothing was ruled out-of-scope by the author. Red-tape items (labels etc.) excluded per reviewer instruction.

Only minor issues below — none blocks merge, but the two accuracy fixes are cheap and worth doing before merge.

Critical Issues

None

Major Issues

None

Minor Issues

  1. Inaccurate claim that strict unpack "fails" on unsupported top-level fields — docs/guides/skill-packages.md:350-352 and src/cleveractors/agents/skill_unpacker.py:257.
    The new guide text says unsupported top-level fields are written back "instead of raising a validation error" and that "without --relaxed an over-long description or an unsupported field still fails exactly as before". Empirically false (verified by running the code): SkillValidator has no unknown-key rejection, so strict unpack of a package mapping containing e.g. author: acme succeeds and silently drops the field. Only the over-long description fails strictly. Recommendation: reword to "instead of being silently dropped" and scope the "still fails" sentence to the description-length case only. Same correction in the SkillDirectoryUnpacker.unpack docstring.

  2. Strict-mode error message reworded, contra the ticket's "byte-for-byte unchanged" criterion — src/cleveractors/agents/skill_schema.py:315-324 (_validate_length).
    Old: must be 1-1024 characters, got 2000; new: must be at least 1 characters (max: 1024), got 2000. The rewording also changes compatibility failures (max 500). The ticket requires: "Without --relaxed, CLI behavior is byte-for-byte unchanged from today" and ">1024-character description still fails exactly as today" — failure/exit code are unchanged, but the stderr text differs, and "at least 1 characters" is grammatically off. Recommendation: keep the exact old wording when max_len is not None and use the new phrasing only for the no-maximum case. No existing test asserted the old text, so nothing breaks either way.

  3. Test gap vs the ticket's explicit acceptance criteria for unaffected checks under --relaxed — features/skill_directory_packages.feature, features/skill_directory_unpacking.feature.
    The ticket asks for scenarios confirming that every other rejection still fires under --relaxed, enumerating name, resource paths, safe_mode type, compatibility length, and allowed-tools conflict. Only three are covered (min description length, reserved field, allowed-tools conflict); invalid name pattern, invalid resource path, non-bool safe_mode, and over-long compatibility are not exercised under --relaxed, and there is no scenario for --relaxed combined with --check/--output. Structurally these paths cannot be affected by the flag, so risk is nil — but the scenarios are one-liners and would close the acceptance criteria exactly.

Nits

  1. src/cleveractors/agents/skill_schema.py:207-209 — the relaxed docstring on SkillValidator.validate mentions only the description max-length; under relaxed it also populates Skill.extra_fields (round-trip data). Worth one sentence.
  2. src/cleveractors/agents/skill_unpacker.py:107-110 — the comment claims extra fields are "disjoint from every key set above, so this cannot clobber a known field". True for validator-produced Skills, but a directly constructed Skill(extra_fields={"name": ...}) would clobber rendered frontmatter because fields.update() runs last. Consider noting the precondition (or guarding).

Summary

A clean, well-scoped feature that implements ticket #171 faithfully and extends it sensibly (unpack-side --relaxed with Skill.extra_fields round-trip, documented in the PR description). Correctness of the two relaxed checks, preservation of all other checks, strict-by-default for other callers, and Package ID round-trip stability are all verified — by new Behave scenarios and by a local run of the affected feature files. The findings above are documentation/message accuracy and cheap test additions; none affects behavior. Approve.

## PR Review: !177 (Ticket #171) ### Verdict: Approve Single atomic commit matching the ticket's Metadata (message, branch) exactly. The implementation satisfies the ticket's core requirements: `--relaxed` eases exactly the two specified checks (description max-length, unknown frontmatter keys), is opt-in and threaded explicitly through `SkillDirectoryPacker.pack`, `SkillValidator.validate`, and `SkillDirectoryUnpacker.unpack`, while every other caller (agent skill loading via `skills.py:239`, the `pack_skill_directory` facade) keeps unconditional strict validation. Reserved-field, allowed-tools-conflict, min-length, name, resource-path, and safe_mode checks all fire before/ independently of the relaxed bypass. `_RESOLVER_METADATA_KEYS` are correctly excluded from `extra_fields`, so registry-internal keys never leak into `SKILL.md` and Package ID computation is consistent; the round-trip Package-ID stability scenario passes. `to_context_dict()` deliberately excludes `extra_fields`, so unknown draft data cannot leak into LLM context. Docs and CHANGELOG updated. Verified locally: both affected feature files pass (85 scenarios / 317 steps green); full suite and coverage (97.3% ≥ 96.5 configured threshold) green per the PR report. No prior review comments existed; nothing was ruled out-of-scope by the author. Red-tape items (labels etc.) excluded per reviewer instruction. Only minor issues below — none blocks merge, but the two accuracy fixes are cheap and worth doing before merge. ### Critical Issues None ### Major Issues None ### Minor Issues 1. **Inaccurate claim that strict unpack "fails" on unsupported top-level fields** — `docs/guides/skill-packages.md:350-352` and `src/cleveractors/agents/skill_unpacker.py:257`. The new guide text says unsupported top-level fields are written back "instead of raising a validation error" and that "without `--relaxed` an over-long description or an unsupported field still fails exactly as before". Empirically false (verified by running the code): `SkillValidator` has no unknown-key rejection, so strict unpack of a package mapping containing e.g. `author: acme` **succeeds and silently drops the field**. Only the over-long description fails strictly. Recommendation: reword to "instead of being silently dropped" and scope the "still fails" sentence to the description-length case only. Same correction in the `SkillDirectoryUnpacker.unpack` docstring. 2. **Strict-mode error message reworded, contra the ticket's "byte-for-byte unchanged" criterion** — `src/cleveractors/agents/skill_schema.py:315-324` (`_validate_length`). Old: `must be 1-1024 characters, got 2000`; new: `must be at least 1 characters (max: 1024), got 2000`. The rewording also changes `compatibility` failures (max 500). The ticket requires: "Without `--relaxed`, CLI behavior is byte-for-byte unchanged from today" and ">1024-character description still fails exactly as today" — failure/exit code are unchanged, but the stderr text differs, and "at least 1 characters" is grammatically off. Recommendation: keep the exact old wording when `max_len is not None` and use the new phrasing only for the no-maximum case. No existing test asserted the old text, so nothing breaks either way. 3. **Test gap vs the ticket's explicit acceptance criteria for unaffected checks under `--relaxed`** — `features/skill_directory_packages.feature`, `features/skill_directory_unpacking.feature`. The ticket asks for scenarios confirming that *every* other rejection still fires under `--relaxed`, enumerating name, resource paths, safe_mode type, compatibility length, and allowed-tools conflict. Only three are covered (min description length, reserved field, allowed-tools conflict); invalid name pattern, invalid resource path, non-bool `safe_mode`, and over-long `compatibility` are not exercised under `--relaxed`, and there is no scenario for `--relaxed` combined with `--check`/`--output`. Structurally these paths cannot be affected by the flag, so risk is nil — but the scenarios are one-liners and would close the acceptance criteria exactly. ### Nits 1. `src/cleveractors/agents/skill_schema.py:207-209` — the `relaxed` docstring on `SkillValidator.validate` mentions only the description max-length; under relaxed it also populates `Skill.extra_fields` (round-trip data). Worth one sentence. 2. `src/cleveractors/agents/skill_unpacker.py:107-110` — the comment claims extra fields are "disjoint from every key set above, so this cannot clobber a known field". True for validator-produced Skills, but a directly constructed `Skill(extra_fields={"name": ...})` would clobber rendered frontmatter because `fields.update()` runs last. Consider noting the precondition (or guarding). ### Summary A clean, well-scoped feature that implements ticket #171 faithfully and extends it sensibly (unpack-side `--relaxed` with `Skill.extra_fields` round-trip, documented in the PR description). Correctness of the two relaxed checks, preservation of all other checks, strict-by-default for other callers, and Package ID round-trip stability are all verified — by new Behave scenarios and by a local run of the affected feature files. The findings above are documentation/message accuracy and cheap test additions; none affects behavior. Approve.
@ -329,0 +349,4 @@
`description` is not enforced, and unsupported top-level fields are written
back into `SKILL.md`'s frontmatter instead of raising a validation error.
Every other check is unaffected, and without `--relaxed` an over-long
description or an unsupported field still fails exactly as before.
Member

Minor: inaccurate — verified empirically that strict unpack of a package mapping with an unsupported top-level field (e.g. author: acme) succeeds and silently drops the field; it does not fail. SkillValidator has no unknown-key rejection. Only the over-long description fails strictly. Same inaccuracy in the unpack docstring (skill_unpacker.py:257). Suggest: "...instead of being silently dropped" and scope the "still fails" claim to the description-length case.

Minor: inaccurate — verified empirically that strict unpack of a package mapping with an unsupported top-level field (e.g. `author: acme`) **succeeds and silently drops the field**; it does not fail. `SkillValidator` has no unknown-key rejection. Only the over-long description fails strictly. Same inaccuracy in the `unpack` docstring (skill_unpacker.py:257). Suggest: "...instead of being silently dropped" and scope the "still fails" claim to the description-length case.
@ -286,3 +319,3 @@
raise ValidationError(
f"Skill reference '{source_reference}' field '{field_name}' "
f"must be {min_len}-{max_len} characters, got {len(value)}",
f"must be at least {min_len} characters (max: {bound}), "
Member

Minor: this rewording changes strict-mode error messages too (description and compatibility), but the ticket requires strict CLI behavior to be "byte-for-byte unchanged" and failures to be "exactly as today". Suggest keeping the old wording when max_len is not None and using the new phrasing only for the no-maximum case. (Also: "at least 1 characters" reads off.)

Minor: this rewording changes strict-mode error messages too (description and compatibility), but the ticket requires strict CLI behavior to be "byte-for-byte unchanged" and failures to be "exactly as today". Suggest keeping the old wording when `max_len is not None` and using the new phrasing only for the no-maximum case. (Also: "at least 1 characters" reads off.)
CoreRasurae force-pushed feature/m1-skill-packer-relaxed-mode from 318b0a8baf
Some checks failed
CI / lint (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m23s
CI / security (pull_request) Successful in 1m50s
CI / build (pull_request) Successful in 1m58s
CI / quality (pull_request) Successful in 2m17s
CI / integration_tests (pull_request) Successful in 4m5s
CI / unit_tests (pull_request) Successful in 7m32s
CI / benchmark (pull_request) Failing after 33m23s
CI / coverage (pull_request) Successful in 5m28s
CI / status-check (pull_request) Successful in 2s
to e9f3aee83b
Some checks failed
CI / lint (pull_request) Successful in 1m15s
CI / quality (pull_request) Successful in 1m53s
CI / typecheck (pull_request) Successful in 2m54s
CI / build (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 2m59s
CI / integration_tests (pull_request) Successful in 3m26s
CI / unit_tests (pull_request) Successful in 8m14s
CI / coverage (pull_request) Successful in 6m59s
CI / status-check (pull_request) Successful in 1s
CI / benchmark (pull_request) Failing after 17m7s
CI / lint (push) Successful in 46s
CI / typecheck (push) Successful in 1m28s
CI / quality (push) Successful in 1m43s
CI / security (push) Successful in 2m7s
CI / build (push) Successful in 1m20s
CI / integration_tests (push) Successful in 2m58s
CI / unit_tests (push) Successful in 7m19s
CI / coverage (push) Successful in 6m56s
CI / status-check (push) Successful in 1s
CI / benchmark (push) Failing after 27m56s
2026-11-20 10:05:13 +00:00
Compare
CoreRasurae deleted branch feature/m1-skill-packer-relaxed-mode 2026-11-20 10:38:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveractors-core!177
No description provided.