Test Driving Skill Changes logo

Test Driving Skill Changes

Organization
opsmill
test-driving-skill-changes

Writes the failing test for an analysed or grilled skill change, and proves it fails, before any fix is written. Chooses the test surface from the defect class: an eval.yaml task plus a grader check for guidance, a pytest for grader and script defects. Follow the workflow in the body; the description does not summarize it. TRIGGER when: a .skill-change-<key>.md handoff file exists and the failing test has not been written yet; you are at the second step of the skill-change pipeline. DO NOT TRIGGER when: no handoff file exists, use analyzing-skill-bugs or grilling-skill-features first; the failing test exists and you are implementing the fix, use implementing-skill-changes; you are writing tests for a shipped Infrahub artifact rather than for this repository.

Overview

Publisheropsmill
Repositoryinfrahub-skills
Skill nametest-driving-skill-changes
Stars
27
Forks
0
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by opsmill on GitHub. Read the source before you install it.

Installation

Install the Test Driving Skill Changes AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/opsmill/infrahub-skills/tree/main/.agents/skills/test-driving-skill-changes
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opsmill/infrahub-skills.git /tmp/infrahub-skills
mkdir -p .claude/skills
cp -r /tmp/infrahub-skills/.agents/skills/test-driving-skill-changes .claude/skills/test-driving-skill-changes
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Test Driving Skill Changes in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Test Driving Skill Changes on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Test Driving Skill Changes is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill change test-writer

User Input

text
$ARGUMENTS

Your role

Write the failing test and nothing else. No fix, no prose edit to the skill under change. The test is the thing the next stage has to make pass. If you find yourself editing a rule, a grader's logic beyond the new check, or a skill's prose, stop: that work belongs to implementing-skill-changes.

Tool usage

  • Use the Read tool to read files and the Glob tool to find them, rather than cat, find, or ls -R.
  • Use the Grep tool when you are searching the tree yourself. That covers exploration, not the commands this pipeline prints: where this skill or a file it links gives a literal grep, head, or tail, run it as given. The sweep and the ground-truth reads are those commands.
  • Reserve Bash for git, gh, the snippets this skill gives you, and anything else that needs a shell.
  • Shell state does not persist across separate Bash calls. Variables and cd are gone by the next call, so re-derive or restate anything a later snippet needs.

Input and setup

Parse $ARGUMENTS for <key> and an optional pr flag, case-insensitive, anywhere in the arguments, setting OPEN_PR.

Read .skill-change-<key>.md. Missing file: tell the user to run analyzing-skill-bugs or grilling-skill-features first, and stop. Missing any field required by ../skill-pipeline-common/handoff-format.md: name the field and stop. Guessing a field forward writes a test against a diagnosis nobody confirmed.

Step 0: Branch

Take BRANCH from the handoff's Branch field. Re-deriving a slug here drifts from the name the entrance stage recorded, and the later stages would then be working on a different branch.

bash
git status --porcelain | grep -q . && { echo "Working tree is dirty. Commit or stash first."; exit 1; }
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
[ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | sed -n 's/.*HEAD branch: //p')
[ "$DEFAULT_BRANCH" = "(unknown)" ] && DEFAULT_BRANCH=""
DEFAULT_BRANCH=${DEFAULT_BRANCH:-main}
BRANCH="<the Branch field from .skill-change-<key>.md>"
git fetch origin "$DEFAULT_BRANCH"
git fetch origin "$BRANCH" 2>/dev/null || true
git checkout "$BRANCH" || git checkout -b "$BRANCH" "origin/$DEFAULT_BRANCH"

Fetching $BRANCH first is what lets a re-run pick up work pushed from another machine or another worktree, instead of quietly branching off the default branch and losing the failing test already committed there.

The first git checkout keeps its error visible on purpose. This repository is routinely checked out as a git worktree, and a branch already checked out elsewhere fails with "already used by worktree at ...", which is the message you need rather than the misleading "already exists" from the fallback.

No refspec reconciliation: this repository is small and is not shallow cloned.

Route on defect class

Read Defect class from the handoff file: guidance follows ## Guidance class below; grader and script follow ## Grader and script classes.

