component_layer_rules

Rules for building reusable and feature-specific frontend components in TypeScript and React. Components are self-contained pieces of a user interface.

In plain words
What is it for?
They help create functional components, define typed properties, manage state and interactions, organize feature components, and choose Ant Design or Lucide icons.
Why use it?
They keep component structure, props, state, UI libraries, icons, and file placement consistent across the application.

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/modelengine-group/nexent/component_layer_rules
Clone the repo
git clone --depth 1 https://github.com/ModelEngine-Group/nexent

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 966 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.00966
Opus 5 $0.00000 $0.00483
Sonnet 5 $0.00000 $0.00193
Haiku 4.5 $0.00000 $0.00097

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

Security

Grade A, and why

component_layer_rules 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/frontend/component_layer_rules.mdc · 118 lines

How it starts

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

Purpose and Scope

  • Component layer contains reusable UI components for frontend/components/**/*.tsx and feature-specific components under frontend/app/**/components/**/*.tsx
  • Responsibilities: Create reusable components, implement business logic, handle interactions, provide consistent UI
  • MANDATORY: All components must use TypeScript and functional components

UI Library and Icons

  • Ant Design first: Use Ant Design for forms, data display, modals, buttons, layouts. See ui_standards_rules.mdc.
  • Icons: Lucide icons primary (lucide-react), @ant-design/icons as fallback when Lucide lacks the icon.
// Prefer Lucide
import { Search, RefreshCw, Edit } from "lucide-react";

// Fallback when Lucide has no equivalent (e.g. ExclamationCircleFilled for modal)
import { ExclamationCircleFilled, InfoCircleFilled } from "@ant-design/icons";

Component Organization

  • components/auth/ - Authentication-related components
  • components/providers/ - Context providers and global state management

Component Structure

  • Use functional components with TypeScript
  • Define proper interfaces for all props
  • Use React hooks for state management
  • Implement proper error boundaries where needed
  • Follow single responsibility principle
  • Single component file should not exceed ~1000 lines: Split into subcomponents or extract logic to hooks/utils when a file grows. keep files digestible.

Props and State Management

  • All props must be typed with interfaces
  • Use optional props with default values when appropriate
  • Prefer controlled components over uncontrolled
  • Use local state for component-specific data
  • Use context for shared state across components
  • Avoid Prop Drilling: When a component receives more than ~7–10 props, or props are passed through multiple layers only to reach a deep child, prefer:
    • Context for cross-cutting state (auth, theme, feature flags)
    • Composition (children, render props) instead of passing many callbacks
    • Custom hooks to encapsulate shared logic; let children use the hook instead of receiving props from parent
  • CRITICAL: All logging must use logger.ts - never use console.log

Read the full file on GitHub · 118 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. yesterday First seen · 118 lines · 0 tokens per session scan A 7bd876b7f0ac

Subscribe to this mod's changes

component_layer_rules is a cursor rule published in the GitHub repository ModelEngine-Group/nexent (5,841 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 966 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.