component-structure

A set of rules for organising each interface component into its own folder, with separate files for its types, fixed values, tests, and optional helper parts.

In plain words
What is it for?
Use it when creating or restructuring components, features, reusable interface pieces, tests, constants, and accessibility-focused controls.
Why use it?
It keeps component files focused and makes related code easy to find without creating unnecessary files.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/ddebixx/frontend-template/component-structure
Clone the repo
git clone --depth 1 https://github.com/ddebixx/frontend-template

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 260 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00260
Opus 5 $0.00000 $0.00130
Sonnet 5 $0.00000 $0.00052
Haiku 4.5 $0.00000 $0.00026

Measured yesterday against content hash 55120b41d2c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

component-structure 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 yesterday.

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/component-structure.mdc · 29 lines

What it actually says

Components

  1. Encapsulate component-only types/utils/constants inside the component folder
  2. Keep ComponentName.tsx UI-only — export types from ComponentName.types.ts, constants from ComponentName.constants.ts
  3. Create sibling files only when they have content
  4. Nest subcomponents to mirror the UI tree
  5. Same layout applies under src/features/
ComponentName/
  ComponentName.tsx
  ComponentName.types.ts
  ComponentName.constants.ts   # omit if none
  ComponentName.test.ts
  utils/                       # optional
  SubComponent/                # optional

Prefer named exports. Keep presentational UI in components/; compose and wire data in features/. Merge classes with cn. Interactive UI must be accessible (semantic controls, names, keyboard). No inline display strings — put copy in locale catalogs or *.constants.ts (project chooses). Details: docs/frontend/conventions/COMPONENT_STRUCTURE.md, docs/frontend/conventions/ACCESSIBILITY.md, docs/frontend/tools/I18N.md

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. yesterday First seen · 29 lines · 0 tokens per session scan A 55120b41d2c4

Subscribe to this mod's changes

component-structure is a cursor rule published in the GitHub repository ddebixx/frontend-template (3 stars, last pushed 24d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 260 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-31.