Extend refrakt

This handbook is for developers extending refrakt — writing custom runes, building themes, shipping plugins, or hooking into the build pipeline. If you're here to author content with refrakt's existing runes, head to the Docs handbook instead.

What lives here

Before you start

A few things worth knowing before you write your first rune:

  • Read Authoring overview first. It introduces createContentModelSchema, createComponentRenderable, and the identity-transform engine. Everything else in Extend assumes that mental model.
  • Runes almost always belong in a plugin, not in the core rune library. See the community package rune checklist.
  • The author-facing rune reference catalog is at /runes. Both audiences use it for different reasons — authors copy snippets, developers verify their own rune output.

Useful CLI commands

Even if your day-to-day is writing TypeScript and CSS, a few CLI commands are worth knowing:

  • refrakt inspect <rune> — see the HTML the identity transform produces for any rune. Indispensable when wiring up BEM CSS or debugging modifier classes.
  • refrakt contracts — generate the full structure contract (every BEM selector, data attribute, structural element) for the active rune set.
  • refrakt reference dump — emit the full rune syntax reference for the active plugin set. Used to regenerate AGENTS.md.