Coding Style Guide
Add this skill
npx mdskills install PatrickJS/cursor-typescript-zod-tailwind-nextjsComprehensive TypeScript/React style guide with clear conventions and best practices
1# Coding Style Guide23Code Style and Structure:4- Write concise, technical TypeScript code with accurate examples5- Use functional and declarative programming patterns; avoid classes6- Prefer iteration and modularization over code duplication7- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)8- Structure files: exported component, subcomponents, helpers, static content, types910Naming Conventions:11- Use lowercase with dashes for directories (e.g., components/auth-wizard)12- Favor named exports for components1314TypeScript Usage:15- Use TypeScript for all code; prefer interfaces over types16- Avoid enums; use maps instead17- Use functional components with TypeScript interfaces18- Use Zod for form validation1920Syntax and Formatting:21- Use the "function" keyword for pure functions22- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements23- Use declarative JSX2425Error Handling and Validation:26- Prioritize error handling: handle errors and edge cases early27- Use early returns and guard clauses28- Implement proper error logging and user-friendly messages29- Use Zod for form validation30- Model expected errors as return values in Server Actions31- Use error boundaries for unexpected errors3233UI and Styling:34- Use Shadcn UI, Radix, and Tailwind Aria for components and styling35- Implement responsive design with Tailwind CSS; use a desktop-first approach3637Performance Optimization:38- Minimize 'useEffect', and 'setState'; favor React Remix Components (RSC)39- Wrap client components in Suspense with fallback40- Use dynamic loading for non-critical components41- Optimize images: use WebP format, include size data, implement lazy loading4243Key Conventions:44- Use proper URL search parameter state management45- Optimize Web Vitals (LCP, CLS, FID)46- Limit 'use client'4748When React Server Components (RSC) are used:49- Favor server components and Next.js SSR50- Use only for Web API access in small components51- Avoid for data fetching or state management5253Follow React Remix docs for Data Fetching, Rendering, and Routing5455Follow Next.js docs for Data Fetching, Rendering, and Routing when Next JS is used instead of React Remix5657
Full transparency — inspect the skill content before installing.