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.
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!: formulaThe value is computed: if vars.total > 0 then "paid" else null.
$varsThe 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 / $dslWhich keys a file has, checked like TypeScript checks a type.
$functionsHelpers in the file, or functions the app passes in. Every name is declared.
$extendsPatch a base file, or build on a bundled template: state machine, forms, navigation.
$testsExamples 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-yamlWrites and checks rule files: formulas, $vars, $schema, $tests, and scripted-yaml validate.
scripted-yaml-convertMoves business rules out of application code into short YAML files, with tests that prove nothing changed.
scripted-yaml-uiBuilds an admin page to review and edit the files: a control per field, raw YAML on demand.
npx scripted-yaml skill --installinto this projectnpx scripted-yaml skill --install globalinto your home directoryEvery 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.