TypeScript Shadcn UI Next.js .cursorrules prompt file
About .cursorrules prompt file
What you can build
Code Snippet Generator with TypeScript Focus - Create a tool that generates concise, functional TypeScript code snippets based on user requirements. It will incorporate patterns like iteration, modularization, and use of interfaces.
React Component Design System - Develop a design system using functional React components, integrated with Shadcn UI and Tailwind CSS, providing examples with TypeScript interfaces and declarative JSX.
Error Handling SDK - Provide a library focused on error handling and validation using TypeScript and Zod. It can model expected errors, implement error boundaries, and return user-friendly messages.
Responsive Design Toolkit - Offer a service to automatically generate mobile-first responsive designs using Tailwind CSS, focusing on performance optimization with features like image lazy loading and dynamic component loading.
Next.js Performance Optimizer - A tool that analyzes Next.js projects for optimization opportunities focusing on 'use client', 'useEffect', React Server Components, image optimization, and Web Vitals improvement.
Zod Validation Studio - Create an application where developers can design and test form validations with Zod, getting real-time feedback on expected error models and integration with functional components.
Search Parameter State Manager - Develop a utility library for managing URL search parameters using 'nuqs', ensuring optimal state persistence in Next.js applications.
TypeScript Interface Converter - A service that converts JavaScript objects and types into TypeScript interfaces, encouraging type safety and better integration with functional programming patterns.
Functional Programming Playground - An interactive platform for practicing TypeScript functional patterns, enforcing modularization and avoidance of class-based components through challenges and examples.
Shadcn UI Component Library - Provide a collection of pre-built React components styled with Tailwind and Radix UI, optimized for server-side rendering with bare minimum client-side code usage.
Benefits
- Emphasizes concise and functional TypeScript code; advocates modularization and descriptive naming conventions.
- Encourages performance optimizations with React Server Components and dynamic loading; highlights minimal use of client-side hooks.
- Advocates specific libraries for UI and styling, ensuring consistent design principles and responsive layouts.
Synopsis
Front-end developers building scalable React and Next.js applications will benefit by implementing TypeScript-driven architecture and enhancing performance, error handling, and UI styling standards.
Overview of .cursorrules prompt
The .cursorrules file provides guidelines for writing TypeScript code focusing on style, structure, and best practices. It emphasizes concise, functional, and declarative programming, discouraging the use of classes and code duplication. Developers are advised to use descriptive naming conventions and to structure files systematically, preferring interfaces over types and avoiding enums by using maps. The file outlines syntax preferences, advocating for pure functions and clean conditionals. Error handling is prioritized with suggestions for early returns, proper logging, and user-friendly messages. For UI and styling, the file recommends using Shadcn UI, Radix, and Tailwind CSS, emphasizing responsive design and performance optimization through dynamic loading and React Server Components. Key conventions include managing URL state with 'nuqs' and adhering to Next.js best practices for data fetching and rendering, while optimizing Web Vitals.