C.W.K.
Stream
Lesson 05 of 07 · published

Scripts — Determinism Inside a Skill

~14 min · skills, scripts, deterministic, shell

Level 0🌱 Novice
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Some steps shouldn't be the model's job

Skills can ship with executable scripts (bash, Python, Node) and call them from the body. The pattern: anything that must be deterministic — running tests, normalizing data, querying a service — goes in a script. The model orchestrates; the script executes.

Why: the model is great at judgment, mediocre at executing 12 sequential commands without typos. A bash script that runs the same pipeline every time is more reliable than asking Claude to remember the order of npm install + npm run build + npm test + parse output + format result.

Code

A Skill that calls its own script·markdown
---
name: bench-and-report
description: Run the project's benchmark suite and write a report.
invocation: explicit
paths:
  - scripts/run-bench.sh
  - templates/report.md
---

You are running performance benchmarks.

1. Execute scripts/run-bench.sh; capture stdout (machine-readable JSON)
2. Read templates/report.md
3. Fill in the template with bench results
4. Write the report to ./bench-report-$(date +%F).md
5. Highlight any regressions vs the previous report (if found in repo root)
scripts/run-bench.sh·bash
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"

# Run the actual bench (deterministic — same inputs, same outputs)
npm run bench -- --json > /tmp/bench-out.json

# Emit machine-readable JSON for the model to consume
jq '{
  ts: now | todate,
  results: .results,
  total_ms: .total_ms
}' /tmp/bench-out.json

External links

Exercise

Add a script to one of your Skills that does the deterministic part (run a tool, query a service, normalize data). Have the body call the script and consume its output. Verify the Skill is now resilient to model paraphrasing.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.