Guidance class

  1. Read ../../../dev/guides/adding-a-rule.md §§2 to 5 and ../../../dev/guidelines/graders.md. Both describe the shape a guidance-class test has to take.
  2. Read ../../../dev/guidelines/minimum-change.md for the ladder, then answer two coverage questions before writing anything new:
    • Can an existing grader check assert it? Reuse the function in graders/<skill>/lib.py and add its name to an existing task's CHECKS list. A new check function is only warranted when no existing one parses the right artifact.
    • Can it ride an existing eval task? Add the assertion to a task whose prompt already produces the scenario. A new task costs trials times model runs on every regression sweep, forever.
  3. Write the check in graders/<skill>/lib.py and register it in CHECKS. Parse the artifact, never substring-match it. Strip comments and docstrings before asserting, or a contrast block in the answer satisfies a check meant to fail it. Extract every fenced block rather than the first, or an answer whose real output sits in the second fence passes on an empty check.
  4. Write graders/<skill>/check_<task>.py, bundling the new assertion with related baseline checks so the task also catches regressions in neighbouring rules.
  5. Add the eval.yaml task. Keep trials: 3 in the file: that is the value the weekly regression suite runs against. Every local run in this skill still passes --trials=1 on the command line, because a local check only needs one failing trial to prove the point, not a statistically reliable rate. The file value and the local flag are different on purpose.
  6. Build and run the four fixtures. See ## Four fixtures below.
  7. Run the red run: skillgrade --eval=<task> --trials=1 against the branch with the skill read normally and the new rule still absent. This is the failing test, and nothing before it is one. The fixtures prove the grader discriminates across four files you wrote by hand, which is not the repository as it stands scoring below 1.0. Require a score below 1.0 here. A score of 1.0 means the model already produces the wanted behavior without the rule, so the rule may be redundant: escalate, do not record it as a pass. Before reading the score, check the trial's output for a grader read, using the tell in dev/guides/running-evals.md § "Prove the task discriminates": a trial that read the grader is void at any score, so re-run it instead of recording it, up to the re-run limit that section sets. The discrimination proof, the same task run with the skill unread, belongs to implementing-skill-changes: while the rule is absent the task scores below 1.0 whether the skill is read or not, so running it here proves nothing.
  8. Run uv run python scripts/sync-evals.py and commit eval.yaml, the regenerated evaluations/*.json, and the grader files together. The evals-sync job in CI regenerates them and fails the pull request on any diff, so skipping this turns into a red build rather than silent drift.
  9. Lint and run uv run invoke test.

Four fixtures

Hand-craft four fixtures and run the grader on each. What each fixture is, and why the second and fourth are the ones that find bugs, is written once in ../../../dev/guides/adding-a-rule.md § "Verify the Grader Both Ways". Read it there rather than working from memory.

The scores this stage requires, in fixture order: 1.0 / 1.0 / <1.0 / <1.0.

bash
REPO=$(git rev-parse --show-toplevel)
mkdir -p /tmp/skill-fixtures/{pass,pass-variant,fail,fail-nearmiss}
# write the artifact under test (output.yml, or the file the grader reads) in each
for d in pass pass-variant fail fail-nearmiss; do
  echo "--- $d"
  (cd /tmp/skill-fixtures/$d && uv run --project "$REPO" python "$REPO/graders/<skill>/check_<task>.py")
done

If the near miss scores 1.0, the check grades vocabulary, not substance: rewrite it before continuing. Check the failure message too, and confirm it names the assertion that actually broke. A check that cannot fail is worse than no check, because it reports the rule as covered forever.

Grader and script classes

Write a failing pytest under tests/graders/ or tests/scripts/. For drift defects, the test asserts the behavior of the scripts/check-*.py that does not exist yet, or exists but does not catch the drift. Run it with:

bash
uv run --group test pytest tests/<path> -k <name> -v

It must fail, and fail for the reason the handoff's Test plan states, rather than on an import error or a typo in the test itself. Commit the test.

On the grader class the four fixtures in ## Four fixtures are the pytest's parameter cases: the same compliant, compliant variant, violating, and near-miss artifacts, asserted directly against the check function instead of through a skillgrade run. The separate four-fixture run and the red run do not apply here; the pytest is the whole test.

Close out

Close out only once the red run, the fixture run, or the pytest, whichever the defect class produced, has actually confirmed the failure. See ## Hard gate below before pushing anything.

With OPEN_PR, push and open a draft PR whose body carries AGENT_EVAL_COMPLETE, reusing an existing PR for the branch rather than opening a duplicate:

bash
BRANCH="<the Branch field from .skill-change-<key>.md>"
git push -u origin "$BRANCH"
PR=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number')
if [ -z "$PR" ]; then
  gh pr create --draft --title "<type>(<scope>): <title>" \
    --body "$(printf '%s\n\n%s\n' '<one paragraph on the defect or design, linking the issue>' 'AGENT_EVAL_COMPLETE')"
else
  BODY=$(gh pr view "$PR" --json body --jq .body)
  printf '%s' "$BODY" | grep -q 'AGENT_EVAL_COMPLETE' \
    || gh pr edit "$PR" --body "$(printf '%s\n\n%s\n' "$BODY" 'AGENT_EVAL_COMPLETE')"
fi

Both halves stamp the marker. An earlier version only stamped it on the create path, so a branch that already had a pull request, from a re-run or one opened by hand, reached implementing-skill-changes with no marker and hit its hard stop with no way out: re-running this stage took the same reuse path and still did not stamp it. The grep -q guard keeps a second run from appending it twice.

Without OPEN_PR, push the branch and report its name.

Hard gate

Never hand off if the test does not fail. A test that passes on broken code is not a test. State plainly what you ran and what it printed, for the fixture run or the pytest, whichever the defect class produced.

The required evidence differs by class. Guidance: the red run of step 7, scoring below 1.0 with the skill read and the rule absent, quoted with its score, alongside the fixture run. Grader and script: the failing pytest, quoted with its failure message.

Escalation

Stop and report rather than guessing forward, when:

  • the handoff file is missing or is missing a required field
  • the working tree is dirty and cannot be cleaned safely
  • the test cannot be made to fail against the current code
  • the red run scores 1.0, meaning the model already produces the wanted behavior without the rule and the rule may be redundant
  • three red-run trials in a row, counted across runs, show a grader read, the re-run limit in dev/guides/running-evals.md § "Prove the task discriminates"

Common mistakes

MistakeWhy it breaks the pipeline
Writing the fix in this stageThe next stage has nothing left to implement, and no failing test proves it needed to
Substring matching in the checkPasses an answer that mentions the trap and fails one worded differently
Skipping the near-miss fixtureThe check ships grading vocabulary instead of substance, and nobody notices
Treating the fixture run as the failing testFour files you wrote by hand are not the repository scoring below 1.0
Committing eval.yaml without the regenerated evaluations/*.jsonThe evals-sync job regenerates them and fails the pull request on any diff
Adding a new task where an existing one would carry the assertionEvery task costs trials times model runs on every regression sweep, forever

Boundaries

Follow the repository-wide boundaries in ../../../AGENTS.md § Boundaries.

Frequently asked questions

What does the Test Driving Skill Changes AI skill do?

Writes the failing test for an analysed or grilled skill change, and proves it fails, before any fix is written. Chooses the test surface from the defect class: an eval.yaml task plus a grader check for guidance, a pytest for grader and script defects. Follow the workflow in the body; the description does not summarize it. TRIGGER when: a .skill-change-<key>.md handoff file exists and the failing test has not been written yet; you are at the second step of the skill-change pipeline. DO NOT TRIGGER when: no handoff file exists, use analyzing-skill-bugs or grilling-skill-features first; the f...

Why use Test Driving Skill Changes on TypingMind?

Because you install it once and use it with any model. Test Driving Skill Changes is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Test Driving Skill Changes in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/opsmill/infrahub-skills/tree/main/.agents/skills/test-driving-skill-changes. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Test Driving Skill Changes?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Test Driving Skill Changes?

As many as you like. As long as a model supports skills, you can use Test Driving Skill Changes with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Test Driving Skill Changes AI skill free?

It is published on GitHub by opsmill. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