Golden Test Sets for LLM Skill Development: Engineering Practices for Reliable Regression Testing
Golden test sets provide a repeatable, quantitative way to validate changes to LLM skills. This article defines the concept, presents a standardized skill-module structure, and explains how to build test fixtures, positive cases, negative and boundary tests, and an automated grader. It also summarizes practical recommendations for preserving test purity and embedding golden-set checks into the release workflow.
In large language model application development, custom “skills” built for specific business scenarios have become an important way to improve a model’s vertical-domain capabilities. However, as business requirements change, developers need to modify skill logic, prompts, or post-processing scripts frequently. Ensuring that a skill remains stable after modification and preventing functional regressions—where fixing one issue only causes another to surface—is a major pain point in current engineering practice. This article focuses on an engineering method called the “golden test set” and discusses how to build a rigorous, quantifiable skill testing and validation system.
1. Core Definition and Value of Golden Test Sets
In software engineering, unit tests and regression tests are cornerstones of code quality. In skill development, this idea is concretized as the golden test set.
One-sentence definition: a golden test set is a fixed collection of test cases with known answers. Whenever a skill is iterated or modified, the system automatically reruns the same test set, using the same ruler to measure different skill versions so that results are directly comparable.
During skill iteration, the biggest risk is “unknown impact.” After a golden test set is introduced, strict variable control is achieved in engineering terms: the test case collection remains unchanged, the expected standard answers remain unchanged, and the only variable is the skill version number. By running the test set and calculating the pass rate, the performance of different versions can be compared directly. This “same exam, retaken” mechanism makes it possible to attribute fluctuations in skill performance entirely to “the modified code or configuration,” greatly reducing troubleshooting costs and safeguarding online service stability.
2. Engineering Structure Design for Standardized Skill Modules
To implement the automated testing mechanism above, the skill module first needs to be reasonably split at the physical structure level. Taking a skill used for “A/B experiment quality analysis” as an example, its standard directory structure should follow the principle of separation of responsibilities:
ab-quality-analysis/├── SKILL.md # Core configuration: trigger rules, no-trigger conditions, field validation, calculation rules, output templates, etc.├── golden_set.md # Methodology document: test case list classification, test discipline notes, test fixture generation notes├── scripts/│ └── analyze.py # Core analysis script (e.g., two-sample Z-test calculation, multi-dimensional data aggregation, time trend analysis, etc.)└── tests/├── run_golden_set.py # Automated grader (contains N test cases, executes in one run and calculates pass rate)├── generate_fixtures.py # Test fixture generation script (ensures fixed and reproducible test data)└── fixtures/ # Test fixture directory (stores baseline input data)├── known_cases.xlsx # Manually constructed standard data with results that can be verified by hand├── missing_field.xlsx # Exception test: data missing key fields└── bad_dates.xlsx # Exception test: boundary data including nulls, zero sample size, invalid dates, etc.
The key strength of this structure is that it physically separates the core execution logic (scripts), skill metadata configuration (SKILL.md), and the test system (tests). The fixtures directory ensures absolute stability of input data, while run_golden_set.py acts as a tireless “automated grader,” completely eliminating manual verification errors.
In the core configuration file, the boundaries of the skill need to be clearly defined. For example, SKILL.md should describe in detail the business scenarios that trigger the skill, such as when a user mentions “experiment quality” or “experiment significance summary.” It should also explicitly define “no-trigger” scenarios, such as “experiment management” or “sensitivity analysis,” to prevent the skill from being invoked incorrectly. In addition, the core calculation logic must be standardized—for example, explicitly specifying a two-sample Z-test based on ARPU to determine significance and setting a hard threshold such as |z| ≥ 1.96.
3. Test Case Construction and Automated Validation Practices
1. Generating and Managing Test Fixtures
Test reproducibility depends on the stability of test data. In generate_fixtures.py, developers should use fixed random seeds or manually constructed data sources to generate baseline inputs such as known_cases.xlsx. These data should not only match the structural characteristics of real business data; more importantly, their calculation results must be independently verifiable by hand or with simple scripts. Only when the “foundation” is accurate does subsequent automated grading become meaningful.
2. Positive Cases: Preventing Basic Function Regression
Positive cases are the core of the golden test set and are intended to verify whether the most basic functions of the skill work correctly. When designing positive cases, the “input” and “expected output” must be precisely defined.
Taking A/B experiment quality analysis as an example, a typical positive case is designed as follows:
- Input instruction: Perform experiment quality analysis for 2026/10/1–2026/10/31.
- Expected output constraints:
- Dimension completeness: The output must include the three dimensions “overall / page / stage,” and each group must contain four experiment types (significant positive / non-significant positive / non-significant negative / significant negative), plus one summary row.
- Format compliance: The time range output format must be strictly
2026/10/1-2026/10/31, meaning months and days are not zero-padded and the year must be included. This format constraint prevents the model from hallucinating or drifting in output format. - Algorithm accuracy: Significance classification must strictly follow the configured Z-test rules. For four rows of manually constructed boundary data (such as the no-difference case with lift=0), the Z-test classification produced by the skill must exactly match the manually calculated result.
3. Negative and Boundary Tests
In addition to positive cases, the golden test set must also include test cases for abnormal inputs. For example, when input data is missing the “experiment stage” field (corresponding to missing_field.xlsx), the skill should provide a clear error message or degrade gracefully rather than throwing a runtime exception and crashing. When input data contains invalid dates or zero sample size (corresponding to bad_dates.xlsx), the skill also needs fault-tolerant handling.
4. Engineering Takeaways and Recommendations
Building and maintaining a high-quality golden test set is a necessary path for a skill to move from a “toy” to a “production-grade tool.” In practice, developers should note the following points:
- Keep it pure: Once a golden test set is established, its input data and expected answers should be treated as “read-only” assets and must not be changed arbitrarily as business requirements change. If business rules change fundamentally, a new test set version should be created, with historical records retained for traceability.
- Embed automation into the workflow: Integrate the execution of
run_golden_set.pyinto the continuous integration (CI) process. Each time skill code is committed or a prompt is updated, automatically trigger the golden test set. If the pass rate does not reach 100%, block the release and stop quality problems at the source. - Validate output at a fine-grained level: In the automated grader, validate not only the final calculated values but also details of the output format, such as the time format specification mentioned above. Use regular expressions or structured parsing to ensure that the skill output can be accurately consumed by downstream systems.
By introducing the golden test set mechanism, developers can transform the previously vague and subjective evaluation of LLM skills into a precise and objective engineering measurement system, thereby safeguarding system stability while maintaining iteration efficiency.
