modern-web-development
Modern web development best practices for TypeScript, Next.js 14, React Server Components, Supabase, GraphQL, and Tailwind CSS.
What this skill does
# Modern Web Development Brandon Fernandez's comprehensive cursor rules for modern web development with TypeScript, Node.js, Next.js 14, React, Supabase, GraphQL, Tailwind CSS, Radix UI, and Shadcn UI. ## Key Development Principles ### Code Style and Architecture - Write concise, technical responses with accurate TypeScript examples - Employ functional, declarative programming while avoiding class-based approaches - Prioritize iteration and modularization over code duplication - Use descriptive variable names with auxiliary verbs (`isLoading`, `hasError`) - Implement the RORO pattern (Receive an Object, Return an Object) ### JavaScript/TypeScript Standards - Use `function` keyword for pure functions - Omit semicolons - Leverage TypeScript exclusively, preferring interfaces over types - Structure files as: exported component, subcomponents, helpers, static content, types - Minimize unnecessary curly braces in conditionals ### Error Handling - Address errors and edge cases at function entry points - Apply early returns for error conditions avoiding deep nesting - Position the success path last for improved readability - Use guard clauses for precondition validation - Implement user-friendly error messaging ## React and Next.js Guidelines - Use functional components with TypeScript interfaces - Write declarative JSX using `function` declarations - Style with Shadcn UI, Radix, and Tailwind CSS - Implement mobile-first responsive design - Minimize `use client`, `useEffect`, and `setState` - favor React Server Components - Employ Zod for form validation - Wrap client components in Suspense with fallbacks - Use dynamic loading for non-critical components - Optimize images (WebP format, size data, lazy loading) ## Data and State Management - Leverage React Server Components for data fetching - Implement the preload pattern to prevent waterfalls - Use Supabase for real-time synchronization and state management - Consider Vercel KV for chat history, rate limiting, and sessions ## Supabase and GraphQL - Use Supabase client for database interactions and subscriptions - Implement Row Level Security (RLS) policies - Leverage Supabase Auth, Storage, and Edge Functions - Use Genql for type-safe GraphQL API interactions - Optimize GraphQL queries to fetch only necessary data ## Styling and Testing ### Styling - Apply Tailwind CSS utility-first approach - Use Class Variance Authority (CVA) for component variants ### Testing - Implement unit tests for utilities and hooks - Create integration tests for complex components - Develop end-to-end tests for critical user flows ## Accessibility and Documentation ### Accessibility - Ensure keyboard navigation throughout interfaces - Implement proper ARIA labels and semantic roles - Maintain WCAG-compliant color contrast ratios ### Documentation - Provide clear JSDoc comments for IDE intellisense - Document Supabase schemas, RLS policies, and Edge Functions
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.