The Strata script creation protocol — when a script is required, run vs extend vs new, scaffolding with strata new script, manifest fields and side-effect classes, runtime choice, shared lib reuse, tests and the --format json contract, gates, catalog and linking. Use when an operation is repeatable and deterministic, before improvising a command you have run before, or when writing or changing anything under scripts/.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Strata Scriptsmith?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/zbmowrey-strata-scriptsmith)
---
name: strata-scriptsmith
description: The Strata script creation protocol — when a script is required, run vs extend vs new, scaffolding with strata new script, manifest fields and side-effect classes, runtime choice, shared lib reuse, tests and the --format json contract, gates, catalog and linking. Use when an operation is repeatable and deterministic, before improvising a command you have run before, or when writing or changing anything under scripts/.
tags: [strata, scripts]
---
# Writing Strata scripts
## Find first
`strata search '<need> kind:script'` · `strata scripts list` · then `strata run <id> -- <args>`.
| Situation | Action |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| A script fits | Run it. |
| Nearly fits; change additive, backward-compatible, current behavior tested | Extend: new flag, existing output byte-identical, new tests. |
| Change alters semantics, interface, output, side-effect class, or callers unknown | New script; move shared code into `scripts/lib/<runtime>/` first — never copy-paste. |
| Nothing fits and it will recur | `strata new script <domain>/<name> [--runtime go\|python]` |
| Genuinely one-off | Run ad hoc (repeats are detected and become garden tasks). |
## Manifest (`script.yaml`) — scaffold placeholders fail lint until filled
`id, summary, description, status, runtime, entry, usage, examples, inputs, outputs,
exit_codes, side_effect, writes, network, idempotent, deterministic, requires, env, timeout,
tags, applies_to, shards, tests, owner`.
Side-effect class = the **maximum** of any code path:
`read-only` (stdout only) · `writes-local` (repo files matching declared `writes` globs,
checked after each run) · `network` (declared hosts; prompts) · `destructive` (needs `--yes`).
Runtime: choose by purpose (D-041), passing `--runtime` to `strata new script`:
**Rust** when latency or resource use is the priority · **Python** when data science,
analysis or ML is central · **Go** for fast development, concurrency and orchestration ·
TypeScript only for JS-only ecosystems · Bash only for ≤ 40 lines of glue. A runtime other
than the instance default needs `runtime_justification` (≥ 40 chars) naming the purpose it
serves. Split a job whose parts need different runtimes into separate scripts joined by
`--format json` (e.g. a Go operator running a Rust indexer and a Python analysis via
`strata run`).
Quality bar for every runtime: strict static typing (no `Any`, no unchecked casts or
`unwrap`); formatters, linters, complexity limits and tests are the judges; simple beats
complex; a few lines of custom code beat a framework or dependency for a small need.
## Conventions
`--help` from `usage`; `--format text|json` with a stable JSON shape; errors on stderr;
exit codes per manifest; no prompts unless destructive; no undeclared network; no secrets
read from repo files; no shell interpolation (use the lib exec helpers). Go:
`scripts/lib/go` (`cli`, `out`, `repo`, `exec`, `fsx`); Python: `strata_lib` (`cli`, `out`,
`repo`, `proc`, `fsx`); Rust: `scripts/lib/rust` crate `strata_lib`, std only (`cli`,
`out`, `repo`, `exec`, `fsx`), one crate per script, built and cached by `strata run`.
## Done means
1. Manifest complete, `strata lint` clean, `side_effect` honest.
2. Tests: happy path, ≥ 1 error path, the `--format json` contract (golden file);
`deterministic: true` → a test proving identical output across two runs.
3. `strata check <script dir>` green (format, lint, types, complexity, security, tests).
4. Linked both ways: script `shards:` ↔ shard `scripts:`.
5. `strata scripts catalog`; `strata search '<summary terms>'` finds it.