Writing Swirls

Writing Swirls

Syntax, file discovery, embedded code, and common parser errors.

Use these references when writing .swirls files. To choose which declarations your system needs, start with the primitives map.

  • How it works: what happens between writing a file and a running system.
  • Syntax: comments, identifiers, values, schemas, and @ts / @json / @sql / @prisma blocks. The complete top-level block list lives here.
  • Multi-file workflows: splitting declarations across files. Swirls systems span as many files as you need.
  • Context: the context object inside @ts blocks (nodes, reviews, secrets, meta, iteration, db).
  • Common mistakes: the incorrect patterns people (and agents) write most often, with corrections.
  • Testing: mock and playbook blocks, swirls test, and validating suites with swirls doctor.