Creating a schema extension

§ 1Purpose

Model topic-specific recurring data as its own typed blocks and project it into generated pages.

§ 2Prerequisites

§ 3Flowchart

1. Declare the blocks + a merging @document2. Author instances in data/3. Add a render to every template set

§ 4Steps

§ 4.11

§ 4.2Declare the blocks + a merging @document

wcl
// schema/extensions.wcl (or a dedicated module file)
namespace wcl.wskill

@block("keybinding")
type Keybinding {
  @inline(0) id: identifier
  keys:    utf8
  action:  utf8
  context: utf8?
}

@document
type KeybindingDoc {
  @children("keybinding") keybindings: list<Keybinding>
}

Declare an @block per shape (fields typed, @inline(0) id first) plus an @document gathering it. Imported @documents merge with the base, so the new list appears alongside concepts/facts. Keep it in schema/extensions.wcl, or in its own schema/<area>.wcl module for a large surface (the wcl wskill's builtins.wcl / cli.wcl pattern).

§ 4.32

§ 4.4Author instances in data/

wcl
// data/reference/keybindings.wcl
keybinding save   { keys = "Ctrl+S"  action = "Save the buffer" }
keybinding search { keys = "Ctrl+F"  action = "Find in file"    context = "editor" }

Write instances like any other unit; import the file from wskill.wcl (or the data aggregator). wcl check now validates them against your schema.

§ 4.53

§ 4.6Add a render to every template set

wcl
// wdoc/book/main.wcl and wdoc/skill/main.wcl (and pages/ where it fits)
wdoc_repeater { each = keybindings  as = :k
  p $"`${k.keys}` — ${k.action}"
}

Project the gathered list in BOTH the book and the skill templates — a table, a page per instance, or a wdoc_component for a full house-style page body (see Components). Extension data that renders in only one view drifts.

Verification

just wskill-check passes with instances present, and both the book and the skill show the new section on the next render.