Communitygithub.com

xzedm/clipplic-landing

来自 Vercel 工程团队的 React 和 Next.js 性能优化指南。在编写、审查或重构 React/Next.js 代码时使用,以确保遵循最佳性能模式。适用于涉及 React 组件、Next.js 页面、数据获取、包优化或性能改进的任务。

clipplic-landing 是什么?

该技能是来自 Vercel 工程团队的综合性 React 和 Next.js 性能优化指南,包含 70 条按影响程度分级的规则,覆盖 8 个类别。它旨在指导自动重构和代码生成,确保开发者始终采用最佳性能实践。主要类别包括消除瀑布流(关键)、包体积优化(关键)、服务端性能(高)、客户端数据获取(中高)、重渲染优化(中)、渲染性能(中)、JavaScript 性能(中低)和高级模式(低)。每条规则配有清晰的优先级标签、前缀和简短说明,便于快速查找和应用。该技能适用于 Cursor、Claude Code 和其他支持 AI 技能的编码助手。使用时,开发者可以阅读单独的规则文件(位于 `rules/` 目录)获取详细解释和代码示例,或查阅完整版指南 `AGENTS.md`。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/xzedm/clipplic-landing/tree/HEAD/.agents/skills/vercel-react-best-practices

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Vercel React 最佳实践

由 Vercel 维护的 React 和 Next.js 应用综合性能优化指南。包含 8 个类别 70 条规则,按影响程度分级,用于指导自动重构和代码生成。

何时应用

在以下情况参考这些指南:

  • 编写新的 React 组件或 Next.js 页面
  • 实现数据获取(客户端或服务端)
  • 审查代码性能问题
  • 重构现有的 React/Next.js 代码
  • 优化包体积或加载时间

按优先级划分的规则类别

优先级类别影响前缀
1消除瀑布流关键async-
2包体积优化关键bundle-
3服务端性能高server-
4客户端数据获取中-高client-
5重渲染优化中rerender-
6渲染性能中rendering-
7JavaScript 性能低-中js-
8高级模式低advanced-

快速参考

1. 消除瀑布流(关键)

  • async-cheap-condition-before-await - 在等待标志或远程值之前检查廉价同步条件
  • async-defer-await - 将 await 移到实际使用的分支中
  • async-parallel - 对于独立操作使用 Promise.all()
  • async-dependencies - 对于部分依赖使用 better-all
  • async-api-routes - 在 API 路由中尽早启动 promise,延迟 await
  • async-suspense-boundaries - 使用 Suspense 流式传输内容

2. 包体积优化(关键)

  • bundle-barrel-imports - 直接导入,避免使用 barrel 文件
  • bundle-analyzable-paths - 优先使用静态可分析的导入和文件系统路径,避免宽泛的包和追踪
  • bundle-dynamic-imports - 对重型组件使用 next/dynamic
  • bundle-defer-third-party - 在 hydration 之后加载分析/日志功能
  • bundle-conditional - 仅在功能激活时加载模块
  • bundle-preload - 在悬停/聚焦时预加载以提升感知速度

3. 服务端性能(高)

  • server-auth-actions - 像 API 路由一样对服务器操作进行身份验证
  • server-cache-react - 使用 React.cache() 进行每个请求的去重
  • server-cache-lru - 使用 LRU 缓存进行跨请求缓存
  • server-dedup-props - 避免 RSC props 中的重复序列化
  • server-hoist-static-io - 将静态 I/O(字体、标志)提升到模块级别
  • server-no-shared-module-state - 在 RSC/SSR 中避免模块级别的可变请求状态
  • server-serialization - 最小化传递给客户端组件的数据
  • server-parallel-fetching - 重组组件以并行化获取
  • server-parallel-nested-fetching - 在 Promise.all 中为每个条目链式嵌套获取
  • server-after-nonblocking - 使用 after() 进行非阻塞操作

4. 客户端数据获取(中-高)

  • client-swr-dedup - 使用 SWR 进行自动请求去重
  • client-event-listeners - 去重全局事件监听器
  • client-passive-event-listeners - 对滚动使用被动监听器
  • client-localstorage-schema - 对 localStorage 数据进行版本化和最小化

