Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ All notable changes to SkillEvaluator are documented in this file.
Custom plugin profiles report a clear error for an unsupported component
outcome or a missing top-level fact read during rule evaluation.

- Add `discoverability.name_too_short` to the `--quality-config` file. It sets
`points`, `message`, `suggestion` and `min_chars` for the check that a skill's
folder name has at least five characters, and `points: 0` turns it off.
Scores, deductions, severities and `finding_id`s do not change, because the
packaged message and suggestion are the same. The packaged `quality_config`
digest changes once. A custom file keeps its digest.

## 1.3.1 - 2026-11-30

- Stable PR comments can verify scans routed through an approved shared component.
Expand Down
19 changes: 18 additions & 1 deletion docs/tier1-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice
If a quality score changes unexpectedly, inspect the finding message rather than adding keywords. The checker rewards usable instructions and evidence in their relevant context, not vocabulary alone.
</Tip>

**Quality config file.** Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to adjust the rules below. The file has five optional sections: `expected_headers` and `error_handling` for Reliability, `efficiency` for the token budget, instruction wording, and reference filenames, `discoverability` for the description length limits and the description word lists, and `correctness` for reserved names and examples, script, API, and resource documentation. Anything you leave out keeps its packaged value from `quality-default.yaml`, and any list you set replaces the packaged list rather than merging with it.
**Quality config file.** Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to adjust the rules below. The file has five optional sections: `expected_headers` and `error_handling` for Reliability, `efficiency` for the token budget, instruction wording, and reference filenames, `discoverability` for the description length limits, the folder-name length limit and the description word lists, and `correctness` for reserved names and examples, script, API, and resource documentation. Anything you leave out keeps its packaged value from `quality-default.yaml`, and any list you set replaces the packaged list rather than merging with it.

The packaged prose and heading rules include English, Russian, and Chinese alternatives. Code markers and reserved identifiers reflect the code or naming policy they check. The same lists apply to every skill. Replace a configurable rule's list to tailor its vocabulary to a particular language.

Expand Down Expand Up @@ -690,6 +690,23 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice

The same character limits apply to Chinese and other languages, including the `broad_description.longer_than` threshold below. A concise Chinese description can fall below the packaged 20-character minimum even when it names a specific use. Adjust `description_too_short.min_chars` in your quality configuration for that corpus.

**Name length.** Discoverability deducts points when the skill's folder name is too short, set in the `discoverability` section under `name_too_short`. An omitted key keeps its packaged value and `points: 0` turns the rule off, so it adds no finding. This file lowers the minimum and changes nothing else:
Comment thread
westonplatter marked this conversation as resolved.
Resolved

```yaml title="quality.yaml"
discoverability:
name_too_short:
min_chars: 3
```

| `name_too_short` field | Packaged value | Meaning |
| --- | --- | --- |
| `min_chars` | `5` | A positive whole number. The rule deducts when the folder name has fewer characters than this; a name of exactly `min_chars` characters passes |
| `points` | `10` | Non-negative number deducted from Discoverability. `0` turns the rule off |
| `message` | `Skill name very short` | Start of the finding message |
| `suggestion` | `Use descriptive names like 'crypto-utils' not 'crypto'` | Fix suggestion attached to the finding |

The rule measures the skill's folder name, not the frontmatter `name`. The finding appends the folder name in single quotes to `message`, as in `Skill name very short: 'ab'`. The separate folder-name convention check is not configurable yet. It requires a lowercase first letter, then lowercase letters, digits, hyphens or underscores.

**Word lists.** The remaining keyword rules read their lists from the same file. Each rule takes `points`, `message`, `suggestion` and the list fields below; an omitted key keeps its packaged value, `points: 0` turns the rule off, and a list you set replaces the packaged list. Terms match as whole words or phrases in any case, with the same rules as `error_handling.mentioned.terms`. Many phrases match across a line break. Person phrases and broad-description exclusions use literal internal spacing. Han ideographs and Japanese kana match inside running text. Those characters also delimit English or Russian terms in mixed-script text.

