--- name: audit-shells version: 1.4.0 description: | Audit pracht shells: missing `Loading()` on SPA routes, document tags inside a shell, shells that drop `children`, unused shells, and shadowed `ErrorBoundary` exports. Use for "audit shells", "check shell composition", "find unused shells", "is my layout structured correctly". allowed-tools: - Bash - Read - Grep - Glob --- # Pracht Audit Shells Shells in pracht are named layout components composed around routes. The framework owns the document — shells must not render ``, `
`, or ``. They sit between the framework's HTML scaffold and the route component. ## Step 1: Enumerate MCP: if `pracht dev-mcp` is registered, prefer its `inspect_*`, `doctor`, and `verify` tools to the CLI. ```bash pracht inspect routes --json ``` Prerequisite: `pracht inspect` needs a vite config with the pracht plugin wired up; run it from the app root. For every shell used by the app, read its source file. Also list which routes use which shell (the JSON output includes resolved `shell` and `shellFile` per route). The JSON's top-level `mode` field tells you which router the app uses — see Step 3 for how that changes shell discovery. ## Step 2: Per-shell checks For each shell file: ### 2a. Document-level tag misuse Grep for ``, ``, ``, `). Shells **replace**, they do not nest: the nearest `_app` above a route is the only one that renders it, so a directory shell must carry its own `head()`/`headers()` rather than inherit the parent's. "Unused shells" analysis does not apply; instead check `pracht inspect routes --json` and confirm each route's `shell` is the nearest `_app` you expect, and that no directory you meant to scope is silently falling back to `"pages"`. An `_app` inside an underscore-reserved tree (`src/pages/_components/_app.tsx`) is a plain helper, and two `_app` files in one directory are a build, `doctor`, and `verify` error. Then report: - **Unused shells** (manifest apps only): registered but referenced by no route or group. Recommend removal. - **Single-use shells**: shells used by exactly one route — sometimes a signal the layout should be inlined. Flag as `info`. - **Routes without shells**: routes resolved to no shell. Usually intentional for raw HTML responses, but worth listing. ## Step 4: Report | Shell | File | Used by | Issue | Severity | | ----- | ---- | ------- | ----- | -------- | Severities: `error` (document tags, missing children), `warn` (no `Loading` on SPA routes, empty `headers()`), `info` (unused, single-use, shell `ErrorBoundary` shadowed by route-level boundaries on every route). ## Rules 1. Source of truth is `pracht inspect routes --json` — it shows resolved shell-per-route after group inheritance. 2. Read the shell source — do not infer from names. 3. `Loading()` is a shell export (SPA-only fallback). `ErrorBoundary` is valid on both shells and routes: the shell's boundary is the fallback, the route's wins when both exist. Do not flag shell boundaries as bugs. 4. Recommend deletions for unused shells; do not delete automatically. 5. When in doubt about render mode interaction, cross-reference with `tune-render-mode`. $ARGUMENTS