5. 重渲染优化(中)

  • rerender-defer-reads - 不要订阅仅在回调中使用的状态
  • rerender-memo - 将昂贵计算提取到记忆化组件中
  • rerender-memo-with-default-value - 提升默认的非原始 props
  • rerender-dependencies - 在 effect 中使用原始依赖项
  • rerender-derived-state - 订阅派生布尔值,而不是原始值
  • rerender-derived-state-no-effect - 在渲染期间(而非 effect 中)派生状态
  • rerender-functional-setstate - 使用函数式 setState 以获得稳定的回调
  • rerender-lazy-state-init - 对于昂贵值,传递函数给 useState
  • rerender-simple-expression-in-memo - 避免对简单原始值使用 memo
  • rerender-split-combined-hooks - 拆分具有独立依赖项的 hooks
  • rerender-move-effect-to-event - 将交互逻辑放入事件处理函数
  • rerender-transitions - 对非紧急更新使用 startTransition
  • rerender-use-deferred-value - 延迟昂贵渲染以保持输入响应
  • rerender-use-ref-transient-values - 使用 ref 存储短暂的频繁值
  • rerender-no-inline-components - 不要在组件内部定义组件

6. 渲染性能(中)

  • rendering-animate-svg-wrapper - 动画化 div 包装器,而不是 SVG 元素
  • rendering-content-visibility - 对长列表使用 content-visibility
  • rendering-hoist-jsx - 将静态 JSX 提取到组件外部
  • rendering-svg-precision - 降低 SVG 坐标精度
  • rendering-hydration-no-flicker - 使用内联脚本处理仅客户端数据
  • rendering-hydration-suppress-warning - 抑制预期的不匹配警告
  • rendering-activity - 使用 Activity 组件进行显示/隐藏
  • rendering-conditional-render - 使用三元运算符,而不是 && 进行条件渲染
  • rendering-usetransition-loading - 优先使用 useTransition 处理加载状态
  • rendering-resource-hints - 使用 React DOM 资源提示进行预加载
  • rendering-script-defer-async - 在 script 标签上使用 defer 或 async

7. JavaScript 性能(低-中)

  • js-batch-dom-css - 通过类或 cssText 批量处理 CSS 更改
  • js-index-maps - 为重复查找构建 Map
  • js-cache-property-access - 在循环中缓存对象属性
  • js-cache-function-results - 在模块级 Map 中缓存函数结果
  • js-cache-storage - 缓存 localStorage/sessionStorage 读取
  • js-combine-iterations - 将多个 filter/map 合并为一个循环
  • js-length-check-first - 在进行昂贵比较之前检查数组长度
  • js-early-exit - 从函数中提前返回
  • js-hoist-regexp - 将 RegExp 创建提升到循环外部
  • js-min-max-loop - 使用循环计算最小/最大值,而不是排序
  • js-set-map-lookups - 使用 Set/Map 进行 O(1) 查找
  • js-tosorted-immutable - 使用 toSorted() 保持不可变性
  • js-flatmap-filter - 使用 flatMap 在一次遍历中完成映射和过滤
  • js-request-idle-callback - 将非关键工作推迟到浏览器空闲时间

8. 高级模式(低)

  • advanced-effect-event-deps - 不要将 useEffectEvent 的结果放入 effect 依赖项
  • advanced-event-handler-refs - 将事件处理函数存储在 ref 中
  • advanced-init-once - 每次应用加载时初始化一次
  • advanced-use-latest - 使用 useLatest 获取稳定的回调 ref

如何使用

阅读单独的规则文件以获取详细解释和代码示例:

rules/async-parallel.md
rules/bundle-barrel-imports.md

每个规则文件包含:

  • 为什么重要的简要说明
  • 错误代码示例及解释
  • 正确代码示例及解释
  • 其他上下文和参考

完整编译文档

有关所有规则扩展的完整指南:AGENTS.md

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

xzedm/clipplic-landing

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

xzedm/clipplic-landing

Material Design 3 and Android platform guidelines. Use when building Android apps with Jetpack Compose or XML layouts, implementing Material You, navigation, or accessibility. Triggers on tasks involving Android UI, Compose components, dynamic color, or Material Design compliance.

xzedm/clipplic-landing

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

xzedm/clipplic-landing

Design iOS apps following Apple's Human Interface Guidelines. Generate native components, validate designs, and ensure accessibility compliance for iPhone, iPad, and Apple Watch.

xzedm/clipplic-landing

