Huang-404-Q dff39dec77
fix(skills): align skill-creator validation with the runtime schema (#7180)
* fix(skills): align skill-creator validation with the runtime schema

quick_validate.py rejected skills the runtime accepts and accepted skills
the runtime drops:

- Read SKILL.md with utf-8-sig so a BOM-prefixed file (Windows editors)
  is not reported as missing frontmatter.
- Allow the DeerFlow frontmatter fields (argument-hint, required-secrets,
  secrets-autonomous, version, author) that the runtime schema accepts.
- Reject empty name/description, which the loader drops.
- Validate required-secrets/secrets-autonomous shapes like the runtime
  validator, so a malformed declaration fails before packaging.

Tests cover each case in backend/tests/test_skill_creator_quick_validate.py.

* fix(skills): close the remaining skill-creator parity gaps

- Read SKILL.md with utf-8-sig in utils.parse_skill_md too, so a BOM file
  that quick_validate now accepts does not fail in run_eval/run_loop/
  improve_description.
- Stringify YAML keys before the unexpected-key check, so mixed non-string
  keys report cleanly instead of raising TypeError in sorted().
- Accept trailing whitespace on the frontmatter delimiters, matching the
  runtime parser.

Each case has a regression test that fails on the previous commit.

* fix(skills): validate allowed-tools and stop over-rejecting compatibility

The reviewer found two remaining parity gaps:

- allowed-tools was not validated, while the runtime parser rejects
  non-string list items, empty tool names, unmatched closing parentheses
  and unclosed quotes. Mirror those shape rules.
- compatibility was rejected for non-string or >500-char values, but the
  runtime validator never inspects it. Drop the check so this script does
  not reject skills the runtime accepts.

Each case has a regression test that fails on the previous commit.

* fix(skills): reject unclosed parenthesized allowed-tools patterns

The runtime parser raises when the scan ends with depth > 0; the
quick_validate loop only checked for an unmatched closing parenthesis.
Add the depth check and move the unclosed-pattern case to the rejected
tests.
2026-10-22 09:24:04 +08:00
..
2026-01-30 22:02:07 +08:00