scripted-yaml

Business rules in YAML, resolved in TypeScript

Limits, permissions, prices and order states live in files you can read. Your app passes the facts in and gets plain data back: no rule buried in generated code.

npm install scripted-yamlGitHubnpm
The agent builds the app around the rules; the application code runs the rules from the YAML spec; the developer switches a rule and the app follows
A big circle of application code (React components, file operations, API requests, styling) and a small circle of business rules that defines it

Code does the work. Rules make the decisions.

  • TypeScript keeps the types, the I/O and the wiring.
  • YAML keeps the numbers, conditions and texts.
  • Anyone on the team can read a rule, and an agent cannot hide one.

Plain YAML, with a little sugar

key!: formula

The value is computed: if vars.total > 0 then "paid" else null.

$vars

The inputs the app must pass, with defaults. A missing one is an error, not a silent null.

$if! / $each!

Show an item to some users, or repeat it for each value.

{{ to_pay }}

Text with values in it, for messages and subjects.

$schema / $dsl

Which keys a file has, checked like TypeScript checks a type.

$functions

Helpers in the file, or functions the app passes in. Every name is declared.

$extends

Patch a base file, or build on a bundled template: state machine, forms, navigation.

$tests

Examples that run with scripted-yaml test, so a changed rule proves itself.

Skills for coding agents

Teach Claude Code, Codex or OpenCode to write rule files, move logic out of your code into them, and build an editor for them.

scripted-yaml

Writes and checks rule files: formulas, $vars, $schema, $tests, and scripted-yaml validate.

scripted-yaml-convert

Moves business rules out of application code into short YAML files, with tests that prove nothing changed.

scripted-yaml-ui

Builds an admin page to review and edit the files: a control per field, raw YAML on demand.

npx scripted-yaml skill --installinto this project
npx scripted-yaml skill --install globalinto your home directory

Every YAML file on this page is checked with scripted-yaml when the site is built, and every TypeScript snippet is type-checked against its API. The state machine above runs the library in your browser.