vercel-composition-patterns

作者: supabase

可扩展的React组合模式。用于重构组件时

npx skills add https://github.com/supabase/supabase --skill vercel-composition-patterns

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

PriorityCategoryImpactPrefix
1Component ArchitectureHIGHarchitecture-
2State ManagementMEDIUMstate-
3Implementation PatternsMEDIUMpatterns-
4React 19 APIsMEDIUMreact19-

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 these patterns if you're on 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

来自 supabase 的更多技能

studio-e2e-tests
supabase
编写并运行Supabase Studio的Playwright端到端测试。在收到相关请求时使用。
official
vitest
supabase
由 Vite 驱动的快速单元测试框架,兼容 Jest API。在编写测试、模拟、配置覆盖率或处理测试时使用。
official
skill-creator
supabase
创建模块化技能的全面指南,用于扩展Claude的能力,涵盖专业知识和工作流程。技能包含必需的SKILL.md文件(含YAML前置元数据和Markdown指令),以及按用途组织、渐进加载以节省上下文的可选捆绑资源(脚本、参考资料、素材)。围绕具体使用案例设计技能;为确定性任务识别可复用脚本,为领域知识准备参考文件,为...提供素材。
official
supabase
supabase
在执行任何涉及Supabase的任务时使用。触发条件:Supabase产品(数据库、认证、边缘函数、实时功能、存储、向量、定时任务、队列);客户端…
official
supabase-server
supabase
在编写使用Supabase的服务器端代码时使用——包括Edge Functions、Hono应用、Webhook处理器或任何需要Supabase认证和客户端创建的后端。
official
clickhouse-logs-queries
supabase
Write, review, and migrate Supabase logs queries against the ClickHouse-backed `logs` table (the `logs.all.otel` analytics endpoint). Use this whenever a task…
official
dev-toolbar-review
supabase
在审查涉及 packages/dev-tools/、packages/common/posthog-client.ts 的 PR 时使用
official
e2e-studio-tests
supabase
在Studio应用中运行端到端测试。当被要求运行端到端测试、运行Studio测试、Playwright测试或测试功能时使用。
official