60-stack-frontend

A set of coding rules for TypeScript and React front ends, including type safety, functional components, user-interface states, performance, and accessibility.

In plain words
What is it for?
Use it when creating or changing React and TypeScript interfaces, especially components, forms, loading states, errors, and keyboard-accessible controls.
Why use it?
It gives developers consistent practices for building safer, more maintainable, and easier-to-use web interfaces.

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/zoxknez/ai-coding-rules/60-stack-frontend
Clone the repo
git clone --depth 1 https://github.com/zoxknez/ai-coding-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 803 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00803
Opus 5 $0.00000 $0.00402
Sonnet 5 $0.00000 $0.00161
Haiku 4.5 $0.00000 $0.00080

Measured 2d ago against content hash 6fbbd8e43d59, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

60-stack-frontend scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

fetch(url, { next: { revalidate: 60 } });
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/60-stack-frontend.mdc · 117 lines

How it starts

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

Frontend (TypeScript/React)

Type Safety

  • Ban any — use unknown with type guards if needed.
  • Prefer interface for object shapes, type for unions/intersections.
  • Use strict TypeScript configuration.

React Style

  • Functional components + hooks only — no class components.
  • Avoid unnecessary state; prefer reducer/context for complex state.
  • Handle all UI states: loading, empty, error, success.

Exports

  • Prefer named exports over default exports.
  • One component per file for main components.

Performance

  • Avoid unnecessary re-renders; memoize only when justified.
  • Use dynamic imports for heavy components.
  • Prevent N+1 fetches in UI loops.

Accessibility (A11y)

  • Buttons must be <button> elements.
  • Inputs must have associated labels.
  • Use aria-label for icon-only buttons.
  • Ensure keyboard navigation for menus/dialogs.

Next.js 15 App Router (Optional)

Apply when working with Next.js 15+ App Router architecture.

Component Strategy

Type When to Use Directive
Server Component Default for all components None needed
Client Component Event handlers, hooks, browser APIs 'use client' at top

Rule: Start with Server Components. Add 'use client' only when you need:

  • useState, useEffect, or other hooks
  • Event handlers (onClick, onChange, etc.)
  • Browser-only APIs (window, localStorage, etc.)

Data Fetching Patterns

Parallel Fetching (Avoid Waterfalls)
// ❌ BAD: Sequential (waterfall) — slow
const user = await getUser();
const posts = await getPosts();
const comments = await getComments();

// ✅ GOOD: Parallel — fast
const [user, posts, comments] = await Promise.all([
  getUser(),
  getPosts(),
  getComments()
]);
Server Actions for Mutations
// ✅ Preferred: Server Action
async function createPost(formData: FormData) {
  'use server';
  
  const title = formData.get('title');
  // Validation, DB insert, etc.
  revalidatePath('/posts');
}

// Usage in component
<form action={createPost}>
  <input name="title" />
  <button type="submit">Create</button>
</form>

Read the full file on GitHub · 117 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. 2d ago First seen · 117 lines · 0 tokens per session scan A 6fbbd8e43d59

Subscribe to this mod's changes

60-stack-frontend is a cursor rule published in the GitHub repository zoxknez/ai-coding-rules (27 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 803 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.