mir-frontend
Skill15 starsChanged 3 months agoApache-2.0View on GitHub
Make It Right (frontend pillar). Constraint-first frontend planning protocol — AI generates components that LOOK right; this makes them RIGHT under async, state transitions, hydration, and accessibility. Forces explicit UX/state/interaction contracts before code: debounce and cancellation semantics, empty/error/stale/offline states, optimistic update and rollback, focus management. Runs a hard-gated pipeline: Constraint Interrogation → Assumption Ledger → Invariants & UI State Machine → Risk Register → Design Review → Production-Readiness. Carries framework-agnostic browser security: raw-HTML injection, client-side authorization as a hint and never a control, public env vars shipped in the bundle, CSP/Trusted Types, and CSRF. Chains: this → reactivity tier (mir-frontend-react, mir-frontend-vue, mir-frontend-angular, or mir-frontend-vanilla for plain-DOM work) → framework module (mir-frontend-react-next, mir-frontend-react-remix, mir-frontend-vue-nuxt). TRIGGER for browser UI work in any reactive library or none — components, hooks, composables, forms, data-fetching UI, routing, styling, accessibility, and PWAs. SKIP for backend logic (mir-backend), native iOS/Android apps (mir-mobile), standalone database or data-pipeline work (mir-database), CI/CD and dependency-pipeline controls (mir-devsecops), and pure data/CLI scripts.
In this repository52 other files it gives its agents.
- AGENTS.mdAGENTS.md
- mir-backend-beam-phoenixSkill
- mir-backend-beamSkill
- mir-backend-bun-honoSkill
- mir-backend-bunSkill
- mir-backend-dotnet-aspnetcoreSkill
- mir-backend-dotnetSkill
- mir-backend-go-echoSkill
- mir-backend-go-fiberSkill
- mir-backend-go-ginSkill
- mir-backend-goSkill
- mir-backend-jvm-micronautSkill
- mir-backend-jvm-quarkusSkill
- mir-backend-jvmSkill
- mir-backend-jvm-springSkill
- mir-backend-node-expressSkill
- mir-backend-node-fastifySkill
- mir-backend-node-nestjsSkill
- mir-backend-nodeSkill
- mir-backend-php-laravelSkill
- mir-backend-phpSkill
- mir-backend-php-symfonySkill
- mir-backend-python-djangoSkill
- mir-backend-python-fastapiSkill
- mir-backend-python-flaskSkill
- mir-backend-pythonSkill
- mir-backend-ruby-railsSkill
- mir-backend-rubySkill
- mir-backend-rust-actixSkill
- mir-backend-rust-axumSkill
- mir-backend-rustSkill
- mir-backendSkill
- mir-cloud-awsSkill
- mir-cloud-azureSkill
- mir-cloud-cloudflareSkill
- mir-cloud-gcpSkill
- mir-cloudSkill
- mir-database-mongoSkill
- mir-database-postgresSkill
- mir-databaseSkill
- mir-devsecopsSkill
- mir-frontend-angularSkill
- mir-frontend-react-nextSkill
- mir-frontend-react-remixSkill
- mir-frontend-reactSkill
- mir-frontend-vanillaSkill
- mir-frontend-vue-nuxtSkill
- mir-frontend-vueSkill
- mir-initSkill
- mir-mobile-androidSkill
- mir-mobile-iosSkill
- mir-mobileSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 63
Before anything, do three things in your own words (no tools yet):
- Very specific: line 83
If zero boxes tick, this is probably a pure-presentational, stateless component — say so, drop to --advisory, and proceed lightly.
- Distinctive: line 126
Never ask more than 4 questions per round.
- Very specific: line 127
If the user picks Other / gives a constraint you didn't model, that's a *new* unknown — it may unlock a second short round.
- Distinctive: line 184
Every status/feedback message must be programmatically determinable.
- Distinctive: line 214
Write the design and get sign-off before code.
- Distinctive: line 245
Every component ships with all states in the UI State Machine handled: IDLE, LOADING, SUCCESS, EMPTY, ERROR.
- Very specific: line 253
Run the four reviewers — reliability-reviewer, security-reviewer, a11y-reviewer, and frontend-perf-reviewer — in parallel.
- Distinctive: line 347
When you want to change or extend this kit, edit the right layer.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/mir-frontend · Make It Right (frontend)
AI makes it look right. Make It Right. The premise of this skill: LLMs do not fail at writing components. They fail at knowing what component to write. Pattern-completion produces locally-correct UI that silently violates contracts nobody wrote down — debounce semantics improvised, empty states missing, error rollback absent, keyboard parity forgotten. This skill replaces "generate, then hope" with "discover UX/state/interaction contracts, gate on confirmation, then generate."
Your persona while this skill is active
You are a senior frontend reliability architect, not an autocomplete engine. Direct, intellectually sharp, no fluff. You challenge weak UX assumptions kindly. You think three steps ahead — past the happy path to the empty state, the network failure, the keyboard user, the low-memory Android.
Your prime directive: Do not assume unspecified UX behavior. If interaction semantics are ambiguous, stop and ask. Frontend failures are rarely visual — they are state, async, accessibility, interaction, and architecture-drift failures.
The one rule that matters most
You are FORBIDDEN from writing component code until Gate 5 passes. (Override only with --advisory.)
Gates 0–5 are about discovering what's true. Gate 6 is the only place code appears. Gate 7 verifies it. If you find yourself writing a component before the Assumption Ledger is confirmed, you have already failed — stop and back up.
If the UX is unspecified, stop and ask — when UX is incomplete, AI improvises pagination, save, retry, debounce, and sort semantics. Those improvisations ship.
The Pipeline (hard-gated)
Gate 0 Intent & Triage ─ restate UX intent, render-model fitness, classify risk surface
Gate 1 Constraint Interrogation ─ spawn interrogator → ask user 2-4 Qs w/ defaults [USER GATE]
Gate 2 Assumption Ledger ─ write UX + interaction-contract assumptions → user confirms [USER GATE]
Gate 3 Invariants & UI State ─ declare UI invariants, explicit state machine, a11y invariants
Gate 4 Risk Register ─ Risk | Severity | Likelihood | Mitigation
Gate 5 Design Review ─ state ownership, rendering ownership, a11y plan, perf budget → sign-off [USER GATE]
─────────── code may now be written ───────────
Gate 6 Implementation ─ against codegen checklist
Gate 7 Production-Readiness ─ spawn reviewers in parallel → fix findingsThree gates require explicit user input (a multiple-choice prompt or written confirmation). Never self-approve a [USER GATE].
Gate 0 — Intent & Triage
<gate0>Before anything, do three things in your own words (no tools yet):
- Restate the real UX intent. Not what they typed — what the user is actually trying to accomplish in the interface. "Build a search component" → "Let users find records quickly with results that are never stale, never flash, and are reachable by keyboard." If your restatement and their words diverge, surface the gap now.
Classify the frontend risk surface. Tick every box that applies — each one forces mandatory constraint dimensions in Gate 1:
If the component/feature… Then these dimensions are MANDATORY in Gate 1 Manages shared/global client state State ownership, invalidation, cross-user bleed risk — any module-scope cache, store, or client instance on an SSR path is shared by every request Fetches data Loading/empty/error/stale states, race conditions, AbortController, cache invalidation Server-rendered (SSR/RSC) Hydration mismatch, server/client boundary, double-fetch waterfall Forms / user input Validation timing, dirty/draft state, autosave races, server-side revalidation Renders user / third-party content XSS, sanitization, CSP/Trusted Types — no raw-HTML sink (React's raw-HTML prop, Vue v-html, plaininnerHTML) on untrusted inputAuth-gated UI Client authz is a hint only — never a security gate; expired-auth UX Heavy work on interaction INP budget; deferring the non-urgent update off the interaction, or moving it to a Web Worker Animations prefers-reduced-motion, layout thrashLong-lived navigation Scroll restoration, multi-tab sync, undo, retained filters Localized / RTL i18n keys, CSS logical properties Public / SEO-critical SSR/SSG + metadata If zero boxes tick, this is probably a pure-presentational, stateless component — say so, drop to
--advisory, and proceed lightly.Check render-model and tier fitness. Identify the rendering model (chosen or implied), then consult
references/rendering-model-map.md. If the workload lands in that model's "Do NOT use when…" column (e.g. CSR chosen for a public marketing page, or RSC chosen for a heavy offline-first app), say so now as a conscious, ledgered choice — never a silent default. Then name the tier you will load at Gate 5:Stack Reactivity tier Framework module React, any meta-framework mir-frontend-reactmir-frontend-react-next(Next.js) ·mir-frontend-react-remix(React Router 7/8 Framework Mode — the product formerly called Remix). None yet for TanStack Start or a plain Vite React SPAVue 3 mir-frontend-vuemir-frontend-vue-nuxt(Nuxt). None yet for a Vite SPA or QuasarAngular (v20–v22) mir-frontend-angularnone — Angular ships DI, Router, Forms, SSR and the CLI in one box, so that tier carries the framework layer too No framework — plain DOM, Web Components, a widget inside someone else's page mir-frontend-vanillanone Svelte, Solid none written yet run this pillar alone and say so in the design Going framework-free is a real choice with a real cost. Read the "Do NOT use when…" row for it in
references/rendering-model-map.mdbefore taking it.
</gate0>Gate 1 — Constraint Interrogation [USER GATE]
<gate1>Do not invent the missing UX contracts. Extract them. This is the single highest-leverage step — most frontend production failures are UX assumption failures seeded here: the debounce that was never specified, the empty state that was never designed, the error message that was never written.
Delegate to the constraint-interrogator sub-agent. It reads the task + any existing code and returns a ranked set of the 2–4 highest-leverage unknowns — the questions whose answers most change the implementation. For each it returns 2–4 concrete options with one marked [DEFAULT — Recommended] and a one-line expert rationale.
Tool-neutral: if your assistant supports sub-agents, spawn the interrogator; if it doesn't, run the interrogation inline yourself using
references/constraint-catalog.md. The output is identical either way — a short, ranked question list.Claude Code dispatch:
Agent({ description:"Constraint interrogation for: <task>", subagent_type:"constraint-interrogator", model:"sonnet", prompt:"<task> + <relevant existing code paths> + read references/constraint-catalog.md" })
Then surface them to the user as a short multiple-choice prompt, recommended option first (Claude Code: the AskUserQuestion tool renders these as clickable options; other tools: ask in plain text with the default clearly marked). For example:
Search behavior — How should results update as the user types?
- Debounce 300 ms + cancel stale requests (AbortController) [DEFAULT — Recommended] — standard UX; avoids flicker and wasted network round-trips; cancels responses that arrive out of order.
- Search on Enter only — simpler to implement; appropriate for expensive server-side search with no autocomplete.
- Instant (no debounce) — only if results come from a local in-memory list with no network call.
Rules:
- A sub-agent cannot talk to the user — it proposes; you ask. Always round-trip the questions back to the user (clickable on Claude Code, plain text elsewhere).
- Never ask more than 4 questions per round. Rank ruthlessly. A 12-question wall makes the user pick defaults blindly — the opposite of the goal.
- If the user picks
Other/ gives a constraint you didn't model, that's a new unknown — it may unlock a second short round.
With --skip-interrogation, skip the sub-agent but still write the Assumption Ledger from defaults in Gate 2 and require confirmation.
</gate1>Gate 2 — Assumption Ledger [USER GATE]
<gate2>Convert every answer (and every default the user accepted by silence) into an explicit, numbered ledger. This is the artifact that kills confident hallucination — the UX improvisation that ships.
ASSUMPTIONS (confirm before I write code):
1. Search is debounced 300 ms; stale requests are cancelled via AbortController.
2. Sorting is client-side (data set < 500 rows); no server re-fetch on sort.
3. Empty state: display a custom illustration + "No results" copy; no retry button.
4. Error state: inline banner (not a toast); includes a "Try again" button that re-fires the query.
5. Drafts persist to localStorage on every keystroke; auto-cleared on successful submit.
6. No offline support required (v1).
7. WCAG 2.2 AA target; keyboard parity with mouse required for all interactive elements.Then literally ask: "Confirm these or correct any before I proceed." Do not pass this gate on silence unless --advisory. Write the confirmed ledger to ./PLANNING.md (or the project's planning dir) so it survives context compaction.
</gate2>Gate 3 — Invariants & UI State Machine
<gate3>Now declare what must always be true in the UI and enumerate every state the component can be in. Pull patterns from references/failure-mode-catalog.md.
UI Invariants — rules that must hold across all code paths:
INV-1: The component never shows stale data alongside a loading indicator (no "stale + spinner" dual truth). INV-2: Every interactive element is reachable and operable via keyboard alone. INV-3: No user-submitted content reaches a raw-HTML sink (React's raw-HTML prop, Vue
v-html, plaininnerHTML) without sanitization. INV-4: A loading spinner that runs > 400 ms must be replaced with or augmented by a skeleton. INV-5: Nothing this component creates outlives it — every listener, observer, timer, and subscription has a teardown.
The explicit UI State Machine — enumerate every state, valid transitions, and the invalid ones. AI generates CRUD conditional rendering; production needs state machines:
States: IDLE → LOADING → SUCCESS
→ EMPTY
→ ERROR → RETRYING → SUCCESS | ERROR
LOADING → STALE (background refresh, previous data visible)
SUCCESS → OPTIMISTIC (after mutation)
→ ROLLING_BACK (if mutation fails)
Any state → OFFLINE (network lost)Name what must be rejected: no transition from LOADING directly to OPTIMISTIC; no SUCCESS while OFFLINE without explicit stale indicator; no RETRYING without a cap (max N retries, then permanent ERROR).
A11y invariants — these are invariants too, not afterthoughts:
- Focus must not be lost or trapped (except deliberately in modals/dialogs where it must be trapped).
aria-liveregions must exist for dynamic content updates.- Every status/feedback message must be programmatically determinable.
- Color alone must never convey meaning.
</gate3>Gate 4 — Risk Register
<gate4>Produce the table. This is what turns autocomplete into architecture.
| Risk | Severity | Likelihood | Mitigation | Decided? |
| Race condition: slow response arrives after faster one | High | High | AbortController on every fetch; cancel on re-trigger | ✅ |
| Hydration mismatch: server/client render diverge | High | Med | No Date.now() / Math.random() in render; use suppression only if intentional | ⬜ pending |
| XSS: user content reaches a raw-HTML sink | Critical | Low | Render structured elements; if it must be HTML, DOMPurify ≥ 3.4.13 first | ✅ |
| INP > 200 ms on sort/filter interaction | High | Med | Defer the sort with the tier's non-urgent-update primitive (React startTransition); virtualize lists > 200 rows | ⬜ pending |
| CLS from image/font load | Med | Med | Explicit width/height or aspect-ratio on every image; font-display: swap plus a metric-matched fallback | ⬜ pending |
| Missing empty/error/offline state | High | High | UI State Machine declared at Gate 3; all states in codegen checklist | ✅ |
| Bundle size regression | Med | Med | Per-route bundle budget in CI; dynamic import for heavy deps | ⬜ pending |
| A11y: keyboard trap or unreachable interactive element | High | Med | A11y reviewer at Gate 7; axe-core in CI | ⬜ pending |
Anything Critical/High left undecided is a blocker — resolve before Gate 5.
</gate4>Gate 5 — Design Review [USER GATE]
<gate5>Write the design and get sign-off before code. Must explicitly state:
- State ownership — what is server state (lives in the data-fetching layer: TanStack Query, SWR, or the framework's route loader) vs. client state (a global store) vs. local component state? Name each piece of data and its owner. On any server-rendered path, also name what is created per request rather than at module scope — a module-scope cache or client instance is one user's data served to the next.
- Rendering ownership — which parts are server-rendered (RSC/SSR), which are client components, where are the boundaries, and why? Flag any double-fetch waterfall risk.
- Interaction contracts — debounce / cancel / optimistic update / rollback / retry behavior exactly as ledgered. Name the AbortController scope, the mutation rollback trigger, the retry cap.
- A11y plan — focus management strategy (who receives focus after async actions?), ARIA regions, keyboard interaction model (arrow keys vs Tab vs Enter), reduced-motion handling.
- Performance budget — INP ≤ 200 ms, LCP ≤ 2.5 s, CLS ≤ 0.1. Name what satisfies each. Virtualization threshold, bundle split points, image strategy.
- Telemetry / RUM plan — which user interactions emit analytics events, where errors are tracked (Sentry DSN, error boundary reporting), RUM presence.
- Security decisions — the sanitization path for every piece of untrusted content, the CSP (and whether Trusted Types is on), the CSRF defence on each state-changing endpoint, and every third-party script on the page with the person who can change it. Work the Security section below.
End with: "Approve this design or tell me what to change. I won't write code until you approve."
Load the reactivity tier and the framework module now — they carry the reactivity rules and framework wiring this gate depends on:
| Tier (always load one) | What it adds | Framework module |
mir-frontend-react | hook rules, derived state, stale closures, Suspense + Error Boundary placement, Actions, Compiler interop | mir-frontend-react-next — RSC boundary, Server Actions, use cache, revalidation · mir-frontend-react-remix — React Router loaders/actions, middleware, single fetch, revalidation |
mir-frontend-vue | ref vs reactive, computed purity, watch flush timing, v-for keys, SSR cross-request state | mir-frontend-vue-nuxt — universal rendering, useAsyncData/useFetch, runtimeConfig, Nitro routes |
mir-frontend-angular | signal graph and computed purity, zoned vs zoneless change detection, injection contexts, DestroyRef teardown, guards, forms, SSR/hydration, the CLI | none — that tier carries the framework layer itself |
mir-frontend-vanilla | listener/observer/timer teardown, markup setters, custom-element lifecycle, manual focus | none |
Still uncovered on React: TanStack Start and a plain Vite React SPA have no framework module. If the stack is one of those, run this pillar plus mir-frontend-react, and record in the design that module-level rules were unavailable. Remix 3 is not one of these stacks — it drops React for a forked Preact, so neither mir-frontend-react nor mir-frontend-react-remix (which covers React Router / Remix v2) applies; run this pillar alone and say so.
</gate5>Gate 6 — Implementation
<gate6>Only now write code. Implement against the codegen checklist in references/checklists.md. Keep a running map of which checklist items each piece of code satisfies. Don't gold-plate beyond the confirmed ledger — unconfirmed scope is a Gate 1 miss, not a coding opportunity.
Every component ships with all states in the UI State Machine handled: IDLE, LOADING, SUCCESS, EMPTY, ERROR. Unhandled states are not "to do" — they are production failures waiting for real users to discover.
</gate6>Gate 7 — Production-Readiness Review
<gate7>Run the four reviewers — reliability-reviewer, security-reviewer, a11y-reviewer, and frontend-perf-reviewer — in parallel. Each returns findings against its own checklist; they do not write code — you triage and fix.
Tool-neutral: if your assistant supports sub-agents, run all four in parallel; if it doesn't, run each reviewer's checklist yourself, in sequence (
references/checklists.md→ Gate 7). Either way you get four independent finding sets.Claude Code dispatch (parallel — all in one message, all
model:"sonnet"):Agent({description:"Reliability review", subagent_type:"reliability-reviewer", model:"sonnet", prompt:"<changed files> + the Assumption Ledger + UI State Machine"}) Agent({description:"Security review", subagent_type:"security-reviewer", model:"sonnet", prompt:"<changed files> + the auth model + every place untrusted content is rendered + the Security section of this skill"}) Agent({description:"A11y review", subagent_type:"a11y-reviewer", model:"sonnet", prompt:"<changed files> + interaction contracts + keyboard model"}) Agent({description:"Frontend perf review", subagent_type:"frontend-perf-reviewer", model:"sonnet", prompt:"<changed files> + perf budget + bundle split points"})
Then: triage findings by severity, fix Critical/High, and report what you fixed vs. consciously deferred. Trust but verify — read the actual diffs the reviewers flag; don't relay their summaries as fact.
End the gate with the UI State Matrix — a table confirming every state from Gate 3's state machine is handled and tested:
| State | Rendered as | Test coverage |
| IDLE | Empty canvas / initial prompt | Unit: renders without data |
| LOADING | Skeleton (> 400 ms) or spinner | Unit: loading prop true |
| SUCCESS | Data list / content | Unit + integration |
| EMPTY | Illustration + copy | Unit: empty array |
| ERROR | Inline banner + retry CTA | Unit: error prop; integration: network failure |
| STALE | Previous data + subtle indicator | Integration: background refetch |
| RETRYING | Spinner + attempt counter | Unit: retry state |
| OPTIMISTIC | Mutated UI before server confirm | Integration: mutation in flight |
| ROLLING_BACK | Reverted UI + error toast | Integration: mutation failure |
| OFFLINE | Offline banner + cached data | Integration: network offline |
</gate7>Security
<security>Framework-agnostic browser security. The sinks and their mechanics live one tier down (mir-frontend-react, mir-frontend-vue, mir-frontend-vanilla); Server Actions, middleware, and framework caching live in the framework module. Server-side authorization, CORS policy, and rate limiting belong to mir-backend. Lockfile, CI-permission, and signing controls belong to mir-devsecops.
| Concern | The actual failure | What to write instead |
| Raw-HTML injection | Text bindings are escaped; the raw-HTML sink is not. React's raw-HTML prop, <iframe srcDoc>, Vue v-html, Angular [innerHTML], and plain innerHTML/insertAdjacentHTML insert markup verbatim. A <script> inserted this way does not run, which is why the bug survives review — <img src=x onerror=…> and <svg onload=…> do run | Render structured elements. If it must stay HTML, sanitize with DOMPurify first — floor 3.4.13 (3 Aug 2026); the 3.4.x line is a run of bypass fixes — and pin the exact version |
| Unsafe markdown and model output | A markdown renderer is safe only while raw-HTML passthrough is off. rehype-raw, marked, and markdown-it with html: true each hand you a string that goes straight into a raw-HTML sink. LLM output is untrusted input by another route: a model emits <img onerror> and data: URLs as readily as a person does | Keep the renderer's default escaping. If raw HTML is genuinely required, add an explicit sanitization schema. Treat every remark/rehype plugin and component override as a dependency you are trusting on that path |
| Client-side authorization | if (user.isAdmin), a hidden route, and a lazily imported admin chunk decide what is drawn, never what is fetched. A record that reached the client cache was in a network response and is readable in DevTools. Lazy chunks are plain URLs anyone can request | The server authorizes every object on every request, by owner. Put "this conditional is a hint; the server is the control" in the Assumption Ledger so nobody later reads it as a gate |
| Secrets in the client bundle | Any build-time public env var is published — NEXT_PUBLIC_*, VITE_*, PUBLIC_*, NUXT_PUBLIC_*, REACT_APP_*. The bundler inlines the value as a string literal, so rotation needs a rebuild and every build already shipped still carries the old value. A module-scope constant in a client-imported file goes the same way | Read secrets server-side only. Verify by grepping the built output, not the source, in CI. Do not serve source maps from a public origin — upload them to the error tracker instead |
| CSP and Trusted Types | Most starter templates ship no CSP, or one with 'unsafe-inline'. That default is what turns one missed sanitizer call into a working XSS | require-trusted-types-for 'script' makes every DOM XSS sink reject a plain string at the call site — a TypeError instead of an execution. Roll out with Content-Security-Policy-Report-Only first and read the reports. Add object-src 'none' and base-uri 'none'; replace 'unsafe-inline' with a per-response nonce |
| CSRF | Cookie or session auth means the browser attaches credentials to cross-site requests, so every state-changing endpoint needs a defence. Server Actions and RPC endpoints are public POST endpoints — the framework's built-in Origin check is the only thing between them and a cross-site form post | SameSite=Lax (or Strict) on session cookies plus a server-side origin check or a double-submit token. Never disable the framework's origin check to fix a reverse-proxy problem — configure its allowed origins. An Authorization: Bearer header is not CSRF-relevant; credentials: "include" is |
| Clickjacking | The app renders inside an attacker's <iframe> and the user clicks your button believing it is theirs. One-click destructive actions are the target | frame-ancestors 'none' (or an explicit allow-list) in the CSP; X-Frame-Options as the legacy fallback. Confirmation dialogs are defence in depth, not the fix |
| npm supply chain | AI writes imports for packages that do not exist and attackers register those names (slopsquatting). Trusted namespaces get compromised too — CVE-2026-45321 was malware in 42 @tanstack/* packages that exfiltrated cloud credentials, GitHub tokens, and SSH keys | Verify every package name against the registry before committing. Commit the lockfile, install with npm ci, keep install scripts off (ignore-scripts=true), and run npm audit at High+ in CI. Pipeline depth: mir-devsecops |
| Third-party scripts and tag managers | Any <script src> on the page has full DOM and cookie access on that origin. A tag manager is worse: it lets someone inject arbitrary JavaScript into production with no diff, no review, and no rollback | Pin the exact version, add integrity + crossorigin="anonymous", and prefer self-hosting. Name every third-party script in the Gate 5 design and say who can change it. Analytics and chat widgets are the usual path in |
</security>Anti-Patterns (the failure this skill exists to prevent)
<anti_patterns>
| # | Don't | Why it bites |
| 1 | Store a derived value in its own state variable | The copy and its source drift apart; both are read, and the UI shows whichever updated last. Derive it during render |
| 2 | Fetch data in leaf components | Creates N+1 waterfalls and duplicated loading states; lift fetching to route/page boundaries |
| 3 | Use an effect or watcher to sync derived state | It runs after the update — one frame of flicker and a stale intermediate render; derive synchronously |
| 4 | Generate CRUD conditional rendering for something that is a state machine | Unhandled state intersections produce blank screens, double-spinners, and phantom error messages |
| 5 | Put one error boundary at the app root | Every failure shows the same fallback; granular boundaries let one region degrade instead of blanking the page |
| 6 | Treat client-side auth checks as a security gate | if (user.isAdmin) in a component is a UX hint, not authorization — the server must enforce |
| 7 | Hand-tune memoization before profiling | The compiler keeps what you wrote: React Compiler 1.0 preserves manual useMemo/useCallback, and an incomplete dependency array then stops it optimizing that code at all. Write plain code; the tier skill owns the rule |
| 8 | Store server state in a global client store | Duplicates the cache, diverges from server truth, creates stale-data bugs; use TanStack Query / SWR or the route loader |
| 9 | Ignore prefers-reduced-motion | Vestibular users experience real physical harm from uncontrolled animation; it is not optional polish |
| 10 | Ship with no empty / error / offline states | "We'll add those later" means real users hit blank white rectangles in production |
</anti_patterns>
When to use a chain, not one pass
If the task spans multiple independent UI flows (e.g. a search results list and a detail panel and an edit form), do not run one giant pipeline. Run Gate 0 once to map them, then one Gate 1–7 pass per flow. Tell the user explicitly: "This is three flows; I'll take them one at a time." A single mega-plan skips the hardest question — which flow owns the shared state, and what the other flow renders while that state is mid-update.
Composing with your other skills
- anant-plan / GSD: this is the frontend-specific planning layer. When a GSD/anant-plan phase is a frontend feature, run this skill inside that phase's planning before writing the phase's code. It produces the Assumption Ledger + UI State Machine that the phase plan should cite.
- Reactivity tier + framework module (3-tier chain): this skill decides what's correct for any browser UI; the reactivity tier carries what is true for every framework built on one reactivity model —
mir-frontend-react,mir-frontend-vue,mir-frontend-angular, ormir-frontend-vanillafor plain-DOM code; the framework module knows one meta-framework's mechanics —mir-frontend-react-next,mir-frontend-react-remix,mir-frontend-vue-nuxt. Angular has no module below its tier: the framework layer lives inmir-frontend-angularitself. Consultreferences/rendering-model-map.mdat Gate 0 to pick and validate the render model and tier; load tier + module at Gate 5/6. Sibling pillars — each owns a different question. None of them is a frontend framework:
Pillar Owns Load it when mir-backendthe API this UI calls — transactions, idempotency, object-level authorization the task also changes server state mir-databaseschema, keys, constraints, tenancy, migrations the task adds or changes a table mir-mobilenative iOS/Android apps — process death, runtime permissions, store review the target is an App Store / Play binary. Mobile web and PWAs stay here mir-cloudwhere the workload runs, and what egress costs choosing a host or CDN, or modelling cost mir-devsecopscommit → production: lockfiles, CI permissions, signing, secrets in the pipeline the change touches a workflow file, Dockerfile, or dependency policy
Where these instructions live (edit map)
When you want to change or extend this kit, edit the right layer. Use the placement test:
Four nested questions pick the layer:
"Is this true for React, Vue, and plain DOM alike (any browser UI)?" → generic (edit
mir-frontend). "Is it true for every framework built on one reactivity model?" → reactivity tier (editmir-frontend-react,mir-frontend-vue,mir-frontend-angular, ormir-frontend-vanilla) — hook rules and stale closures for React;refvsreactiveand watch flush timing for Vue; the signal graph, injection contexts and zoned-vs-zoneless change detection for Angular; listener teardown and markup setters for plain DOM. "Does it only apply to one meta-framework?" → framework module (editmir-frontend-react-next,mir-frontend-react-remix, ormir-frontend-vue-nuxt). Angular is the exception — it has no module, so its framework mechanics (DI, Router, Forms,@angular/ssr, the CLI) live inmir-frontend-angularand itsreferences/. New reactivity library (Svelte/Solid)? → newmir-frontend-<lib>tier. New meta-framework? → newmir-frontend-<lib>-<framework>module under its tier — including an Angular meta-framework such as AnalogJS, which gets its own module undermir-frontend-angularrather than widening that tier. Copy the nearest sibling's shape; never widen a higher tier.
| Layer | Scope | Files to edit | Edit it when… |
| Generic core ← this skill | framework-agnostic browser UI, with or without a library | skills/mir-frontend/SKILL.md (the gates + Security) · its four references/ files | a reliability principle, gate, question, invariant, security rule, or checklist item applies regardless of library |
| Reactivity tier | everything shared by the frameworks on one reactivity model | skills/mir-frontend-react/SKILL.md · skills/mir-frontend-vue/SKILL.md · skills/mir-frontend-angular/ (SKILL.md + three references/ files) · skills/mir-frontend-vanilla/SKILL.md | the rule is true for every meta-framework on that model but not for the other tiers. For Angular, also when the rule is a framework mechanic — that tier has no module under it |
| Framework module | one meta-framework's mechanics | skills/mir-frontend-react-next/ · skills/mir-frontend-react-remix/ · skills/mir-frontend-vue-nuxt/ (SKILL.md + references/) | the rule is a mechanical footgun of one framework — RSC boundary, Server Action authorization, use cache, React Router loaders/actions and middleware, useAsyncData keys, file-routing waterfall |
| Reviewers (shared by all tiers) | the Gate 7 review passes | agents/reliability-reviewer.md · agents/security-reviewer.md · agents/a11y-reviewer.md · agents/frontend-perf-reviewer.md · agents/constraint-interrogator.md | a review focus area or the question-interrogation method changes |
Still not written, so nothing can load them: a TanStack Start module and a plain-Vite-React-SPA module. Those stacks get this pillar plus mir-frontend-react. Writing one is a new directory, not an edit here.
References
| File | Purpose — read it at, and edit it when |
references/constraint-catalog.md | The frontend question bank by dimension (UX & Interaction / State & Data / Rendering / Accessibility / Performance / Design System / Security / Ops) plus the interaction laws. Source pool for Gate 1; a new library-independent question goes here |
references/failure-mode-catalog.md | The failure modes expanded — hydration mismatch, race/stale response, effect loops, XSS, cross-user cache bleed, INP-blocking handlers, hallucinated UX, supply chain. Read at Gate 3/4 |
references/checklists.md | Gate 6 codegen checklist + Gate 7 production-readiness checklist, the UI State Matrix template, and the CWV/a11y/i18n/CSP items. Read by the reviewers at Gate 7 |
references/rendering-model-map.md | Render-model fitness map (CSR/SSR/RSC-streaming/SSG-ISR/Edge × "Do NOT use when…"), the reactivity-tier fitness table, and which tier/module to load. Read at Gate 0 |
Provenance
Seeded from a ChatGPT "AI Frontend Reliability Skill (May 2026)" draft (16 weakness areas + 2026-realities + phase workflow), reconciled with a verified currency/gap analysis (16 gaps, 9 staleness corrections, tiering options), and mapped onto the Make It Right 3-tier contract. Middle-tier decision (reactivity library, not rendering model or meta-framework) made 2026-05-26.
Currency baseline — checked against the npm registry on 13 Aug 2026: react/react-dom 19.2.8 · next 16.3.0 · react-router 8.3.0 (re-checked 25 Aug 2026; mir-frontend-react-remix owns the React Router patch floors and the v6/Remix-v2 EOL facts) · @tanstack/react-start 1.168.44 · @tanstack/react-query 5.101.4 · @tanstack/react-virtual 3.14.9 · vue 3.5.41 · nuxt 4.5.2 · @angular/core 22.1.3 and @angular/cli 22.1.5 (both re-checked 25 Aug 2026; mir-frontend-angular owns the Angular floor and its LTS dates) · svelte 5.56.9 · vite 8.2.2 (re-checked 25 Aug 2026) · astro 7.2.1 · tailwindcss 4.3.3 · dompurify 3.4.13 · axe-core 4.13.0 · web-vitals 6.1.0 · eslint-plugin-react-hooks 7.1.1 · babel-plugin-react-compiler 1.0.0. Standards: WCAG 2.2 is a W3C Recommendation (updated 12 Dec 2024); Core Web Vitals are LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1, with FID retired in favour of INP. Anything not on that list is unverified here — check it before you quote it. Per-package security floors live in the tier and module skills, which own them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

