spec-experiment
Guide a person through a pre-registered experiment on their AI-agent workflow: write the design before any run, get it approved and hashed, run it, keep an honest log and cost ledger, then write the r
Files3
View on GitHubSKILL.mdplugin/skills/spec-experiment/SKILL.md
GitHubExperiment
Answer "does this change actually help?" with a design that was fixed before the runs, so the
result can be trusted and shown to someone else. The spec-driven-dev experiment commands do
the bookkeeping (dated design, hash at approval, log, ledger, timesheet suggestions, results
scaffold). This skill does the thinking with the person.
Project config (read first)
Load .spec-driven.yml: walk up from the current directory to the home folder, and the first one
found wins. If {specs_dir}/team.yml exists, read it first and let .spec-driven.yml override
it. This skill uses these keys:
experiments.dir: where records live (defaultexperiments/). It may be an absolute path outside the code repo.--experiments=<dir>overrides it for one command.experiments.categories(defaultexperiment,supporting,admin) andexperiments.counted(defaultexperiment,supporting): timesheet categories and which of them count. These are the team's own choice. Never decide them yourself. The CLI records the category on each row; when summing time, count only theexperiments.countedcategories.
No config? Use the defaults and offer to save experiments.dir to .spec-driven.yml.
Step 1: Where the records live
Say where the records will go (experiments.dir). If the team prefers records outside the code
repo, or the config says so, suggest an absolute path. Nothing in this skill writes to the code
repo's source. It writes only inside the experiments folder.
Step 2: The question and the prior-art check
- Get the question in one sentence, for example "Does prompt B finish the same tasks cheaper than prompt A?"
- Ask why the answer is not already known. If the person expects "obviously yes" and cannot say why it is unknown, do not go on.
- Ask for a prior-art check. Search the docs, papers and the project's own earlier results
(
experiment ledgeroutput, old results notes). Write down what was found and what a competent practitioner would and would not know in advance. - If the answer is already known, say so plainly and stop. That is a good outcome.
Step 3: Write the design
- Run
spec-driven-dev experiment new <name>. It creates a dated draft from the template inreferences/design-template.md. - Fill every section with the person. Replace every
{...}placeholder. The approve command refuses while any remain. - Every number in the outcome rules (thresholds, run counts, what counts as a failed run) is fixed now, before any run. Ask "what result would change your mind?" and write it down.
- Add harm controls when the change could make things worse elsewhere (quality, safety, cost, other tasks). If it cannot, say why in one line.
- Build the decision table: each possible result, what it means, what happens next.
- Estimate cost per run times number of runs. Use earlier ledger means when they exist, and say where each number came from.
Step 4: Approval
- Show the whole design to the person.
- When they are happy, they approve it:
spec-driven-dev experiment approve <name> --by="<their name>". Use the name they give you. - Never approve on their behalf, and never invent a name for
--by. The hash and the LOG line show any edit made outsideamend, but plain files are not tamper-proof; keep designs under version control or a shared folder. - After approval the design does not change. A real change goes through
spec-driven-dev experiment amend <name> --reason="<why>" --by="<your name>", which logs the old hash, the new hash and the reason. Ask the person for the reason. Do not write it for them.
Step 5: Runs
- Run
spec-driven-dev experiment check <name>. If it fails, stop and tell the person why. - State the cost (runs times estimate) and ask for an explicit go. No go, no runs. A go for one batch is not a go for the next one.
- Run through
spec-driven-dev risk-eval ... --experiment=<name>or the team's own harness. - A failed run (crash, timeout, tool error) is re-run and excluded from the counts. Say how many were excluded. Never drop a run because its result is inconvenient.
- Record notable events with
spec-driven-dev experiment log "<text>"(a run started, a run failed, a cost surprise, an amendment). Log what happened, plainly.
Step 6: Results
- Run
spec-driven-dev experiment ledger, thenspec-driven-dev experiment results <name>. It writes a note pre-filled with the rules, decision table, runs and costs. - Write the reading with the person, following
references/results-template.md: find the decision table row the numbers fall in, and quote it. - If the result fits no row, or the mechanism contradicts the row, say so plainly. Do not follow the row's "next" anyway, and do not quietly rewrite the table.
- Report what went against the hypothesis as clearly as what supported it.
Step 7: Time (optional)
- Offer
spec-driven-dev experiment timesheet --since=<date>. It lists suggested work spans built only from the person's own typed messages, with the chosen gap and the 60-minute rule side by side. It reads only the experiments folder and the current folder by default;--repos=a,badds named workspace repos,--all-reposadds all plus the workspace root. Each span shows how many messages came from which folder. - Present the suggestions. The person confirms, edits or drops each one.
--writeappends them asunconfirmed. Only the person confirms. - Never raise hours above what the messages show. Never count agent run time.
- If asked to inflate, round up or invent time, decline and explain that records must reflect real work.
Rules
- Never fabricate a result, a run, a cost or a time.
- Never write a verdict the numbers do not support. The results scaffold has empty slots for the reading. Fill them with evidence only.
- Never start paid runs without the person's explicit go for the stated cost.
- Never approve a design for the person, and never run an unapproved or edited design.
- Never edit, delete or reorder lines in
LOG.md. Only append withexperiment log. - Never change a design after approval except through
amend. - Never edit recorded timesheet rows.
- Never name a company, product, country or tax or grant scheme in the design, results or log unless the person put it there. Do not judge eligibility for any scheme.
- Times are UTC with a trailing
Z.