Skip to content

ci: frontmatter validation parses the whole file via sed; rule globs and alwaysApply never validated #293

Description

@TMHSDigital

Why it matters

The rules only work if Cursor parses their frontmatter. As CLAUDE.md puts it, "changing a glob changes when the rule fires". The validator doesn't parse that frontmatter as YAML: it greps a sed range that can run past the header, and it never looks at globs or alwaysApply.

Evidence

  • validate.yml:50, :77, :100: sed -n '/^---$/,/^---$/p' prints every ----delimited range in the file, not just the leading frontmatter. A Markdown horizontal rule (---) in a skill or rule body can satisfy a missing required key, or confuse the skill-name check.
  • validate.yml:89-114 (rules): checks only description: and standards-version:. alwaysApply and globs are never read, so a typo such as alwaysapply: false or a malformed glob passes.
  • All 9 rules/*.mdc write globs as a YAML list:
    globs:
      - "**/*.py"
    Cursor's documented .mdc form is a comma-separated string (globs: **/*.py). There are community reports of list-valued globs not triggering auto-attach. Not verified in Cursor for this repo. Please confirm in a Cursor session before changing anything.

Suggested approach

  1. Replace the sed/grep checks with a small Python step that takes only the first frontmatter block (text.split('---', 2)[1]), parses it with yaml.safe_load, and asserts the required keys and types: alwaysApply is a bool, and globs is a str or list of str matching the shape Cursor accepts.
  2. Verify glob triggering in Cursor: open a .py file and confirm that prefer-data-over-ops-in-loops attaches. If lists don't work, convert all 9 rules and have the validator enforce the string form.

Done when

  • Frontmatter is parsed as YAML from the header only, with a falsifier: a body --- no longer masks a missing key.
  • globs and alwaysApply are validated.
  • The Cursor glob format is confirmed working and recorded in CONTRIBUTING.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions