Skip to content

quality_score.py keyword checks match bare substrings, so some rules fire on correct content and others cannot fail #30

Closed

Description

@shi-eric

Several checks in quality_score.py test for a keyword with in or re.search against a bare substring, so they match inside unrelated words. This fails in both directions. Some rules deduct points from skills that did nothing wrong, and others can never fail at all, because a common word somewhere else in the document satisfies them.

This turned up while publishing a skill, so the rest of the file was checked for the same pattern. Ten rules deduct on correct content, four cannot fail, and one length cap pulls against the section skeleton the other dimensions ask for.

How this was checked

The repo was cloned at cd12830 and QualityScoreValidator().validate(path) was run directly, changing one thing at a time. No other validators were involved. Python 3.13, Linux.

The baseline skill:

---
name: compile-time-probe
description: Use this when you need to map kernel to module to build and find redundant builds.
version: 0.1.0
metadata:
  author: Example
  tags:
    - performance
---

## Purpose

Measure compile time.

## Instructions

- Run the probe.
- Read the report.

## Examples

```bash
probe measure -- python app.py
```

## Limitations

None known.

## Troubleshooting

Check the output directory.

It scores 98.8 (A) with one unrelated finding, "No prerequisites/requirements documented", which every row below also carries. The Finding column shows only what each change added.

Change from the baseline Score Finding added
nothing (baseline) 98.8
description writes kernel -> module instead of kernel to module 93.5 Description contains XML tags
description says cut rebuild cost by >30% 93.5 Description contains XML tags
name: philanthropic-grant-matcher 93.5 Name contains reserved word (anthropic, claude)
description says dummy data fixtures 95.0 Description uses first/second person
body says This skill does not use MCP. 96.2 MCP skill lacks connection/error guidance
body says Unrolling stops after 2048 iterations. 98.0 Time-sensitive information detected
body says replaces all deprecated launch calls 97.5 Skill uses exclusivity language
add a README.md, body says do not load it 97.0 SKILL.md references README.md
references/mechanisms.md links to an external SPEC.md URL 97.2 Deeply nested references
body says Read the output directory instead of Check ... 96.2 No mention of error handling

The second row and the last row are the two failure directions in one pair. Swapping the word to for -> in an otherwise identical sentence costs 5.3 points for containing XML tags. Swapping Check for Read in a sentence that has nothing to do with errors costs 2.6 points and flips the reported has_error_handling metric from true to false, on a skill that documents no error handling in either version.

The clearest cases

A > in the description is reported as a prompt-injection risk. The test is if desc and ("<" in desc or ">" in desc), and it deducts 15 at severity error with the message "Description contains XML tags". Any description that quotes a percentage, uses an arrow, or writes <1s takes the full penalty. The description is also the routing surface an agent sees first, so the rule pushes authors away from precise phrasing and toward vaguer wording, which the discoverability dimension then marks down on its own.

philanthropic contains anthropic. The reserved-name check is any(w in name.lower() for w in QUALITY_RESERVED_NAMES) and deducts 15 at severity error against correctness, the heaviest weighted dimension. The intent is presumably to stop a skill passing itself off as an Anthropic or Claude product, and a name is a fixed identifier, so the penalty follows the skill everywhere its score is reported.

Citing an external document counts as a nested reference. The check runs re.findall(r"\[[^\]]*\]\([^)]*\.md\)", rc) over every .md under references/ and does not distinguish a relative path from a URL, so a link to the Agent Skills spec on GitHub counts as a deeply nested reference, and so does a link back to ../SKILL.md. Grounding a reference file in the spec it implements is the behavior being penalized.

The MCP rule penalizes mentioning MCP. Any standalone mcp in SKILL.md classifies the skill as an MCP skill, and the only way out is one of connect, reconnect, retry, timeout, server.*running, api.*key appearing anywhere in the document, with no required relationship to the MCP mention. So a skill whose SKILL.md says "this skill does not use MCP" is treated as an MCP skill, and whether it loses 10 points depends on whether the unrelated word timeout happens to appear elsewhere. reconnect in that list is also unreachable, since re.search("connect", "reconnect") already matches, and connect matches interconnect, so a skill about GPU interconnect satisfies the MCP connection-guidance requirement.

We hit that last one for real and removed the term MCP from a skill to avoid the deduction, which made the document slightly less accurate and gained nothing.

Checks that cannot fail

These four accept a substring of a common word, so they pass on skills that lack the property outright. The error-handling row is in the table above. The other three come from evaluating the rule's own expression, since a check that passes emits nothing to point at.

Check Accepts Satisfied by
Lib API documentation import the word important
Error handling check Check the output directory.
Instruction action verbs use, run, set because, runtime, offset
Description when-to-use trigger for performance, format, before

"Because the offset is a runtime property, results vary" contains three action verbs and no imperative. api is also a substring of rapid.

Two places the code disagrees with itself

The README rule contradicts its own comment. The comment above it explains that an unreferenced README costs zero agent context and must not be penalized, and that the risk worth flagging is when SKILL.md links to README.md and pulls human-facing docs into the context window. _references_readme then matches README.md anywhere in the document, case-insensitive, so a SKILL.md saying "README.md is human-facing; do not load it" is penalized for pulling the README into context. The penalized sentence is the one an author would write to keep an agent out of the README.

Length is capped while six sections are required. Efficiency deducts 15 at severity error above 5000 estimated tokens, citing guidance that SKILL.md should be concise. The other three dimensions deduct for omitting ## Purpose, ## Instructions or ## Usage, example content, ## Limitations, ## Troubleshooting or ## Common Issues or ## FAQ, and an ## Available Scripts table, plus a literal run_script mention. Those two pressures are not irreconcilable, but an author gets pushed in both directions with nothing said about the tradeoff.

Why this matters left alone

The score is presented as a quality measure and consumed as one. Leaving these in has four costs.

Authors are pushed to change correct content. Every one of these findings names something other than the real cause, so the natural response is to edit the document until the finding goes away. Nothing in the output says "your separator is the problem", it says the description contains XML tags. The edit that clears it is always a wording change and never a quality change, and it can make the document worse, which is what happened with the MCP case above.

The metrics report things that are not true. has_error_handling: true on a skill that documents no error handling is a wrong value in a field other tooling can read. The four checks that cannot fail mean those dimensions are not measuring what their names claim, and nothing in the output distinguishes a skill that passed on merit from one that passed on the word important.

Scores stop being comparable. These deductions land on incidental word choice, so two skills of equal quality can differ by five or ten points based on whether one of them wrote a percentage or picked a name containing a common string. Any ranking, threshold, or catalog-wide comparison built on the score inherits that noise.

The failures are silent in the direction that matters. A false deduction is visible and annoying. A check that cannot fail is invisible, so a skill with genuinely undocumented errors and no real API documentation passes those checks and the report says so.

These are filed together because the substring cases share a cause. Splitting them into separate issues is fine if that suits triage better.

Activity

  1. chrisknvidia commented on Aug 6, 2026

    @chrisknvidia
    Collaborator

    Implemented in #45. The PR includes the full boundary/context regression matrix, real CLI report smoke tests, repository regression coverage, packaging, OSS-boundary, and security scans. It is open for review and has not been merged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions