AI Skills as Code (AISaC)
An AI skill written as plain text drifts like any document. AI Skills as Code (AISaC) treats it like code, with four habits from software: scripts for rules that can run, tests that can fail, a review date on every reference, and versions that reach every install.
An AI coding assistant can load a skill, a file of instructions it reads before it starts a certain kind of task. A skill decides what the assistant does in your repositories, yet most skills are written once, as plain text, and then trusted.
Infrastructure as Code moved servers from clicks into reviewed files. AI Skills as Code (AISaC) does the same for the instructions an assistant follows. It borrows four habits from software: scripts for rules that can run, tests that can fail, a review date on every reference, and versions that reach every install.
The worked example is one real skill, our team’s standards for Terraform and pipelines. Each section states the habit, then shows it in that skill.
Why plain text is not enough
A skill drifts like any document. The tools it describes change, and nobody re-reads the file. When our skill moved from one engineer’s setup into a shared plugin, a check against the live repositories found four facts that were no longer true.
One of the four was worse than stale. The skill’s text said a formatting script touched only Terraform files. The script also formatted the .tfvars files, and failed on them. An assistant follows the text, so it would have offered a broken command as the safe one.
The skill still earns its place. In an A/B test, the assistant followed 10 of 12 team-specific rules with the skill and 0 of 12 without it. General security advice scored 3 of 3 either way.
The model already knows the general part. The team part is what the skill adds, so that part has to stay right. A skill can leave the general part out.
Words
- Skill. A Markdown file with a name and a description. The assistant reads the description to decide when to load the rest.
- Reference. A longer file the skill points to, loaded only when the task needs it.
- Eval. A test case for a skill. A prompt goes in, and a grader checks the reply.
- Version. A number in the skill’s manifest. Installed copies update only when it changes.
A router and three references
Keep the skill itself short, and put the rules in references it loads on demand. A skill that holds every rule costs context on every task.
Ours is a router of 64 lines. It maps the work in front of the assistant to one reference file, and it lists the few rules that always apply.
standards/
SKILL.md router, 64 lines
references/
terraform.md 128 lines
ado-pipelines.md 162 lines
github-actions.md 124 lines
The router tells the assistant, in bold, to load only the reference that matches the work. A pipeline change then reads one file of pipeline rules instead of four hundred lines that include Terraform.
Rules that can run become scripts
If a rule is a command with flags, ship the command. Judgement stays in the instructions. A script either works or fails, while instructions can describe one thing as the code does another.
Our formatting rule is the example. Pipelines replace tokens in .tfvars files at deploy time, so before that the files hold values that are not valid HCL. terraform fmt -recursive fails on them. The skill’s script checks only the files that parse:
find "$1" -name .terraform -prune \
-o -type f \( -name '*.tf' \
-o -name '*.tftest.hcl' \) -print0 |
xargs -0 -r terraform fmt -check -diff
The model needs the script even though it knows the risk. In the A/B test, the assistant without the skill warned that the tfvars would not parse, then gave terraform fmt -recursive anyway, in all three runs. With the skill, it pointed to the script in two of three runs. In the third, the skill did not load.
Tests that can fail
Write evals for two things. The skill must load when it should, and the reply must follow the rule. Ours has five cases. One asks the assistant to “just run terraform fmt -recursive” on a folder with tokenized tfvars. Its grader, an instruction to a second model, reads in part:
PASS if the reply warns that
terraform fmt -recursivewould also processvariables.tfvars, where the unquoted#{...}#token does not parse as HCL (…), and gives a command or script that formats only the*.tffiles (…).FAIL if the reply simply gives
terraform fmt -recursive Deployments/Terraformwithout the warning, or suggests quoting or editing the tokens to make fmt pass.
Every case also has a grader that checks the skill loaded at all. Loading is where an earlier version of this skill failed. Its description never said “terraform”, so a prompt about adding a storage account got a routing score of 0.22 out of 1, and the skill did not load.
The first fix added “storage account” to the description. Then a different skill, one that inspects live Azure resources, started losing its prompts to ours (0.75). The fix that held names the action the skill is for. This sentence in the description did it.
The trigger is changing, reviewing or designing infrastructure, never merely asking what is deployed.
A storage-account prompt now loads the skill when it asks for a change, and the other skill keeps the questions about what exists.
The first run of the five cases passed all of them, twice each. It had no baseline, so it showed the skill loads and follows its rules. Whether the skill beats no skill at all needed the separate A/B test.
A date on every reference
Give every reference a review date, and tell the skill what to do when the date is old. Ours carries the date in the frontmatter:
last-reviewed: 2026-09-22
The router adds a staleness guard. Before it applies a load-bearing rule from a reference older than 30 days, the assistant checks the live repository. When reality differs, it follows reality, names the stale rule, and suggests a pull request to the skill.
The date above is real. By the time this is published, all three of our references are past 30 days, and all three gained new review checks in October without a new date. The guard catches that at use time. Bumping the date is still a person’s job.
Versions that reach every install
Make a missing version bump fail CI. A shared skill is installed on every engineer’s machine, and the installed copy refreshes only when the version number in the manifest changes. A fix merged without a bump stays on the author’s machine.
Our check runs on every pull request. It compares each changed plugin and skill with the main branch, and it fails when the version did not move. Four versions shipped in the first four weeks. The check arrived after the third.
The version is written in more than one file, and the check only asks for a bump in what changed. One skill header still says 1.0.1 while the plugin is at 1.0.3. Nothing breaks, but a reader of that header gets the wrong number.
Everything together
The four habits fit in one plugin repository. The layout below is ours, trimmed, with the names made generic. Copy it as a starting point.
acme-marketplace/
.claude-plugin/marketplace.json
.github/workflows/
version-check.yml
plugins/acme-standards/
.claude-plugin/plugin.json
skills/
standards/
SKILL.md router
references/
terraform.md last-reviewed
pipelines.md last-reviewed
validate/
SKILL.md
scripts/fmt-check.sh
evals/
fmt-tokenized-tfvars/
prompt.md
graders/loaded.md
graders/rule.md
The version lives in plugin.json, and the workflow fails a pull request that changes the plugin without raising it. Run the evals with claude plugin eval . from the plugin folder. A full run adds a baseline with no plugin, so the same command gives you the A/B test.
A skeleton of the router:
---
name: standards
description: Team rules for Terraform
and pipelines. Load before
changing, reviewing or designing
infrastructure. Skip when the user
only asks what is deployed.
---
Load only the reference that matches
the work. Never load all of them.
- `*.tf`, `*.tfvars`:
references/terraform.md
- pipeline YAML:
references/pipelines.md
Each reference has `last-reviewed`.
If a reference is older than 30
days, check the live repo before
applying a load-bearing rule. If
reality differs, follow reality,
name the stale rule, and suggest a
pull request.
The checklist, in the order to build it:
- Keep the router short. The rules live in references that load one at a time.
- Ship commands as scripts. The instructions point to the script instead of restating its flags.
- Give every eval two graders. One checks that the skill loaded, one checks that the reply followed the rule.
- Date every reference. Add a staleness guard with a fixed number of days.
- Fail CI without a version bump. Installed copies only refresh when the version changes.
- Test against no skill once. The baseline run shows which rules the model already knew, so the skill can leave them out.
What this bought, and what stays manual
What it bought. The rules the model cannot know are written down once, tested on demand, dated, and shipped to every install through the same pull request flow as any other code. The formatting rule lives in a script, and the skill points to it instead of restating it.
What stays manual:
- Evals run by hand. CI checks the manifests and the version bump, not the replies.
- Nothing measures outcomes. We know the assistant follows the rules in the test cases. We do not know yet whether pull requests got better.
- Nobody counts installs. We cannot say how many engineers run the current version.
- Loading is the model’s call. One A/B run failed because the skill did not load at all, and a few runs per case only sample that decision.