Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(harness): count when_to_use in Claude Code's 1,536-character cut (CC-DESC-CUT) (#620)

Christopher Kevined49c85c0015
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a8eb18d..f832de5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -295,6 +295,9 @@ All notable changes to SkillEvaluator are documented in this file.
budget-denied. Explicit non-budget omissions still fail attempt coverage checks.
- Hermes `harness` results no longer say Hermes uses one of two same-named
skills (`HM-DUP-NAME`): Hermes lists both, and the model sees both bodies.
+- Claude Code `harness` results count `when_to_use` toward the 1,536-character
+ listing cut (`CC-DESC-CUT`): Claude Code lists `<description> - <when_to_use>`
+ and cuts that whole text, so a long `when_to_use` loses its end.
- Copilot CLI `harness` results flag an empty or whitespace-only `description`
(`CP-DESC-EMPTY`): Copilot lists the skill with a blank description, so the
model sees only its name.
diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py
index 7f41395d..420da8b6 100644
--- a/src/skillevaluator/harness/overlay.py
+++ b/src/skillevaluator/harness/overlay.py
@@ -410,6 +410,11 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A
description = data.get("description")
tools = data.get("allowed-tools")
trigger = _TRIGGER_RE.search(description) if isinstance(description, str) else None
+ when_to_use = data.get("when_to_use")
+ # Claude Code lists "<description> - <when_to_use>" and cuts that whole text.
+ claude_listing = (description if isinstance(description, str) else "") + (
+ f" - {when_to_use}" if when_to_use is not None and str(when_to_use) else ""
+ )
root, depth = _install_root(skill_path)
target = "none"
if skill_path.is_symlink():
@@ -449,6 +454,8 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A
"description_empty": isinstance(description, str) and not description.strip(),
"description_type": type(description).__name__ if description is not None else "none",
"description_codepoints": len(description) if isinstance(description, str) else 0,
+ "claude_listing_text": claude_listing,
+ "claude_listing_codepoints": len(claude_listing),
"description_has_quote": isinstance(description, str) and '"' in description,
"description_utf16_units": _utf16_units(description),
"trigger_end": trigger.end() if trigger else None,
@@ -569,7 +576,7 @@ def _utf16_units(value: Any) -> int:
def listed_description(profile: dict[str, Any], facts: dict[str, Any]) -> dict[str, Any]:
"""What the profile says this harness puts in the model's skill list for the description."""
listing = profile.get("listing") or {}
- text = facts["description_text"]
+ text = facts[listing.get("text_fact", "description_text")]
budget = listing.get("budget") or {}
over_budget = facts["catalog_size"] and (
facts["catalog_desc_chars"] > (facts.get("list_budget_chars") or budget.get("desc_chars", float("inf")))
diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml
index e718c3b7..4bde682f 100644
--- a/src/skillevaluator/harness/profiles/claude-code.yaml
+++ b/src/skillevaluator/harness/profiles/claude-code.yaml
@@ -5,11 +5,11 @@ roots:
project: [.claude/skills]
user: [~/.claude/skills]
not_scanned: [.agents/skills, ~/.agents/skills]
-listing: {cut: 1536, budget: {desc_chars: 8000, chars_per_context_token: 0.04}}
+listing: {cut: 1536, text_fact: claude_listing_text, budget: {desc_chars: 8000, chars_per_context_token: 0.04}}
rules:
- {id: CC-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Claude Code reads only .claude/skills and ~/.claude/skills; .agents/skills is not scanned.", fix: "Install it under .claude/skills or ~/.claude/skills (a symlink from .agents/skills works).", confidence: high}
- {id: CC-GROUPING, when: "grouping_depth > 0", effect: not_loaded, outcome: not found, message: "Claude Code finds skills only directly under the skills folder; grouping folders are not searched.", fix: "Move the skill folder directly under .claude/skills.", confidence: high}
- - {id: CC-DESC-CUT, when: "description_codepoints > 1536", effect: degraded, outcome: listing shortened, message: "Description cut at 1,536 characters.", fix: "Keep the description at or under 1,536 characters.", confidence: high}
+ - {id: CC-DESC-CUT, when: "claude_listing_codepoints > 1536", effect: degraded, outcome: listing shortened, message: "Description cut at 1,536 characters ({claude_listing_codepoints} with when_to_use, which Claude Code lists after it).", fix: "Keep description and when_to_use at or under 1,536 characters together.", confidence: high}
- {id: CC-DOLLAR-N, when: "dollar_literal_count > 0", effect: degraded, outcome: text rewritten, message: "{dollar_literal_count} price-like $N tokens (lines {dollar_literal_lines}) are argument placeholders: invoked with five or more arguments, $4.00 becomes <5th argument>.00 (an unmatched $N is kept verbatim).", fix: "Reword amounts (e.g. USD 4.00); \\$4.00 escapes it here, but other harnesses then show the backslash.", versions: "installed skills; bundled skills skip substitution", confidence: high}
- {id: CC-DESC-MISSING, when: "description_missing or description_empty or description_type != 'str'", effect: degraded, message: "No usable description: Claude Code shows body text instead.", fix: "Add a non-empty string description.", confidence: high}
- {id: CC-LIST-BUDGET, when: "catalog_desc_chars > list_budget_chars", effect: degraded, outcome: listing shortened, message: "The {catalog_size} skills in this folder have {catalog_desc_chars} description chars; Claude Code's skill list fits {list_budget_chars} (1% of the context window at 4 chars per token; 8,000 if the window is unknown), so descriptions get shortened.", fix: "Shorten descriptions (trigger first) or install fewer skills here.", confidence: medium}
diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py
index a40ea8bd..ed59e94a 100644
--- a/tests/harness/test_overlay.py
+++ b/tests/harness/test_overlay.py
@@ -459,6 +459,19 @@ def test_reload_guidance_reaches_findings(tmp_path: Path):
assert {r["status"] for r in rows.values()} == {"loads"}
+def test_claude_listing_cut_counts_when_to_use(tmp_path: Path):
+ desc = "Use when building reports."
+ over = _rows(_skill(tmp_path / "over", extra=f"when_to_use: {'w' * 1520}\n", desc=desc))["claude-code"]
+ under = _rows(_skill(tmp_path / "under", extra=f"when_to_use: {'w' * 1500}\n", desc=desc))["claude-code"]
+
+ cut = next(f for f in over["findings"] if f["id"] == "CC-DESC-CUT")
+ assert "1,549 with when_to_use" in cut["message"]
+ assert over["listed"]["mode"] == "cut"
+ assert over["listed"]["text"].startswith(f"{desc} - www")
+ assert "CC-DESC-CUT" not in {f["id"] for f in under["findings"]}
+ assert under["listed"]["mode"] == "full"
+
+
def test_listed_description_projection(tmp_path: Path):
desc = "Use when " + "a" * 1600
rows = _rows(_skill(tmp_path, desc=desc))