Communitygithub.com

vercel-labs/vercel-组合模式

可扩展的 React 组合模式。适用于重构含有布尔型 props 泛滥的组件、构建灵活的组件库或设计可复用的 API。触发于涉及复合组件、渲染 props、状态上下文提供器或组件架构的任务。包含 React 19 API 变更。

vercel-组合模式 是什么?

该技能专注于 React 组合模式,旨在解决因布尔型 props 过多而导致的组件复杂度问题,帮助开发者构建更具可维护性和可扩展性的组件系统。它特别适用于重构现有代码、创建灵活组件库以及设计可复用 API。该技能覆盖了多个关键模式,包括复合组件(Compound Components)、渲染 props(Render Props)、上下文提供器(Context Providers)以及组件架构设计,并且已同步了 React 19 的 API 变更。通过该技能,AI 可以建议更合理的组件拆分与组合策略,例如将混杂的布尔类型 props 替换为更具语义化的子组件或属性对象,从而提升代码的可读性和可维护性。该技能主要针对使用 React 框架的项目,可与现代开发工具如 Cursor 或 Copilot 等深度集成,帮助开发者快速定位并优化组件设计中的反模式。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/vercel-labs/agent-skills/tree/main/skills/vercel-composition-patterns

在你喜欢的 AI 中提问

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

文档

vercel-组合模式 是做什么的?

可扩展的 React 组合模式。适用于重构含有布尔型 props 泛滥的组件、构建灵活的组件库或设计可复用的 API。触发于涉及复合组件、渲染 props、状态上下文提供器或组件架构的任务。包含 React 19 API 变更。

Individual skills in this repo

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

deploy-to-vercel

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".

vercel-cli-with-tokens

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g.

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with

vercel-labs/vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

vercel-labs/vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

vercel-labs/vercel-react-view-transitions

Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.

vercel-optimize

Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core Web Vitals, Bot Management, Fluid compute, or cost breakdown requests.

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use

web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to

writing-guidelines

Review docs/prose for Writing Guidelines compliance. Use when asked to

相关技能