ktaesthetix

Vercel Composition Patterns

開發程式設計v1.0.0
作者:ktaesthetix更新於 2026-05-11vercel-composition-patterns@clawhub_ktaesthetix/vercel-composition-patterns
程式碼生成前端開發

據 AlphaMoat 統計,截至 2026-09,Vercel Composition Patterns 累計下載 4,964 次、獲 4 個星標,在全部 5,078 個 AI 技能中排名第 1,856 位,在「開發程式設計」分類(577 個)中排名第 240 位。

累計安裝
466
累計下載
4964
星標
4
全站排名
#1,856
全站前 37% · 「開發程式設計」前 42%
平台累計安裝累計下載星標評論
ClawHub ↗15345794-
SkillHub ↗46649643—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

透過複合元件與共享上下文減少布林屬性堆積,將狀態實現封裝在 Provider 後,並採用顯式變體和基於子元件的組合方式。指南還標註了特定 React 版本的 API 規則,僅應在其宣告支援的版本中應用。 套用 React 19 特有的 ref、context 或 use() 建議前,先核對專案版本。

資料釋出於 2026-10-27

可以用來做什麼

  • 審閱元件介面並重構布林屬性過多的元件

什麼時候用

  • 設計元件庫或審閱 React 組合架構時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

審閱這個元件,提出適合其 React 版本的複合元件與顯式變體方案。

月度資料趨勢

累計下載4964
3083409351032026-03 · 累計下載 32222026-05 · 累計下載 38532026-06 · 累計下載 40432026-07 · 累計下載 43392026-08 · 累計下載 44882026-09 · 累計下載 496426-0326-09
星標4
3442026-03 · 星標 32026-05 · 星標 32026-06 · 星標 32026-07 · 星標 32026-08 · 星標 42026-09 · 星標 426-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-094964—4
2026-084488+3.4%4
2026-074339+7.3%3
2026-064043+4.9%3
2026-053853—3
2026-033222—3

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

2.8 KB · ClawHub v1.0.0
---
name: vercel-composition-patterns
description:
  React composition patterns that scale. Use when refactoring components with
  boolean prop proliferation, building flexible component libraries, or
  designing reusable APIs. Triggers on tasks involving compound components,
  render props, context providers, or component architecture. Includes React 19
  API changes.
license: MIT
metadata:
展開全部(共 90 行)
  author: vercel
  version: '1.0.0'
---

# React Composition Patterns

Composition patterns for building flexible, maintainable React components. Avoid
boolean prop proliferation by using compound components, lifting state, and
composing internals. These patterns make codebases easier for both humans and AI
agents to work with as they scale.

## When to Apply

Reference these guidelines when:

- Refactoring components with many boolean props
- Building reusable component libraries
- Designing flexible component APIs
- Reviewing component architecture
- Working with compound components or context providers

## Rule Categories by Priority

| Priority | Category                | Impact | Prefix          |
| -------- | ----------------------- | ------ | --------------- |
| 1        | Component Architecture  | HIGH   | `architecture-` |
| 2        | State Management        | MEDIUM | `state-`        |
| 3        | Implementation Patterns | MEDIUM | `patterns-`     |
| 4        | React 19 APIs           | MEDIUM | `react19-`      |

## Quick Reference

### 1. Component Architecture (HIGH)

- `architecture-avoid-boolean-props` - Don't add boolean props to customize
  behavior; use composition
- `architecture-compound-components` - Structure complex components with shared
  context

### 2. State Management (MEDIUM)

- `state-decouple-implementation` - Provider is the only place that knows how
  state is managed
- `state-context-interface` - Define generic interface with state, actions, meta
  for dependency injection
- `state-lift-state` - Move state into provider components for sibling access

### 3. Implementation Patterns (MEDIUM)

- `patterns-explicit-variants` - Create explicit variant components instead of
  boolean modes
- `patterns-children-over-render-props` - Use children for composition instead
  of renderX props

### 4. React 19 APIs (MEDIUM)

> **⚠️ React 19+ only.** Skip this section if using React 18 or earlier.

- `react19-no-forwardref` - Don't use `forwardRef`; use `use()` instead of `useContext()`

## How to Use

Read individual rule files for detailed explanations and code examples:

```
rules/architecture-avoid-boolean-props.md
rules/state-context-interface.md
```

Each rule file contains:

- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references

## Full Compiled Document

For the complete guide with all rules expanded: `AGENTS.md`

「開發程式設計」分類下的熱門技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。