RFC: silent failures and ergonomics gaps in stx
Companion to #1791. That issue documents how agents should write stx. This one argues that a sizeable share of what they get wrong is a framework affordance problem, not only a user problem.
Evidence base: bughq on stx 0.2.113 — ~6,500 lines of stx
written largely by AI agents — plus a 60-finding audit (33 confirmed under adversarial review).
The case
bughq is a working app that never engaged the framework. No shell, so no hydration. No layouts, so 24
duplicated documents. No strict, so 68 prohibited DOM calls. No plugin registration, so 45 shipped
components sat unused. Every one of those is a default that pointed the wrong way, or a failure that
happened in silence.
None of them produced an error. Not one warning, across months of work.
Headline proposals
| # | Proposal | Breaking |
|---|---|---|
| 1 | A <!DOCTYPE> in a page should warn — it silently disables layout resolution (process.js:311) | no |
| 2 | Script extraction must not terminate on a closing tag inside a comment (non-greedy regex) | no |
| 3 | generateDocumentShell must escape the title — it is a stored XSS vector when the title carries user data | no |
| 4 | const meta = { title } in a server script should warn; it is a silent no-op on fragment pages | no |
| 5 | The fragment/SPA path is gated on a shell existing (serve-app.js:427) — an app with no app.stx never hydrates, silently | no |
| 6 | Directory options are double-prefixed by root resolution, resolving to paths that do not exist | yes |
| 7 | :attr bindings are not resolved during SSR, so each needs a hand-written static fallback | no |
| 8 | interceptAllLinks defaults disagree between stx-router (false) and bun-plugin-stx serve (hardcoded true) | yes |
| 9 | strict should default on for new projects — it would have blocked all 68 violations mechanically | yes |
| 10 | @stacksjs/components should auto-register rather than needing manual plugin wiring | no |
| 11 | The server→client data bridge already exists; make the safe path the only path | no |
| 12 | stx new should scaffold a project that cannot start in bughq's state | no |
A note on the shipped agent skill
.claude/skills/stacks-stx/SKILL.md ships with Stacks and is auto-loaded by agents. In the version
bughq has, it names config/stx.ts (does not exist — it is config/ui.ts) and resources/layouts/
(exists but is empty; the real layouts are in resources/views/layouts/), and its recommended config
block is character-for-character the one that produces the double-prefix defect in proposal 6.
It is silent on doctype, layouts, StxLink, useHead, stores and app.stx.
The codebase in the evidence base is a faithful implementation of its own instructions. If stx ships an agent skill, its paths should be generated from the config resolution rather than hand-written — a stale skill manufactures broken projects at scale, and there is now a 60-finding codebase demonstrating it.
Full detail in the comments: Part one — silent failures that should be loud, and Part two — ergonomics and syntax proposals.