[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72S9G6ZDAWSX5CQ4D9MWPYF":3,"skill-same:01M72S9G6ZDAWSX5CQ4D9MWPYF":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M72S9G6ZDAWSX5CQ4D9MWPYF","fsharp-code-generation",null,"Emit governance artifacts (Markdown\u002FMermaid\u002FJSON) and generate typed F# source; when NOT to use code quotations.","EHotwagner\u002FFS-Skia-UI","EHotwagner","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1645484?v=4","01M72S7CTBDPQDQHQJKKHY87K9","01M72S7CVFD0JN82RVX21NFEVC",2,"MIT","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffsharp-code-generation\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: fsharp-code-generation\ndescription: Emit governance artifacts (Markdown\u002FMermaid\u002FJSON) and generate typed F# source; when NOT to use code quotations.\ncompatibility: F# governance library (build\u002FGovernance) under net10.0; build-tooling scope only.\nmetadata:\n  author: fs-skia-ui\n  source: docs\u002Freports\u002F2026-05-31-1714-foundations-fsharp-capabilities-and-libraries.md\n---\n\n# fsharp-code-generation\n\nCookbook for the two *different* generation jobs in the port — keeping C10\u002FC11 (text) distinct from C12\n(F# source) is its main pitfall. Owns **C10** (document\u002Ftext generation — `task-graph.md` Mermaid +\nASCII tree + count tables), **C11** (document generation + currency check — `.claude\u002Fskills\u002F**` from\n`.agents\u002Fskills\u002F**`, skillist render), **C12** (one-shot F# *source* generation), and **C13** (the\nfeature-066 single-source *product-surface* catalog generator — one canonical `catalogFacts` table\nspliced into both `catalog.yml` and `Catalog.fs`, drift-guarded by `ControlsCatalogGenerationCheck`).\nVerdicts from the capability report (`metadata.source`) §5.\n\n## When to use\n\n- Rendering `task-graph.md` (Mermaid `graph TD`, ASCII `└──` tree, count tables) and `task-graph.json`.\n- Generating `.claude\u002Fskills\u002F**` from `.agents\u002Fskills\u002F**` and rendering the `tasks.md` skillist from\n  `tasks.deps.yml`, **with a currency check** that fails when the on-disk copy is stale.\n- The single F#-source job: turning `capabilities.yml` into a typed `Config.fs` (Stage-3 migration).\n\n## Library verdicts\n\n- **Document\u002Fartifact generation (C10, C11) → NO library.** Plain typed rendering — `StringBuilder` for\n  Markdown\u002FMermaid\u002FASCII, `Utf8JsonWriter` for JSON — so output is **deterministic and byte-comparable**\n  to the Stage-0 golden fixtures (Invariant 6). **FSharp.Formatting \u002F Markdig rejected** for *emitting*\n  these constrained artifacts.\n- **Currency check (C11) → DiffPlex 1.9.0.** Regenerate to a string, diff against disk, fail if stale —\n  strictly better than today's unguarded drift. See [[fsharp-io-globbing]].\n- **F# source generation (C12) → Fabulous.AST + Fantomas (one-shot, preferred) or Myriad\n  (recurring).** The ONLY genuine F#-source job. **Code quotations rejected** (see below).\n\n## Exact rule to reproduce (parity-critical)\n\nRendered artifacts MUST be reproducible **byte-for-byte** (stable ordering, no clock\u002Fenv in output)\nso the golden diff (Invariant 6) is meaningful. Match the Python's exact spacing, connector glyphs\n(`├── ` \u002F `└── `), and key ordering before deleting it.\n\n## API walkthrough + runnable examples\n\n### C10 — Mermaid `graph TD` (StringBuilder)\n\n```fsharp\nopen System.Text\n\nlet renderMermaid (edges: (string * string) list) =\n    let sb = StringBuilder()\n    sb.AppendLine \"graph TD\" |> ignore\n\n    for source, target in edges do\n        sb.AppendLine(sprintf \"  %s --> %s\" source target) |> ignore\n\n    sb.ToString()\n```\n\n### C10 — ASCII dependency tree (stable connector glyphs)\n\n```fsharp\nopen System.Text\n\nlet renderTree (root: string) (children: string list) =\n    let sb = StringBuilder()\n    sb.AppendLine root |> ignore\n    let last = List.length children - 1\n\n    children\n    |> List.iteri (fun i child ->\n        let connector = if i = last then \"└── \" else \"├── \"\n        sb.AppendLine(connector + child) |> ignore)\n\n    sb.ToString()\n```\n\n### C10 — count table\n\n```fsharp\nopen System.Text\n\nlet renderCounts (rows: (string * int) list) =\n    let sb = StringBuilder()\n    sb.AppendLine \"| Status | Count |\" |> ignore\n    sb.AppendLine \"|--------|-------|\" |> ignore\n\n    for label, count in rows do\n        sb.AppendLine(sprintf \"| %s | %d |\" label count) |> ignore\n\n    sb.ToString()\n```\n\n### C11 — generation-currency check (DiffPlex)\n\nRegenerate into memory, diff against the committed copy, fail when they differ. `InlineDiffBuilder`\nover a `Differ()` gives a line model whose `Type` flags the drift.\n\n```fsharp\nopen DiffPlex\nopen DiffPlex.DiffBuilder\nopen DiffPlex.DiffBuilder.Model\n\nlet private model (current: string) (regenerated: string) =\n    InlineDiffBuilder(Differ()).BuildDiffModel(current, regenerated)\n\n\u002F\u002F\u002F True when the committed copy no longer matches a fresh regeneration.\nlet isStale (current: string) (regenerated: string) =\n    (model current regenerated).Lines\n    |> Seq.exists (fun line -> line.Type \u003C> ChangeType.Unchanged)\n\n\u002F\u002F\u002F Readable per-line drift for the failure report.\nlet staleLines (current: string) (regenerated: string) =\n    (model current regenerated).Lines\n    |> Seq.filter (fun line -> line.Type \u003C> ChangeType.Unchanged)\n    |> Seq.map (fun line -> sprintf \"%A | %s\" line.Type line.Text)\n    |> Seq.toList\n```\n\n### C5 link — JSON artifacts (`Utf8JsonWriter`)\n\n`task-graph.json` (schema 1.0) is emitted with `Utf8JsonWriter` for byte-stable layout — the C5\ntechnique from [[fsharp-parsing]]. Keep one renderer so JSON and Markdown stay lock-step with the\ngolden fixtures.\n\n### C12 — F# source generation (prose; NOT in the adopt-set examples project)\n\nThe single genuine F#-*source* job is turning `capabilities.yml` into a typed `Config.fs` during the\nYAML→compiled-F# migration (config ADR D6).\n\n- **Fabulous.AST + Fantomas** — a DSL over Fantomas's Oak AST; describe the F# as a node tree, Fantomas\n  pretty-prints style-correct source. Best for **one-shot\u002Foccasional** generation, **preferred** because\n  D6 points at hand-owned compiled values (no permanent build dependency).\n- **Myriad** (v0.85) — a **pre-build plugin** wired into the `.fsproj` (`\u003CMyriadFile>`), regenerating\n  every build. Choose only if the catalog must **stay as data** and be compiled each build.\n\nNeither package is in the adopt set, so C12 stays prose — record the chosen path in the Stage-5 ADR\nbefore adding the dependency.\n\n### C13 — product-surface catalog generation (feature 066, worked example)\n\nThe catalog generator is the **first product-surface generator** and the template every later\nsingle-source generator (design tokens in `069`, catalog expansion in `071+`) copies. It is the same\nsingle-source discipline as C11 (`.claude`←`.agents`) and `validation.contract.yml`←`Routing.fs`,\napplied to the typed-control catalog. The whole generator is `FS.Skia.UI.Build.CatalogGen`\n(`build\u002FGovernance\u002FCatalogGen.fsi`\u002F`.fs`); like C10–C12 it is pure rendering + currency over in-memory\ntext, with every filesystem read\u002Fwrite kept at the `Engine\u002FInterpret.fs` edge (Principle IV).\n\n**One canonical source, two generated artifacts.** A single typed value —\n`catalogFacts : TypedCatalogFact list` (51 rows: the six 065-seeded controls plus the 072 expansion) —\nis the one place each catalog fact is declared. Two artifacts are generated from it:\n\n- `catalog.yml` (`catalogYmlRel`) — rendered per row by `renderYamlRow`, spliced by `spliceYaml`.\n- `Catalog.fs` (`catalogFsRel`) — rendered per row by `renderFSharpRow`, spliced by `spliceFSharp`.\n\n**Splice only the marked regions — never the whole file.** Each renderer writes its row into that\ncontrol's `typed-catalog\u002F\u003Cid>` marked region (`\u002F\u002F BEGIN GENERATED: typed-catalog\u002F\u003Cid>` …\n`\u002F\u002F END GENERATED: typed-catalog\u002F\u003Cid>`). Every byte **outside** a marker — the hand-authored rows that\nare not part of `catalogFacts`, the file preamble, unknown marker ids — is left untouched, and the\nsplice is idempotent on an already-current file. This is what lets a single fact table coexist with\nhand-maintained catalog content in the same two files.\n\n**Regenerate via `RegenerateCatalog`, inside `RefreshSurfaceBaselines`.** To add or change a catalog\nrow, edit `catalogFacts` (and the typed module it names), then run\n`.\u002Ffake.sh build -t RefreshSurfaceBaselines` — which runs `RegenerateCatalog` to re-splice both\nartifacts. **Never hand-edit a generated `typed-catalog\u002F\u003Cid>` region**: the drift gate will fail it.\n\n**The drift gate: `ControlsCatalogGenerationCheck`.** It re-renders `catalogFacts` in memory and\ncompares each on-disk region against the fresh render via `currency : catalogYmlText -> catalogFsText\n-> CatalogCurrency list` (each region is `Current`\u002F`Stale`\u002F`Missing`); the file set is clean iff\n`isCurrent` is true. On drift, `currencyDrift` returns one actionable line per stale\u002Fmissing region,\nnaming the divergent control, the file, and `.\u002Ffake.sh build -t RefreshSurfaceBaselines` as the fix —\nso a hand-edited generated region (or a `catalogFacts` change with no regen) fails the gate with a\npointer at the regeneration target, exactly like C11's `isStale`\u002F`staleLines` currency check.\n\n**Cross-check against the typed surface.** Each row's `Module` and `RequiredAttributes` facts are\ncross-checked against the `FS.Skia.UI.Controls.Typed` surface, so the catalog cannot claim a typed\ncontrol or required attribute the typed front door does not actually expose. (Authoring that typed\nsurface is [[fs-skia-typed-controls]]'s job; this generator records and drift-guards the catalog facts\nabout it.)\n\n```fsharp\nopen FS.Skia.UI.Build\n\n\u002F\u002F Single source: one fact per typed control. (abbreviated — real rows carry purpose\u002Fevents\u002Frole)\nlet catalogFacts : CatalogGen.TypedCatalogFact list =\n    [ { Id = \"button\"; DisplayName = \"Button\"; Category = \"input\"; Module = \"Button\"\n        Purpose = \"Pointer and keyboard activatable command.\"\n        RequiredAttributes = [ \"text\" ]; Events = [ \"onClick\" ]; AccessibilityRole = \"Button\" }\n      \u002F\u002F … 50 more rows … ]\n\n\u002F\u002F Regeneration re-splices ONLY the typed-catalog\u002F\u003Cid> regions of both files.\nlet regeneratedFs  = CatalogGen.spliceFSharp (System.IO.File.ReadAllText CatalogGen.catalogFsRel)\nlet regeneratedYml = CatalogGen.spliceYaml   (System.IO.File.ReadAllText CatalogGen.catalogYmlRel)\n\n\u002F\u002F Drift gate: clean iff every region matches a fresh render; else currencyDrift names the fix.\nlet regions = CatalogGen.currency regeneratedYml regeneratedFs\nif not (CatalogGen.isCurrent regions) then\n    CatalogGen.currencyDrift regions  \u002F\u002F e.g. \"catalog.yml is stale — its typed-catalog\u002Fbutton region … Regenerate via .\u002Ffake.sh build -t RefreshSurfaceBaselines.\"\n    |> List.iter (eprintfn \"%s\")\n```\n\n## Pitfall: code quotations are the WRONG tool — reject\n\nF# code quotations (`\u003C@ … @>`) are **runtime metaprogramming** producing `Expr` trees evaluated at run\ntime — they do **not** emit source or build artifacts, and would re-introduce the runtime-evaluation\ntax the foundations programme is removing (config ADR D6, no-FCS stance). Do not use them for the\ngovernance port; noted only to prevent the common conflation with source generation.\n\n## Library API + runnable example\n\nThe document renderers now ship as the real `CodeGen` module in the **`FS.Skia.UI.SkillSupport`**\npackage — its `.fsi` surface lives at `src\u002FSkillSupport\u002FCodeGen.fsi`. `FS.Skia.UI.Build` consumes the\nsame code via ProjectReference, so the governance build renders through exactly these functions:\n\n- `CodeGen.mermaidGraph` — render `graph TD` Mermaid from edge pairs.\n- `CodeGen.markdownTable` — render a Markdown count\u002Fstatus table from header + rows.\n- `CodeGen.asciiTree` — render the `├── `\u002F`└── ` ASCII dependency tree (stable connector glyphs).\n\n```fsharp\nopen FS.Skia.UI.SkillSupport\n\nlet edges = [ (\"T001\", \"T002\"); (\"T002\", \"T003\") ]\nlet mermaid = CodeGen.mermaidGraph edges      \u002F\u002F \"graph TD\\n  T001 --> T002\\n  ...\"\n\nlet table = CodeGen.markdownTable [ \"Status\"; \"Count\" ] [ [ \"done\"; \"3\" ]; [ \"pending\"; \"1\" ] ]\n\nlet tree = CodeGen.asciiTree \"root\" [ \"T001\"; \"T002\" ]   \u002F\u002F root\\n├── T001\\n└── T002\n```\n\n## Cautions\n\n- **Determinism.** Rendered artifacts reproducible byte-for-byte (no clock\u002Fenv, stable ordering) so\n  golden diffs are meaningful.\n- **Do not conflate C10\u002FC11 (text) with C12 (F# source).** Most \"generation\" in the port is text\n  rendering with no library; only `Config.fs` is real source generation.\n- **Build-tooling scope only.** No FCS; ships nowhere.\n\n## Consuming stages\n\nStage 2 (`GenerateAgentSkills` + skillist render + currency check), Stage 4 (`task-graph.md` \u002F\n`task-graph.json` render), Stage 3.3\u002F5.5 (the one-shot `Config.fs` generation). See the plan in\n`metadata.source`.\n\n## Persistent problems\n\nWhen a problem outlasts reasonable in-repo attempts, extensive external research is\n**mandatory** — consult **official online docs first** (the F#\u002F.NET docs and the driven\nlibrary's own documentation\u002FAPI reference), then community sources (forums, Reddit, Q&A\nsites, issue trackers and changelogs). Record the findings and resolving links in the\nfeature's `specs\u002F\u003Cfeature>\u002Ffeedback\u002F` folder and, for durable lessons, in this skill's\n**Sources** line. Offline, the mandate degrades to recording \"research blocked — \u003Cwhy>\"\nrather than hard-failing the phase.\n\n## Sources \u002F links\n\n- DiffPlex: \u003Chttps:\u002F\u002Fgithub.com\u002Fmmanela\u002Fdiffplex>\n- `Utf8JsonWriter`: \u003Chttps:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fsystem.text.json.utf8jsonwriter>\n- Fabulous.AST: \u003Chttps:\u002F\u002Fgithub.com\u002Fedgarfgp\u002FFabulous.AST> · Fantomas: \u003Chttps:\u002F\u002Ffsprojects.github.io\u002Ffantomas\u002F>\n- Myriad: \u003Chttps:\u002F\u002Fgithub.com\u002FMoiraeSoftware\u002Fmyriad>\n- Capability report: `docs\u002Freports\u002F2026-05-31-1714-foundations-fsharp-capabilities-and-libraries.md` §5.\n\n## Related\n\n[[fsharp-parsing]], [[fsharp-graph-algorithms]] (produce the model rendered here),\n[[fsharp-io-globbing]] (currency-check diffing), [[fsharp-build-orchestration]] (DiffPlex also backs\nthe golden-parity gate), [[fs-skia-typed-controls]] (authors the typed front door that C13's\n`catalogFacts` `Module`\u002Frequired-attribute facts are cross-checked against; typed authoring is the\npreferred front door it owns).\n","# fsharp-code-generation\n\nCookbook for the two *different* generation jobs in the port — keeping C10\u002FC11 (text) distinct from C12\n(F# source) is its main pitfall. Owns **C10** (document\u002Ftext generation — `task-graph.md` Mermaid +\nASCII tree + count tables), **C11** (document generation + currency check — `.claude\u002Fskills\u002F**` from\n`.agents\u002Fskills\u002F**`, skillist render), **C12** (one-shot F# *source* generation), and **C13** (the\nfeature-066 single-source *product-surface* catalog generator — one canonical `catalogFacts` table\nspliced into both `catalog.yml` and `Catalog.fs`, drift-guarded by `ControlsCatalogGenerationCheck`).\nVerdicts from the capability report (`metadata.source`) §5.\n\n## When to use\n\n- Rendering `task-graph.md` (Mermaid `graph TD`, ASCII `└──` tree, count tables) and `task-graph.json`.\n- Generating `.claude\u002Fskills\u002F**` from `.agents\u002Fskills\u002F**` and rendering the `tasks.md` skillist from\n  `tasks.deps.yml`, **with a currency check** that fails when the on-disk copy is stale.\n- The single F#-source job: turning `capabilities.yml` into a typed `Config.fs` (Stage-3 migration).\n\n## Library verdicts\n\n- **Document\u002Fartifact generation (C10, C11) → NO library.** Plain typed rendering — `StringBuilder` for\n  Markdown\u002FMermaid\u002FASCII, `Utf8JsonWriter` for JSON — so output is **deterministic and byte-comparable**\n  to the Stage-0 golden fixtures (Invariant 6). **FSharp.Formatting \u002F Markdig rejected** for *emitting*\n  these constrained artifacts.\n- **Currency check (C11) → DiffPlex 1.9.0.** Regenerate to a string, diff against disk, fail if stale —\n  strictly better than today's unguarded drift. See [[fsharp-io-globbing]].\n- **F# source generation (C12) → Fabulous.AST + Fantomas (one-shot, preferred) or Myriad\n  (recurring).** The ONLY genuine F#-source job. **Code quotations rejected** (see below).\n\n## Exact rule to reproduce (parity-critical)\n\nRendered artifacts MUST be reproducible **byte-for-byte** (stable ordering, no clock\u002Fenv in output)\nso the golden diff (Invariant 6) is meaningful. Match the Python's exact spacing, connector glyphs\n(`├── ` \u002F `└── `), and key ordering before deleting it.\n\n## API walkthrough + runnable examples\n\n### C10 — Mermaid `graph TD` (StringBuilder)\n\n```fsharp\nopen System.Text\n\nlet renderMermaid (edges: (string * string) list) =\n    let sb = StringBuilder()\n    sb.AppendLine \"graph TD\" |> ignore\n\n    for source, target in edges do\n        sb.AppendLine(sprintf \"  %s --> %s\" source target) |> ignore\n\n    sb.ToString()\n```\n\n### C10 — ASCII dependency tree (stable connector glyphs)\n\n```fsharp\nopen System.Text\n\nlet renderTree (root: string) (children: string list) =\n    let sb = StringBuilder()\n    sb.AppendLine root |> ignore\n    let last = List.length children - 1\n\n    children\n    |> List.iteri (fun i child ->\n        let connector = if i = last then \"└── \" else \"├── \"\n        sb.AppendLine(connector + child) |> ignore)\n\n    sb.ToString()\n```\n\n### C10 — count table\n\n```fsharp\nopen System.Text\n\nlet renderCounts (rows: (string * int) list) =\n    let sb = StringBuilder()\n    sb.AppendLine \"| Status | Count |\" |> ignore\n    sb.AppendLine \"|--------|-------|\" |> ignore\n\n    for label, count in rows do\n        sb.AppendLine(sprintf \"| %s | %d |\" label count) |> ignore\n\n    sb.ToString()\n```\n\n### C11 — generation-currency check (DiffPlex)\n\nRegenerate into memory, diff against the committed copy, fail when they differ. `InlineDiffBuilder`\nover a `Differ()` gives a line model whose `Type` flags the drift.\n\n```fsharp\nopen DiffPlex\nopen DiffPlex.DiffBuilder\nopen DiffPlex.DiffBuilder.Model\n\nlet private model (current: string) (regenerated: string) =\n    InlineDiffBuilder(Differ()).BuildDiffModel(current, regenerated)\n\n\u002F\u002F\u002F True when the committed copy no longer matches a fresh regeneration.\nlet isStale (current: string) (regenerated: string) =\n    (model current regenerated).Lines\n    |> Seq.exists (fun line -> line.Type \u003C> ChangeType.Unchanged)\n\n\u002F\u002F\u002F Readable per-line drift for the failure report.\nlet staleLines (current: string) (regenerated: string) =\n    (model current regenerated).Lines\n    |> Seq.filter (fun line -> line.Type \u003C> ChangeType.Unchanged)\n    |> Seq.map (fun line -> sprintf \"%A | %s\" line.Type line.Text)\n    |> Seq.toList\n```\n\n### C5 link — JSON artifacts (`Utf8JsonWriter`)\n\n`task-graph.json` (schema 1.0) is emitted with `Utf8JsonWriter` for byte-stable layout — the C5\ntechnique from [[fsharp-parsing]]. Keep one renderer so JSON and Markdown stay lock-step with the\ngolden fixtures.\n\n### C12 — F# source generation (prose; NOT in the adopt-set examples project)\n\nThe single genuine F#-*source* job is turning `capabilities.yml` into a typed `Config.fs` during the\nYAML→compiled-F# migration (config ADR D6).\n\n- **Fabulous.AST + Fantomas** — a DSL over Fantomas's Oak AST; describe the F# as a node tree, Fantomas\n  pretty-prints style-correct source. Best for **one-shot\u002Foccasional** generation, **preferred** because\n  D6 points at hand-owned compiled values (no permanent build dependency).\n- **Myriad** (v0.85) — a **pre-build plugin** wired into the `.fsproj` (`\u003CMyriadFile>`), regenerating\n  every build. Choose only if the catalog must **stay as data** and be compiled each build.\n\nNeither package is in the adopt set, so C12 stays prose — record the chosen path in the Stage-5 ADR\nbefore adding the dependency.\n\n### C13 — product-surface catalog generation (feature 066, worked example)\n\nThe catalog generator is the **first product-surface generator** and the template every later\nsingle-source generator (design tokens in `069`, catalog expansion in `071+`) copies. It is the same\nsingle-source discipline as C11 (`.claude`←`.agents`) and `validation.contract.yml`←`Routing.fs`,\napplied to the typed-control catalog. The whole generator is `FS.Skia.UI.Build.CatalogGen`\n(`build\u002FGovernance\u002FCatalogGen.fsi`\u002F`.fs`); like C10–C12 it is pure rendering + currency over in-memory\ntext, with every filesystem read\u002Fwrite kept at the `Engine\u002FInterpret.fs` edge (Principle IV).\n\n**One canonical source, two generated artifacts.** A single typed value —\n`catalogFacts : TypedCatalogFact list` (51 rows: the six 065-seeded controls plus the 072 expansion) —\nis the one place each catalog fact is declared. Two artifacts are generated from it:\n\n- `catalog.yml` (`catalogYmlRel`) — rendered per row by `renderYamlRow`, spliced by `spliceYaml`.\n- `Catalog.fs` (`catalogFsRel`) — rendered per row by `renderFSharpRow`, spliced by `spliceFSharp`.\n\n**Splice only the marked regions — never the whole file.** Each renderer writes its row into that\ncontrol's `typed-catalog\u002F\u003Cid>` marked region (`\u002F\u002F BEGIN GENERATED: typed-catalog\u002F\u003Cid>` …\n`\u002F\u002F END GENERATED: typed-catalog\u002F\u003Cid>`). Every byte **outside** a marker — the hand-authored rows that\nare not part of `catalogFacts`, the file preamble, unknown marker ids — is left untouched, and the\nsplice is idempotent on an already-current file. This is what lets a single fact table coexist with\nhand-maintained catalog content in the same two files.\n\n**Regenerate via `RegenerateCatalog`, inside `RefreshSurfaceBaselines`.** To add or change a catalog\nrow, edit `catalogFacts` (and the typed module it names), then run\n`.\u002Ffake.sh build -t RefreshSurfaceBaselines` — which runs `RegenerateCatalog` to re-splice both\nartifacts. **Never hand-edit a generated `typed-catalog\u002F\u003Cid>` region**: the drift gate will fail it.\n\n**The drift gate: `ControlsCatalogGenerationCheck`.** It re-renders `catalogFacts` in memory and\ncompares each on-disk region against the fresh render via `currency : catalogYmlText -> catalogFsText\n-> CatalogCurrency list` (each region is `Current`\u002F`Stale`\u002F`Missing`); the file set is clean iff\n`isCurrent` is true. On drift, `currencyDrift` returns one actionable line per stale\u002Fmissing region,\nnaming the divergent control, the file, and `.\u002Ffake.sh build -t RefreshSurfaceBaselines` as the fix —\nso a hand-edited generated region (or a `catalogFacts` change with no regen) fails the gate with a\npointer at the regeneration target, exactly like C11's `isStale`\u002F`staleLines` currency check.\n\n**Cross-check against the typed surface.** Each row's `Module` and `RequiredAttributes` facts are\ncross-checked against the `FS.Skia.UI.Controls.Typed` surface, so the catalog cannot claim a typed\ncontrol or required attribute the typed front door does not actually expose. (Authoring that typed\nsurface is [[fs-skia-typed-controls]]'s job; this generator records and drift-guards the catalog facts\nabout it.)\n\n```fsharp\nopen FS.Skia.UI.Build\n\n\u002F\u002F Single source: one fact per typed control. (abbreviated — real rows carry purpose\u002Fevents\u002Frole)\nlet catalogFacts : CatalogGen.TypedCatalogFact list =\n    [ { Id = \"button\"; DisplayName = \"Button\"; Category = \"input\"; Module = \"Button\"\n        Purpose = \"Pointer and keyboard activatable command.\"\n        RequiredAttributes = [ \"text\" ]; Events = [ \"onClick\" ]; AccessibilityRole = \"Button\" }\n      \u002F\u002F … 50 more rows … ]\n\n\u002F\u002F Regeneration re-splices ONLY the typed-catalog\u002F\u003Cid> regions of both files.\nlet regeneratedFs  = CatalogGen.spliceFSharp (System.IO.File.ReadAllText CatalogGen.catalogFsRel)\nlet regeneratedYml = CatalogGen.spliceYaml   (System.IO.File.ReadAllText CatalogGen.catalogYmlRel)\n\n\u002F\u002F Drift gate: clean iff every region matches a fresh render; else currencyDrift names the fix.\nlet regions = CatalogGen.currency regeneratedYml regeneratedFs\nif not (CatalogGen.isCurrent regions) then\n    CatalogGen.currencyDrift regions  \u002F\u002F e.g. \"catalog.yml is stale — its typed-catalog\u002Fbutton region … Regenerate via .\u002Ffake.sh build -t RefreshSurfaceBaselines.\"\n    |> List.iter (eprintfn \"%s\")\n```\n\n## Pitfall: code quotations are the WRONG tool — reject\n\nF# code quotations (`\u003C@ … @>`) are **runtime metaprogramming** producing `Expr` trees evaluated at run\ntime — they do **not** emit source or build artifacts, and would re-introduce the runtime-evaluation\ntax the foundations programme is removing (config ADR D6, no-FCS stance). Do not use them for the\ngovernance port; noted only to prevent the common conflation with source generation.\n\n## Library API + runnable example\n\nThe document renderers now ship as the real `CodeGen` module in the **`FS.Skia.UI.SkillSupport`**\npackage — its `.fsi` surface lives at `src\u002FSkillSupport\u002FCodeGen.fsi`. `FS.Skia.UI.Build` consumes the\nsame code via ProjectReference, so the governance build renders through exactly these functions:\n\n- `CodeGen.mermaidGraph` — render `graph TD` Mermaid from edge pairs.\n- `CodeGen.markdownTable` — render a Markdown count\u002Fstatus table from header + rows.\n- `CodeGen.asciiTree` — render the `├── `\u002F`└── ` ASCII dependency tree (stable connector glyphs).\n\n```fsharp\nopen FS.Skia.UI.SkillSupport\n\nlet edges = [ (\"T001\", \"T002\"); (\"T002\", \"T003\") ]\nlet mermaid = CodeGen.mermaidGraph edges      \u002F\u002F \"graph TD\\n  T001 --> T002\\n  ...\"\n\nlet table = CodeGen.markdownTable [ \"Status\"; \"Count\" ] [ [ \"done\"; \"3\" ]; [ \"pending\"; \"1\" ] ]\n\nlet tree = CodeGen.asciiTree \"root\" [ \"T001\"; \"T002\" ]   \u002F\u002F root\\n├── T001\\n└── T002\n```\n\n## Cautions\n\n- **Determinism.** Rendered artifacts reproducible byte-for-byte (no clock\u002Fenv, stable ordering) so\n  golden diffs are meaningful.\n- **Do not conflate C10\u002FC11 (text) with C12 (F# source).** Most \"generation\" in the port is text\n  rendering with no library; only `Config.fs` is real source generation.\n- **Build-tooling scope only.** No FCS; ships nowhere.\n\n## Consuming stages\n\nStage 2 (`GenerateAgentSkills` + skillist render + currency check), Stage 4 (`task-graph.md` \u002F\n`task-graph.json` render), Stage 3.3\u002F5.5 (the one-shot `Config.fs` generation). See the plan in\n`metadata.source`.\n\n## Persistent problems\n\nWhen a problem outlasts reasonable in-repo attempts, extensive external research is\n**mandatory** — consult **official online docs first** (the F#\u002F.NET docs and the driven\nlibrary's own documentation\u002FAPI reference), then community sources (forums, Reddit, Q&A\nsites, issue trackers and changelogs). Record the findings and resolving links in the\nfeature's `specs\u002F\u003Cfeature>\u002Ffeedback\u002F` folder and, for durable lessons, in this skill's\n**Sources** line. Offline, the mandate degrades to recording \"research blocked — \u003Cwhy>\"\nrather than hard-failing the phase.\n\n## Sources \u002F links\n\n- DiffPlex: \u003Chttps:\u002F\u002Fgithub.com\u002Fmmanela\u002Fdiffplex>\n- `Utf8JsonWriter`: \u003Chttps:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fsystem.text.json.utf8jsonwriter>\n- Fabulous.AST: \u003Chttps:\u002F\u002Fgithub.com\u002Fedgarfgp\u002FFabulous.AST> · Fantomas: \u003Chttps:\u002F\u002Ffsprojects.github.io\u002Ffantomas\u002F>\n- Myriad: \u003Chttps:\u002F\u002Fgithub.com\u002FMoiraeSoftware\u002Fmyriad>\n- Capability report: `docs\u002Freports\u002F2026-05-31-1714-foundations-fsharp-capabilities-and-libraries.md` §5.\n\n## Related\n\n[[fsharp-parsing]], [[fsharp-graph-algorithms]] (produce the model rendered here),\n[[fsharp-io-globbing]] (currency-check diffing), [[fsharp-build-orchestration]] (DiffPlex also backs\nthe golden-parity gate), [[fs-skia-typed-controls]] (authors the typed front door that C13's\n`catalogFacts` `Module`\u002Frequired-attribute facts are cross-checked against; typed authoring is the\npreferred front door it owns).\n",{"name":5,"metadata":23,"description":7,"compatibility":26},{"author":24,"source":25},"fs-skia-ui","docs\u002Freports\u002F2026-05-31-1714-foundations-fsharp-capabilities-and-libraries.md","F# governance library (build\u002FGovernance) under net10.0; build-tooling scope only.","main","f943406829a9218b2882e09eb88d4ddb539c5e72",".agents\u002Fskills\u002Ffsharp-code-generation",0,"https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI","https:\u002F\u002Fgithub.com\u002FEHotwagner","2026-06-16 16:16:52",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add EHotwagner\u002FFS-Skia-UI --skill fsharp-code-generation",{"tool":40,"command":41},"bunx","bunx skills add EHotwagner\u002FFS-Skia-UI --skill fsharp-code-generation",{"tool":43,"command":44},"pnpm","pnpm dlx skills add EHotwagner\u002FFS-Skia-UI --skill fsharp-code-generation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffsharp-code-generation\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":18},"01M72SGYR4T02T1HTS175E0V86","fs-skia-ui-widgets","Generated product guidance for Skia-rendered FS.Skia.UI Controls, rich text, chart controls, graph controls, DataGrid, and custom wrappers.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-ui-widgets\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":18},"01M72SGVZJR1B117QK7TCC6E0J","fs-skia-testing","Assert generated-product expectations and evidence in a governed FS.Skia.UI product.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-testing\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M72SGTC5HZYEVVVZT4X51AZ3","fs-skia-skiaviewer","Wire a generated FS.Skia.UI product to the desktop viewer host.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-skiaviewer\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M72SGS47RPYPC9JTC39CC6EF","fs-skia-scene","Build pure scene descriptions in a generated FS.Skia.UI product.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-scene\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M72SGQF4G76C4NGSF69KZRRF","fs-skia-keyboard-input","Map keyboard input to product commands in a generated FS.Skia.UI product.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-keyboard-input\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M72SGNJP3PMSS2VRP98G7Z42","fs-skia-elmish","Drive a generated FS.Skia.UI product through the pure Elmish adapter.","https:\u002F\u002Fgithub.com\u002FEHotwagner\u002FFS-Skia-UI\u002Fblob\u002Fmain\u002Ftemplate\u002Fproduct-skills\u002Ffs-skia-elmish\u002FSKILL.md",[],[]]