Redesign mobile app UI to feel unmistakably Apple-like, iOS-forward, and native. Use this skill when building iOS apps, applying Apple Human Interface Guidelines, or creating native-feeling mobile interfaces with SF Pro typography, translucency, and system-like components.

xzedm/clipplic-landing

Accessibility engineering for product interfaces, from focus states and keyboard support to ARIA, forms, and screen readers. Use when building or reviewing UI components, modals, menus, forms, custom widgets, or when the user says "make this accessible" or reports keyboard or screen-reader issues. Triggers on accessibility, a11y, WCAG, aria, focus ring, focus-visible, focus trap, keyboard navigation, tab order, tabindex, screen reader, sr-only, aria-live, alt text, hit area, touch target, prefers-reduced-motion, autoplay, toast duration, skip link, semantic HTML, aria-label, form errors, disabled buttons, "not keyboard accessible".

xzedm/clipplic-landing

OKLCH color space and color usage for web projects. Convert hex/rgb/hsl to oklch, generate palettes, check contrast, handle gamut boundaries, theme with Tailwind v4, and apply color with meaning. Triggers on oklch, color conversion, palette generation, contrast ratio, gamut, display p3, design tokens, semantic color tokens, hue drift, chroma, dark mode colors, accent color, color meaning, light and dark appearance, increased contrast.

xzedm/clipplic-landing

Layout structure for web interfaces, from grouping and alignment to reading order, progressive disclosure, and adaptive breakpoints. Use when structuring a page or component, spacing or aligning controls, deciding what collapses at small sizes, handling RTL layout direction, or reviewing frontend code for layout. Triggers on layout, spacing, alignment, grouping, negative space, whitespace, visual hierarchy, reading order, progressive disclosure, breakpoints, responsive layout, container queries, safe area, full-bleed, edge-to-edge, layout margins, RTL layout, logical properties.

xzedm/clipplic-landing

Web typography from choosing fonts to spacing, wrapping and accessibility. Use when picking or pairing typefaces, configuring variable fonts or OpenType features, setting up a type scale, checking heading hierarchy, styling text in components, truncating text, styling underlines, selection, placeholders or carets, or reviewing frontend code for typography. Triggers on typography, fonts, font formats, woff2, variable fonts, font-weight, opentype, font-feature-settings, letter-spacing, line-height, type scale, heading hierarchy, heading levels, tabular numbers, text-wrap, truncation, line clamp, underlines, text-decoration, text selection, iOS input zoom, scaled input text, font smoothing, text contrast, measure, line length, text-box, smart punctuation, drop cap.

xzedm/clipplic-landing

Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, micro-interactions, enter/exit animations, choosing or reviewing icons, or any visual detail work. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, image outlines, box shadows, icons, icon stroke weight, icon states, motion restraint.

xzedm/clipplic-landing

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

xzedm/clipplic-landing

Generate developer handoff specs from a design. Use when a design is ready for engineering and needs a spec sheet covering layout, design tokens, component props, interaction states, responsive breakpoints, edge cases, and animation details.

xzedm/clipplic-landing

This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.

xzedm/clipplic-landing

Extract design primitives from a public website and generate starter token files for your project.

xzedm/clipplic-landing

Use this skill alongside figma-use when the task involves translating an application page, view, or multi-section layout into Figma. Triggers: 'write to Figma', 'create in Figma from code', 'push page to Figma', 'take this app/page and build it in Figma', 'create a screen', 'build a landing page in Figma', 'update the Figma screen to match code', 'convert this modal/dialog/drawer/panel to Figma'. This is the preferred workflow skill whenever the user wants to build or update a full page, modal, dialog, drawer, sidebar, panel, or any composed multi-section view in Figma from code or a description. Discovers design system components, variables, and styles from Code Connect files, existing screens, and library search, then imports them and assembles views incrementally section-by-section using design system tokens instead of hardcoded values.

xzedm/clipplic-landing

**MANDATORY prerequisite**: you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context, e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.

xzedm/clipplic-landing

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

xzedm/clipplic-landing

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications.

xzedm/clipplic-landing

Elite UX/UI & Advanced GSAP Motion Engineer. Enforces Python-driven true randomization for layout variance, strict AIDA page structure, wide editorial typography (bans 6-line wraps), gapless bento grids, strict GSAP ScrollTriggers (pinning, stacking, scrubbing), inline micro-images, and massive section spacing.

xzedm/clipplic-landing

Fast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)

相关技能