sagarithm-kit / rules
Cursor rule17 starsChanged 12 days agoApache-2.0View on GitHub
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,183 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository252 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/ai-systems-and-rag.mdcCursor rule
- .cursor/rules/architecture-spec-driven-development.mdcCursor rule
- .cursor/rules/architecture-system-design.mdcCursor rule
- .cursor/rules/backend-distributed-systems.mdcCursor rule
- .cursor/rules/database-architecture-and-modeling.mdcCursor rule
- .cursor/rules/delivery-shipping-and-launch.mdcCursor rule
- .cursor/rules/devops-sre-observability.mdcCursor rule
- .cursor/rules/documentation-architectural-decision-records.mdcCursor rule
- .cursor/rules/engineering-ai-data-remediation-engineer.mdcCursor rule
- .cursor/rules/engineering-ai-engineer.mdcCursor rule
- .cursor/rules/engineering-api-platform-engineer.mdcCursor rule
- .cursor/rules/engineering-autonomous-optimization-architect.mdcCursor rule
- .cursor/rules/engineering-backend-architect.mdcCursor rule
- .cursor/rules/engineering-cms-developer.mdcCursor rule
- .cursor/rules/engineering-codebase-onboarding-engineer.mdcCursor rule
- .cursor/rules/engineering-code-reviewer.mdcCursor rule
- .cursor/rules/engineering-database-optimizer.mdcCursor rule
- .cursor/rules/engineering-data-engineer.mdcCursor rule
- .cursor/rules/engineering-desktop-app-engineer.mdcCursor rule
- .cursor/rules/engineering-devops-automator.mdcCursor rule
- .cursor/rules/engineering-drupal-performance.mdcCursor rule
- .cursor/rules/engineering-drupal-shopping-cart.mdcCursor rule
- .cursor/rules/engineering-email-intelligence-engineer.mdcCursor rule
- .cursor/rules/engineering-embedded-firmware-engineer.mdcCursor rule
- .cursor/rules/engineering-feishu-integration-developer.mdcCursor rule
- .cursor/rules/engineering-filament-optimization-specialist.mdcCursor rule
- .cursor/rules/engineering-finops-engineer.mdcCursor rule
- .cursor/rules/engineering-frontend-developer.mdcCursor rule
- .cursor/rules/engineering-git-workflow-master.mdcCursor rule
- .cursor/rules/engineering-i18n-engineer.mdcCursor rule
- .cursor/rules/engineering-identity-access-engineer.mdcCursor rule
- .cursor/rules/engineering-incident-response-commander.mdcCursor rule
- .cursor/rules/engineering-it-service-manager.mdcCursor rule
- .cursor/rules/engineering-minimal-change-engineer.mdcCursor rule
- .cursor/rules/engineering-mobile-app-builder.mdcCursor rule
- .cursor/rules/engineering-mobile-release-engineer.mdcCursor rule
- .cursor/rules/engineering-multi-agent-systems-architect.mdcCursor rule
- .cursor/rules/engineering-network-engineer.mdcCursor rule
- .cursor/rules/engineering-orgscript-engineer.mdcCursor rule
- .cursor/rules/engineering-payments-billing-engineer.mdcCursor rule
- .cursor/rules/engineering-prompt-engineer.mdcCursor rule
- .cursor/rules/engineering-rapid-prototyper.mdcCursor rule
- .cursor/rules/engineering-realtime-collaboration-engineer.mdcCursor rule
- .cursor/rules/engineering-search-relevance-engineer.mdcCursor rule
- .cursor/rules/engineering-section-508-specialist.mdcCursor rule
- .cursor/rules/engineering-senior-developer.mdcCursor rule
- .cursor/rules/engineering-software-architect.mdcCursor rule
- .cursor/rules/engineering-solidity-smart-contract-engineer.mdcCursor rule
- .cursor/rules/engineering-sre.mdcCursor rule
- .cursor/rules/engineering-technical-writer.mdcCursor rule
- .cursor/rules/engineering-uswds-developer.mdcCursor rule
- .cursor/rules/engineering-video-streaming-engineer.mdcCursor rule
- .cursor/rules/engineering-voice-ai-integration-engineer.mdcCursor rule
- .cursor/rules/engineering-webassembly-engineer.mdcCursor rule
- .cursor/rules/engineering-wechat-mini-program-developer.mdcCursor rule
- .cursor/rules/engineering-wordpress-performance.mdcCursor rule
- .cursor/rules/engineering-wordpress-shopping-cart.mdcCursor rule
- The first 60 shown.
The file
We split this frontend-ui-engineering.mdc into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Component Boundary Precision: Do not generate 500-line monolithic components.
- Distinctive: line 18
Zero Hallucinated CSS: Use design tokens or validated utility classes (Tailwind CSS / CSS Variables).
- Distinctive: line 19
Lean Context State: Avoid global state dumpsters.
- Very specific: line 29
Keyboard Navigation: All interactive elements must be focusable, show distinct focus rings (focus-visible:ring-2), and support standard …
- Very specific: line 30
ARIA Semantics: Use native semantic HTML elements (<button>, <nav>, <main>, <article>) before applying ARIA attributes.
- Very specific: line 35
Cumulative Layout Shift (CLS < 0.1): Always provide explicit width and height (or aspect-ratio containers) on images, skeletons, and …
- Very specific: line 39
Avoid accessing window, localStorage, or document during server-side rendering (SSR).
- Very specific: line 40
Never render non-deterministic content during SSR (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule 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
<!-- SAGARITHM:START - DO NOT EDIT DIRECTLY -->
---
description: "Engineer production-grade frontend architectures, design systems, accessible UI components, state machines, and optimal Core Web Vitals with minimal token overhead."
globs: ["**/*"]
alwaysApply: false
---
# Frontend Architecture & UI/UX Engineering
# Frontend Architecture & UI/UX Engineering
## Overview
This skill encodes the standards of a Principal Frontend Architect and Staff Design Systems Engineer. It guides AI agents in authoring resilient, accessible, high-performance UI components while minimizing prompt/context bloat through concise architectural patterns.
## 🎯 Token Conservation & High-Yield Heuristics
1. **Component Boundary Precision**: Do not generate 500-line monolithic components. Decompose into focused subcomponents: Presentational (pure UI), Container (data/hooks), and Compound Components.
2. **Deterministic Prop Interfaces**: Define strict TypeScript interfaces for component props before implementation. Prefer discriminated unions for polymorphic components (`type ButtonProps = PrimaryBtn | SecondaryBtn`).
3. **Zero Hallucinated CSS**: Use design tokens or validated utility classes (Tailwind CSS / CSS Variables). Do not output arbitrary pixel values or inline style clutter.
4. **Lean Context State**: Avoid global state dumpsters. Colocate state as close as possible to where it is consumed; use URL search params for bookmarkable UI state.
## 📐 Core Engineering Directives
### 1. Component Architecture & Design Systems
- **Atomic Design Principles**: Organize UI into Atoms (buttons, inputs), Molecules (form fields, search bars), Organisms (navbars, cards, tables), and Templates/Pages.
- **Compound Components Pattern**: Provide flexible composition (`<Dialog>`, `<Dialog.Title>`, `<Dialog.Body>`, `<Dialog.Close>`) rather than ballooning boolean props (`showCloseButton`, `hasHeaderDivider`, etc.).
- **Headless UI Primitives**: Separate logic and accessibility from styling. Leverage Radix UI, Headless UI, or native HTML5 elements (`<dialog>`, `<details>`) whenever possible.
### 2. Accessibility (WCAG 2.1 AA Compliance)
- **Keyboard Navigation**: All interactive elements must be focusable, show distinct focus rings (`focus-visible:ring-2`), and support standard keyboard interactions (`Enter`, `Space`, `Escape`, arrow keys).
- **ARIA Semantics**: Use native semantic HTML elements (`<button>`, `<nav>`, `<main>`, `<article>`) before applying ARIA attributes. Never place click handlers on non-interactive `<div>` or `<span>` without `role="button"`, `tabIndex={0}`, and `onKeyDown`.
- **Color Contrast**: Maintain minimum 4.5:1 contrast for normal text and 3:1 for large text / UI controls.
### 3. Performance & Core Web Vitals
- **Largest Contentful Paint (LCP < 2.5s)**: Preload hero images, avoid client-side rendering cascades for above-the-fold content, use modern image formats (WebP/AVIF).
- **Cumulative Layout Shift (CLS < 0.1)**: Always provide explicit `width` and `height` (or aspect-ratio containers) on images, skeletons, and dynamic embeds.
- **Interaction to Next Paint (INP < 200ms)**: Defer heavy computations off the main thread; use `useTransition` or `startTransition` for non-urgent state updates; avoid synchronous re-renders of huge lists (use virtual scrolling).
### 4. Hydration Safety & Rendering Boundaries
- Avoid accessing `window`, `localStorage`, or `document` during server-side rendering (SSR). Guard with `useEffect` or client-only components.
- Never render non-deterministic content during SSR (e.g. `Date.now()`, random numbers) without proper hydration isolation.
## 🛑 Anti-Rationalization Matrix
| Agent Excuse / Shortcut | Frontend Engineering Reality | Mandatory Action |
|---|---|---|
| *"I'll use a `div` with an `onClick` because it's easier to style."* | Breaks screen readers, keyboard navigation, and browser accessibility trees. | Use a native `<button>` element with appropriate CSS reset or accessibility props. |
| *"I'll store all UI state in global Redux/Zustand."* | Triggers unnecessary re-renders across the entire component tree and bloats memory. | Colocate state in local component state, URL search params, or atomic context. |
| *"I'll skip responsive layout testing; desktop view is fine."* | Over 55% of web traffic is mobile. Layout will break on viewport resize. | Implement mobile-first responsive breakpoints (`sm:`, `md:`, `lg:`) and test touch targets ($\ge 44 \times 44\text{px}$). |
| *"I'll generate inline SVG paths directly in the JSX."* | Clutters code and consumes massive prompt context tokens. | Extract SVGs into standalone icon components or use established icon libraries (Lucide, Heroicons). |
## ✅ Frontend Verification Checklist
- [ ] No layout shift (CLS = 0) during page load or font loading.
- [ ] Full keyboard navigation verified without mouse assistance.
- [ ] Responsive across 320px, 768px, 1024px, and 1440px viewports.
- [ ] Zero console warnings regarding missing keys, duplicate IDs, or hydration mismatches.
- [ ] Strict TypeScript prop contracts with zero `any` types.
<!-- SAGARITHM:END -->
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.

