IDE-Tools · Foto: Homedust, CC BY 2.0
TypeScript Zod Tailwind Next.js Cursorrules Prompt
Zuletzt aktualisiert:
Typ
Regel
Lizenz
CC0 1.0
Anwendungsfeld
Cursor Rules
Voraussetzungen
Keine besonderen — direkt loslegen.
Next.js-Regel: Zod-Validierung für Formulare/APIs kombiniert mit Tailwind-Styling.
Original-Beschreibung der Autoren: Cursor rules for TypeScript development with Zod, Tailwind, and Next.js integration.
Die Regel
---
description: "Cursor rules for TypeScript development with Zod, Tailwind, and Next.js integration."
globs: **/*
alwaysApply: false
---
# Coding Style Guide
Code Style and Structure:
- Write concise, technical TypeScript code with accurate examples
- Use functional and declarative programming patterns; avoid classes
- Prefer iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
- Structure files: exported component, subcomponents, helpers, static content, types
Naming Conventions:
- Use lowercase with dashes for directories (e.g., components/auth-wizard)
- Favor named exports for components
TypeScript Usage:
- Use TypeScript for all code; prefer interfaces over types
- Avoid enums; use maps instead
- Use functional components with TypeScript interfaces
- Use Zod for form validation
Syntax and Formatting:
- Use the "function" keyword for pure functions
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
- Use declarative JSX
Error Handling and Validation:
- Prioritize error handling: handle errors and edge cases early
- Use early returns and guard clauses
- Implement proper error logging and user-friendly messages
- Use Zod for form validation
- Model expected errors as return values in Server Actions
- Use error boundaries for unexpected errors
UI and Styling:
- Use Shadcn UI, Radix, and Tailwind Aria for components and styling
- Implement responsive design with Tailwind CSS; use a desktop-first approach
Performance Optimization:
- Minimize 'useEffect', and 'setState'; favor React Remix Components (RSC)
- Wrap client components in Suspense with fallback
- Use dynamic loading for non-critical components
- Optimize images: use WebP format, include size data, implement lazy loading
Key Conventions:
- Use proper URL search parameter state management
- Optimize Web Vitals (LCP, CLS, FID)
- Limit 'use client'
When React Server Components (RSC) are used:
- Favor server components and Next.js SSR
- Use only for Web API access in small components
- Avoid for data fetching or state management
Follow React Remix docs for Data Fetching, Rendering, and Routing
Follow Next.js docs for Data Fetching, Rendering, and Routing when Next JS is used instead of React Remix
So nutzt du sie
Die Regel kopieren (Button oben) oder als Datei herunterladen und im Projekt unter .cursor/rules/ ablegen — Cursor lädt sie beim nächsten Start automatisch. Ältere Cursor-Versionen lesen alternativ eine einzelne .cursorrules-Datei im Projektstamm; dort einfach den Regel-Text ohne den Kopfblock zwischen den ----Zeilen einfügen.
Der Regel-Text ist englisch — Cursor versteht ihn unabhängig von der Sprache, in der Sie mit dem Editor chatten.
Im Detail
Diese Regel bündelt drei Next.js-Bausteine: TypeScript für Typsicherheit, Zod für Laufzeit-Validierung von Formulardaten und API-Eingaben sowie Tailwind für das Styling. Der Mehrwert gegenüber einer reinen TypeScript-Regel ist, dass Zod-Schemas typischerweise sowohl clientseitig für Formulare als auch serverseitig in Route Handlers wiederverwendet werden, sodass Validierungslogik nicht doppelt gepflegt werden muss. Für Next.js-Teams, die Formulare und APIs häufig neu bauen und dabei einheitliche Fehlerbehandlung sowie Utility-First-CSS statt eigener Stylesheets wollen, spart das Zeit. Wer bereits eine eigene Validierungs- oder Styling-Strategie etabliert hat, sollte prüfen, ob sich das mit Zod und Tailwind verträgt.
Praxis-Tipp
Gut geeignet für Formular-lastige Seiten, z. B. mit „Erstelle ein Kontaktformular mit Zod-Validierung und einer Next.js-API-Route, gestylt mit Tailwind“.
Siehe auch
Lizenz & Quelle
- Lizenz: CC0 1.0
- Quelle: PatrickJS/awesome-cursorrules (GitHub)
Inhalt ansehen (typescript-zod-tailwind-nextjs-cursorrules-prompt.mdc)
Lade …
Erfahrungen & Kommentare.
Funktioniert der Regel bei Ihnen? Tipps, Stolperfallen, Varianten — teilen Sie es mit der Community.
Lade Kommentare …
Passt dazu.
AI Agent Specialist
Cursor-Regel für diszipliniertes, klar abgegrenztes Agenten-Verhalten statt unstrukturierter KI-Antworten.
Alpha Skills Quant Factor Research
Cursor-Regel für methodisch saubere quantitative Faktor-Recherche im Trading-Umfeld.
Android Jetpack Compose
Cursor-Regel für idiomatischen, deklarativen Android-UI-Code mit Jetpack Compose.
