跪拜 Guibai
← All articles
Artificial Intelligence · Kotlin · Android

AI Skills Need a Test Harness, Not Just a Demo Run

By RockByte ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most AI Skills ship after a single successful run and degrade silently when colleagues use different phrasing or when model behavior shifts. A small, repeatable test harness that reads the live SKILL.md catches undertriggering, hallucinated facts, and structural drift before they reach a teammate, and it costs a single Python file.

Summary

A Skill that works once on a clean prompt is a demo; a Skill that survives messy real-world input and repeated runs is infrastructure. The difference is a test harness that checks three things: whether the Skill triggers on the right requests and stays quiet on the wrong ones, whether its output meets explicit success criteria without hallucinating missing details, and whether its structure holds across five consecutive runs. The approach starts with a single hard sample — the messiest meeting notes available — and iterates the Skill until it passes, then expands to more cases. A lightweight Python script reads the actual SKILL.md, sends the description to the model for trigger tests, and runs functional and consistency checks against the full instructions. It is not a production Eval framework, but it catches regressions in seconds and points directly to the failing layer: description, instructions, or structural drift.

Takeaways
Trigger testing sends only the Skill description to the model and asks whether the Skill should fire; it catches both undertriggering and overtriggering.
Functional testing runs the full SKILL.md against a known input and checks output against explicit success criteria, including a rule that missing information must stay missing.
Consistency testing re-runs the same input five times and fails if the output structure — sections, formatting, handling of unknowns — drifts.
Start with one truly difficult sample, iterate the Skill until it passes, then expand the test set; solving one hard failure teaches more than ten easy passes.
A single Python script using only the standard library can read the live SKILL.md, call the model API, and run all three test layers in seconds.
The harness checks for fabricated dates by scanning for ISO 8601 patterns when the input contains no date, though natural-language hallucinations still need manual review.
Test failures map directly to fixes: undertriggering means the description is too narrow, overtriggering means it is too broad, and output errors mean the instructions need tightening.
Conclusions

Skill testing is essentially a three-layer contract: the description is a routing contract, the instructions are a behavior contract, and repeated runs verify the contract holds under non-determinism.

Hallucination in Skills often manifests not as obvious nonsense but as confidently filling in plausible details the source never provided — a meeting date, an owner, a decision — which makes it harder to spot without explicit negative assertions in tests.

The advice to start with one hard sample rather than twenty easy ones inverts the typical test-first instinct and aligns better with how prompt engineering actually iterates: fix the worst failure, then generalize.

Reading the live SKILL.md rather than a copied version eliminates the most common test-maintenance failure mode in AI tooling: tests that pass against a stale copy while the real Skill has already diverged.

Concepts & terms
Skill (in AI agent context)
A packaged set of instructions, often a markdown file with frontmatter metadata, that an AI agent loads on demand to perform a specific task — here, formatting meeting notes. The frontmatter description controls when the agent decides to load it.
Undertriggering / Overtriggering
Undertriggering means a Skill fails to activate when it should; overtriggering means it activates on unrelated requests. Both are failures of the Skill's description as a routing mechanism.
Test Harness
A lightweight script or framework that automates running tests against a system. Here, a Python script that reads the Skill file, calls a model API, and checks trigger behavior, output correctness, and structural consistency.
Agent Harness
The broader practice of wrapping an AI agent with success criteria, repeated sample runs, and regression checks — analogous to a test harness but applied to the agent's entire behavior loop rather than just a Skill file.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