Regression Testing for AI Coding Skills: A Practical Guide to Golden Sets

    This article explains how to use Golden Sets to regression-test AI coding skills and agents. It covers why skills require controlled evaluation, how to structure golden test cases and fixtures within a skill directory, and how to classify cases into positive, negative, error-handling, and output-format categories. It also details automated grading, deterministic scoring rules, fixture reproducibility, and engineering practices for tracking pass rates across skill versions. Readers will learn how to turn subjective "it seems fine" checks into measurable pass rates that make every skill change explainable and rollback-friendly.

    1. Why Skills Need a Consistent Measuring Stick

    In AI coding tools and AI agent applications, a “skill” is typically built from trigger conditions, field validation rules, decision logic, output templates, and supporting scripts. It looks like a prompt, but functionally it is a software unit with inputs, processing, and expected outputs. As a software unit, it faces the classic software engineering question: after a change, how do you confirm that no regression was introduced?

    In practice, skills are adjusted for concrete reasons: adding a statistical dimension, tightening a trigger boundary, fixing a date format, or adding a scenario that must not trigger. The change may be small, but the blast radius is not necessarily small. Skill behavior is jointly determined by natural-language constraints and code logic, and the two are tightly coupled. A wording change can cause the model to make different decisions on boundary samples; a script refactor can shift how aggregates are calculated. Without an evaluation method, developers can only run a few manual trials and “get a feeling.” That approach uses a small, biased sample, produces conclusions that cannot be reproduced, and makes strict version-to-version comparison impossible.

    A Golden Set exists to solve this problem. It is a fixed collection of test cases with known answers. Each time a skill changes, the same set is re-run and the same measuring stick is applied to different versions, so results are directly comparable. Its value is not “many tests” but “controlled variables”: the case set stays the same, the expected answers stay the same, and the only variable is the skill version. After a run, you get a pass rate that can be compared horizontally across versions—like retaking the same exam, where any score fluctuation can be attributed to the part that was changed.

    It is worth emphasizing that a Golden Set is not a one-time asset; it is an engineering asset that requires maintenance. Teams need to balance iteration speed against evaluation cost: too few cases mean insufficient coverage, while too many cases mean waiting time on every change. Expected answers must also remain stable and verifiable; otherwise, the evaluation itself loses its baseline meaning.

    2. Sample Structure: Build Evaluation Into the Skill Directory

    To make evaluation part of the skill rather than an external add-on, the recommended approach is to place the methodology, scripts, fixtures, and grader together in the skill directory. The example below uses an “AB experiment quality analysis” skill for illustration only:

    1. ab-quality-analysis/
    2. ├── SKILL.md # Triggers and anti-triggers, field validation, significance rules, output template, full-display constraint
    3. ├── golden_set.md # Methodology doc: four case categories, usage discipline, fixture notes
    4. ├── scripts/
    5. │ └── analyze.py # Analysis script: two-sample Z-test + three-dimension aggregation + daily trend
    6. └── tests/
    7. ├── run_golden_set.py # Automated grader: covers 17 cases, computes pass rate in one command
    8. ├── generate_fixtures.py # Fixture generator: fixed data, reproducible
    9. └── fixtures/ # Benchmark inputs with known answers
    10. ├── known_cases.xlsx # 4 rows of hand-built data; Z-test results can be checked by hand
    11. ├── missing_field.xlsx # Missing the "experiment stage" field
    12. └── bad_dates.xlsx # Empty ARPU / zero sample size / invalid dates

    This organization has three benefits. First, the methodology and the implementation live together, so a reviewer can see constraints, logic, and verification methods in a single code review. Second, the grader and fixtures are versioned along with the skill, so evaluation results are traceable: if pass rate drops in a version, you can follow the commit history to locate the specific change. Third, the directory itself serves as documentation. When a new member takes over, they do not need verbal handoff; reading golden_set.md is enough to understand “what counts as passing.”

    The skill declaration section also deserves careful thought. Using the illustrative skill, the description needs to state both when to use it and when not to use it: use it when users ask about experiment quality, experiment revenue, significance summaries, or effect summaries and need significance-based statistical classification of detail data by time range; do not trigger it for experiment management, general AB analysis, sensitivity analysis, and similar scenarios. The clearer the trigger boundaries, the more meaningful positive and negative case evaluation becomes.

    3. Practice Breakdown: Four Case Categories That Build an Attributable Evaluation Net

    Evaluation cases should not be casually assembled samples; they should be designed around “where things are most likely to go wrong.” In practice, they fall into four categories. The illustrative skill covers them with 17 cases.

    a. Positive cases—prevent basic functional regression. Select representative tasks and specify expected outputs, then compare answers automatically. For example, the input “perform experiment quality analysis for 2026/10/1—2026/10/31” expects an output containing three dimensions—overall, page, and stage—with each group containing four categories: significantly positive, not significantly positive, not significantly negative, and significantly negative, plus a summary line. The time-range format should be 2026/10/1-2026/10/31 (month and day without zero padding, including the year). Significance is based on a two-sample Z-test on ARPU, with |z| ≥ 1.96 considered significant. The classification results for 4 rows of hand-built data (including a lift=0 boundary) must match manual calculation. This single case locks down structure, format, statistical criteria, and boundary behavior, making it the backbone of regression protection.

    b. Negative cases—verify that the skill does not trigger. Explicitly list scenarios where the skill should not be triggered to prevent the skill from “overconfidently” taking over unrelated requests. The value of negative cases is to constrain generalization: models tend to force a match when semantics are similar, and only by writing prohibited scenarios as decidable cases do boundaries truly become stable.

    c. Error inputs—verify validation and fault tolerance. Use fixtures with missing fields, empty values, zero sample sizes, and invalid dates to check whether the skill produces a clear error and repair suggestions, or silently produces incorrect conclusions. The missing_field.xlsx and bad_dates.xlsx in the example are of this type. Error cases often expose real defects more effectively than positive cases, because real data is never perfect.

    d. Format and display constraints—verify the output contract. This includes full-display constraints (no omitted rows, no replacing tables with “etc.”), summary line placement, numeric precision, sorting rules, and so on. Once the output contract loosens, downstream automated parsing will fail, so it must be fixed with cases.

    4. Grading and Fixtures: Make Pass Rates Reproducible and Comparable

    The automated grader is the “examiner” of the Golden Set. It reads fixtures, invokes the skill, compares against expected answers, and outputs pass rate and failure details. Three design points matter: first, grading rules must be deterministic—use structured field comparison instead of fuzzy matching where possible; second, failure information must be locatable, outputting case IDs and differences between expected and actual results; third, execution must be one command, compressing evaluation cost to a single action.

    Fixture generation scripts ensure data is fixed and reproducible. A small amount of hand-built data is especially important: 4 rows are enough to cover the four significance categories, and Z-test results can be verified by hand, avoiding the circular argument of “using tested code to validate tested code.” When larger-scale data is needed, it should be generated by a script with a fixed random seed, and the seed and generation logic should be checked into version control together.

    Usage discipline is equally critical: merge only after evaluation passes; any pass-rate drop must be attributed to a specific change; new capabilities must add corresponding cases; fixture changes require review to prevent “changing answers to make tests green.”

    5. Iteration Loop and Engineering Recommendations

    Integrating the Golden Set into daily workflows forms a stable loop: run a baseline before a change, run a comparison after, and return to cases to locate failures. As teams grow, evaluation results can be connected to continuous integration and monitoring alerts, with pass rate treated as an observable metric. Fixtures and results are suitable for retention in version management and object storage, while logs and metrics can be handled by logging and monitoring services, making it easier to track quality trends over the long term.

    In summary, quality assurance for skill iteration does not rely on intuition but on reproducible evaluation. The Golden Set uses “fixed cases + known answers + a single variable” to turn a vague “seems fine” into a clear “pass rate changed from X to Y,” making every change explainable, rollback-able, and accumulative.