```yaml title="quality.yaml"
Expand Down
7 changes: 7 additions & 0 deletions src/skillevaluator/config/quality-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ discoverability:
message: "No '## Purpose' section"
suggestion: "Add purpose section to clarify use cases"
headings: ["## Purpose", "## Назначение", "## Цель", "## 目的", "## 用途", "## 概述", "## 简介", "## 簡介"]
# The skill's folder name (not the frontmatter name) has fewer than min_chars characters.
# The finding appends the name, in single quotes, to the message.
name_too_short:
points: 10
message: "Skill name very short"
suggestion: "Use descriptive names like 'crypto-utils' not 'crypto'"
min_chars: 5

# Correctness rules. They overlay the same way as the sections above.
correctness:
Expand Down
11 changes: 11 additions & 0 deletions src/skillevaluator/quality_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ class DescriptionTooLongRule(TypedDict):
max_chars: int


class NameTooShortRule(TypedDict):
"""Deduction when the skill's folder name is shorter than min_chars."""

points: int | float
message: str
suggestion: str
min_chars: int


class DiscoverabilityConfig(TypedDict):
"""Discoverability rules; a rule with points 0 is skipped."""

Expand All @@ -157,6 +166,7 @@ class DiscoverabilityConfig(TypedDict):
person_phrases: TermsRule
broad_description: BroadDescriptionRule
purpose_heading: HeadingsRule
name_too_short: NameTooShortRule


class ReservedNameRule(TypedDict):
Expand Down Expand Up @@ -346,6 +356,7 @@ def _validate_positive_int(value: object, source: str, location: str) -> int:
"longer_than": _validate_positive_int,
},
"purpose_heading": {"headings": _validate_headings},
"name_too_short": {"min_chars": _validate_positive_int},
},
"correctness": {
"reserved_name": {"terms": _validate_reserved_terms},
Expand Down
10 changes: 3 additions & 7 deletions src/skillevaluator/validators/quality_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,13 +820,9 @@ def _check_discoverability(
dim.deduct(purpose["points"], "info", purpose["message"], purpose["suggestion"])

sn = qs.skill_name
if len(sn) < 5:
dim.deduct(
10,
"warning",
f"Skill name very short: '{sn}'",
"Use descriptive names like 'crypto-utils' not 'crypto'",
)
name_short = self.quality_config["discoverability"]["name_too_short"]
if name_short["points"] and len(sn) < name_short["min_chars"]:
dim.deduct(name_short["points"], "warning", f"{name_short['message']}: '{sn}'", name_short["suggestion"])
if not re.match(r"^[a-z][a-z0-9_-]*$", sn):
dim.deduct(
10,
Expand Down
42 changes: 42 additions & 0 deletions tests/test_quality_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,37 @@ def test_packaged_description_too_long_matches_former_hard_coded_values() -> Non
assert type(rule["points"]) is int


PACKAGED_NAME_TOO_SHORT = {
"points": 10,
"message": "Skill name very short",
"suggestion": "Use descriptive names like 'crypto-utils' not 'crypto'",
"min_chars": 5,
}


def test_packaged_name_too_short_matches_former_hard_coded_values() -> None:
rule = load_quality_config()["discoverability"]["name_too_short"]

assert rule == PACKAGED_NAME_TOO_SHORT
assert type(rule["points"]) is int


def test_custom_file_with_only_a_name_minimum_keeps_every_other_packaged_value(tmp_path: Path) -> None:
config_path = tmp_path / "quality.yaml"
config_path.write_text("discoverability:\n name_too_short:\n min_chars: 8\n", encoding="utf-8")
packaged = load_quality_config()

config = load_quality_config(config_path)

assert config["discoverability"] == {
**packaged["discoverability"],
"name_too_short": {**PACKAGED_NAME_TOO_SHORT, "min_chars": 8},
}
assert {key: value for key, value in config.items() if key != "discoverability"} == {
key: value for key, value in packaged.items() if key != "discoverability"
}


def test_custom_file_with_only_a_description_maximum_keeps_every_other_packaged_value(tmp_path: Path) -> None:
config_path = tmp_path / "quality.yaml"
config_path.write_text("discoverability:\n description_too_long:\n max_chars: 300\n", encoding="utf-8")
Expand Down Expand Up @@ -777,6 +808,16 @@ def test_custom_file_with_only_a_description_minimum_keeps_every_other_packaged_
r"invalid YAML: .*integer size exceeds 14000 bits",
),
("discoverability:\n description_too_long:\n points: -5\n", r"\.points must be a non-negative"),
("discoverability:\n name_too_short: 5\n", r"discoverability\.name_too_short must be a mapping"),
(
"discoverability:\n name_too_short:\n min_char: 5\n",
r"unknown key\(s\) in discoverability\.name_too_short: min_char "
r"\(allowed: message, min_chars, points, suggestion\)",
),
("discoverability:\n name_too_short:\n min_chars: 0\n", r"\.min_chars must be a positive integer"),
("discoverability:\n name_too_short:\n min_chars: 5.5\n", r"\.min_chars must be a positive integer"),
("discoverability:\n name_too_short:\n min_chars: true\n", r"\.min_chars must be a positive integer"),
("discoverability:\n name_too_short:\n points: -5\n", r"\.points must be a non-negative"),
(
"discoverability:\n description_too_short: 20\n",
r"discoverability\.description_too_short must be a mapping",
Expand Down Expand Up @@ -1012,6 +1053,7 @@ def test_packaged_config_round_trips_through_the_loader_with_every_rule_key(tmp_
"person_phrases",
"broad_description",
"purpose_heading",
"name_too_short",
}
assert set(packaged["efficiency"]) == {"token_budget", "action_verbs", "buzzwords", "reference_names"}
assert set(packaged["correctness"]) == {
Expand Down
89 changes: 89 additions & 0 deletions tests/validators/test_quality_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,95 @@ def _long_description_issues(result) -> list[dict]:
return [issue for issue in issues if "chars, maximum" in issue["message"]]


def _write_named_skill(tmp_path: Path, folder: str, name: str | None = None) -> Path:
skill_dir = tmp_path / folder
skill_dir.mkdir(parents=True)
(skill_dir / "SKILL.md").write_text(
f"---\nname: {name or folder}\ndescription: Use for parsing application logs\n---\n\n"
"# Named Skill\n\n## Instructions\n\n1. Run the skill\n",
encoding="utf-8",
)
return skill_dir


def _name_short_issues(result, text: str = "very short") -> list[dict]:
issues = result.metadata["quality_scores"]["dimensions"]["discoverability"]["issues"]
return [issue for issue in issues if text in issue["message"]]


def _name_short_finding_ids(result, text: str = "very short") -> list[str]:
return [finding.finding_id for finding in result.findings if text in finding.message]


class TestDiscoverabilityNameTooShortConfig:
def test_packaged_rule_fires_only_below_five_characters(self, tmp_path: Path):
at_minimum = _validate_with(_write_named_skill(tmp_path / "a", "abcde"), tmp_path)
below = _validate_with(_write_named_skill(tmp_path / "b", "abcd"), tmp_path)

assert _name_short_issues(at_minimum) == []
(issue,) = _name_short_issues(below)
assert issue["message"] == "Skill name very short: 'abcd'"
assert issue["suggestion"] == "Use descriptive names like 'crypto-utils' not 'crypto'"
assert issue["deduction"] == 10
assert issue["severity"] == "warning"

def test_packaged_finding_ids_match_the_former_hard_coded_rule(self, tmp_path: Path):
# Recorded from the hard-coded rule before it moved into the config.
two = _validate_with(_write_named_skill(tmp_path / "a", "ab"), tmp_path)
four = _validate_with(_write_named_skill(tmp_path / "b", "abcd"), tmp_path)

assert _name_short_finding_ids(two) == ["SEF-ae28b88377fc7294fabe"]
assert _name_short_finding_ids(four) == ["SEF-603662d2f9df37414afa"]

def test_the_folder_name_is_measured_not_the_frontmatter_name(self, tmp_path: Path):
short_folder = _validate_with(_write_named_skill(tmp_path / "a", "ab", "a-long-frontmatter-name"), tmp_path)
long_folder = _validate_with(_write_named_skill(tmp_path / "b", "long-folder", "ab"), tmp_path)

assert len(_name_short_issues(short_folder)) == 1
assert _name_short_issues(long_folder) == []

def test_custom_minimum_moves_the_threshold_in_both_directions(self, tmp_path: Path):
config = "discoverability:\n name_too_short:\n min_chars: {}\n"

lowered = _validate_with(_write_named_skill(tmp_path / "a", "abcd"), tmp_path, config.format(3))
raised = _validate_with(_write_named_skill(tmp_path / "b", "abcdef"), tmp_path, config.format(8))

assert _name_short_issues(lowered) == []
(issue,) = _name_short_issues(raised)
assert issue["message"] == "Skill name very short: 'abcdef'"

def test_custom_points_message_and_suggestion_are_used(self, tmp_path: Path):
config = (
"discoverability:\n name_too_short:\n points: 4\n"
" message: Name is tiny\n suggestion: Pick a longer name\n"
)
skill_dir = _write_named_skill(tmp_path, "ab")
default = _validate_with(skill_dir, tmp_path)

result = _validate_with(skill_dir, tmp_path, config)

(issue,) = _name_short_issues(result, "Name is tiny")
assert issue["message"] == "Name is tiny: 'ab'"
assert issue["suggestion"] == "Pick a longer name"
assert issue["deduction"] == 4
assert _name_short_finding_ids(result, "Name is tiny") != _name_short_finding_ids(default)

def test_zero_points_turns_the_rule_off_without_changing_other_rules(self, tmp_path: Path):
skill_dir = _write_named_skill(tmp_path, "ab")
default = _validate_with(skill_dir, tmp_path)

disabled = _validate_with(skill_dir, tmp_path, "discoverability:\n name_too_short:\n points: 0\n")

def other_messages(result) -> list[str]:
issues = result.metadata["quality_scores"]["dimensions"]["discoverability"]["issues"]
return [issue["message"] for issue in issues if "very short" not in issue["message"]]

assert _name_short_issues(disabled) == []
assert other_messages(disabled) == other_messages(default)
scores = [r.metadata["quality_scores"]["dimensions"]["discoverability"]["score"] for r in (default, disabled)]
assert scores[1] == scores[0] + 10


class TestDiscoverabilityDescriptionTooLongConfig:
def test_packaged_rule_fires_only_above_200_characters(self, tmp_path: Path):
at_maximum = _validate_with(_write_described_skill(tmp_path / "at", "Use for logs. " + "x" * 186), tmp_path)
Expand Down
Loading