Modern Web Development

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Modern web development best practices for TypeScript, Next.js 14, React Server Components, Supabase, GraphQL, and Tailwind CSS.

AI 生成的概览

使用 TypeScript、Next.js、React、Supabase、GraphQL 和 Tailwind 构建现代 Web 应用的编码规范与最佳实践。

功能
提供一套开发准则,涵盖代码风格、TypeScript 与 JavaScript 标准、错误处理、React 与 Next.js 模式、数据与状态管理、Supabase 与 GraphQL 用法、样式、测试、无障碍和文档。该技能仅为说明性内容,不生成文件或脚本,产出是代理在编写或审查代码时遵循的指导。
适用场景
适用于基于 TypeScript、Next.js 14、React Server Components、Supabase、GraphQL 和 Tailwind CSS 的现代 Web 应用开发或代码审查。也适合需要统一组件、数据获取、样式和测试约定的工作。
运行要求
该技能不附带脚本或资源,仅为说明性内容。应用时假定项目使用 TypeScript、Next.js、React、Supabase、GraphQL 和 Tailwind CSS,但阅读这些指导本身不需要凭据、软件包或网络访问。

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

来源与署名

来源:mindrally/skills位于modern-web-development提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架