frontend-components-advanced

frontend-components-advanced is a cursor rule for Cursor from golid-ai/golid. It costs 0 tokens per session (853 once invoked), scanned A, original, MIT.

Coding rules for web components that depend on browser features such as 3D graphics, video calls, or canvas drawing. They also prevent demo-only behavior from reaching production and document two intentional uses of plain HTML inputs.

In plain words
What is it for?
Use them when building or reviewing browser-only components, lazy-loaded components, loading and error states, or production UI that has special input handling.
Why use it?
These rules help avoid components appearing blank, failing to start, or accidentally showing sample behavior in a real product. They also make intentional exceptions clear during code review.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when building or reviewing browser-only components, lazy-loaded components, loading and error states, or production UI that has special input handling.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/golid-ai/golid/frontend-components-advanced
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/golid-ai/golid

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for frontend-components-advanced

README.md
[![agentmods](https://agentmods.dev/badge/rules/golid-ai/golid/frontend-components-advanced.svg)](https://agentmods.dev/rules/golid-ai/golid/frontend-components-advanced)
Your own site
<a href="https://agentmods.dev/rules/golid-ai/golid/frontend-components-advanced"><img src="https://agentmods.dev/badge/rules/golid-ai/golid/frontend-components-advanced.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 853 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00853
Opus 5 $0.00000 $0.00426
Sonnet 5 $0.00000 $0.00171
Haiku 4.5 $0.00000 $0.00085

Measured 8d ago against content hash e15dcb6f3179, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

frontend-components-advanced scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/frontend-components-advanced.mdc · 76 lines

How it starts

The opening of the file, as written. The whole thing — 76 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Advanced Component Patterns

Thesis: Browser-only components need Suspense and static DOM wrappers; production components must never ship demo behavior; two raw-<input> cases are intentional.

Lazy Loading (Browser-Only Components)

Components that use browser APIs (Three.js, WebRTC, canvas) must be lazy-loaded with <Suspense>:

// In the CONSUMER file (e.g., a section or page):
import { lazy, Suspense } from "solid-js";
const Canvas3D = lazy(() => import("~/components/molecules/Canvas3D/Canvas3D")
  .then(m => ({ default: m.Canvas3D })));

// Usage — Suspense is REQUIRED or the component silently renders nothing:
<Suspense>
  <Canvas3D />
</Suspense>

Inside the lazy component, if onMount appends DOM nodes (e.g., containerRef.appendChild(canvas)), the return JSX must include a static wrapper div — not just a Switch/Match. Without a static element, onMount may not fire:

// GOOD — static div always in DOM, conditional content inside
<div ref={containerRef} class="relative w-full h-full">
  <div class="absolute inset-0 pointer-events-none"
    style={{ display: loading() || error() ? undefined : "none" }}>
    <Switch>
      <Match when={loading()}><Spinner /></Match>
      <Match when={error()}><ErrorText /></Match>
    </Switch>
  </div>
</div>

// BAD — Switch as only child can prevent onMount from firing
<div ref={containerRef}>
  <Switch>
    <Match when={loading()}>...</Match>
  </Switch>
</div>

Never call onCleanup() after an await — use mutable refs cleaned up in the synchronous onCleanup registered during component creation.

Do NOT

  • Import from other atoms inside an atom (that makes it a molecule)
  • Use createSignal for internal state unless the component is interactive (forms, toggles)
  • Use inline styles — use Tailwind classes
  • Create a raw HTML element when a component exists (<select> → use <Select>, confirm() → use <DestructiveModal>)
  • Use lazy() without a <Suspense> boundary — it silently renders nothing
  • Build "demo state" (random failures, fake delays, mocked data, simulateX helpers) directly into a component that is also used in production. If a component needs a showcase variant, gate the demo behavior on the absence of an integration prop (Show when={hasFiles() && !props.onFilesSelected}) so the demo UI only renders when no callback is wired. The Dropzone bug (9a68b1e) shipped fake "Upload failed" badges on top of real uploads to real users for weeks because simulateUpload() rendered alongside the real upload state. Mock data on dedicated showcase routes (e.g. (private)/components/sections/, the /components showcase) is fine — those routes are the showcase, not consumers of one.

Read the full file on GitHub · 76 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 76 lines · 0 tokens per session scan A e15dcb6f3179

Subscribe to this mod's changes

frontend-components-advanced is a cursor rule published in the GitHub repository golid-ai/golid (40 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 853 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.