Vercel Composition Patterns — Vercel工具
v0.1.0[AI辅助] React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing r...
详细分析 ▾
运行时依赖
版本
- Initial release of vercel-composition-patterns, providing React composition guidelines for scalable, maintainable component design. - Covers when and how to use compound components, lifting state, and composition to avoid boolean prop proliferation. - Organized into rule categories: Component Architecture, State Management, Implementation Patterns, and React 19 API updates. - Includes actionable rule references (e.g., avoid boolean props, decouple state management) and React 19-specific best practices. - Designed as a quick reference for developers refactoring components or building flexible React APIs.
安装命令 点击复制
技能文档
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.
当...时 到 Apply
Reference these guidelines when:
- Refactoring components 带有 many 布尔值 props
- Building reusable 组件 libraries
- Designing flexible 组件 APIs
- Reviewing 组件 architecture
- Working 带有 compound components 或 context providers
Rule Categories 由 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. 组件 Architecture (HIGH)
architecture-avoid-布尔值-props- Don't 添加 布尔值 props 到 customize
architecture-compound-components- Structure complex components 带有 shared
2. State Management (MEDIUM)
state-decouple-implementation- Provider 仅 place knows 如何
state-context-接口- Define generic 接口 带有 state, actions, meta
state-lift-state- 移动 state 进入 provider components 对于 sibling access
3. Implementation Patterns (MEDIUM)
patterns-explicit-variants- 创建 explicit variant components 代替 的
patterns-children-在...上-render-props- 使用 children 对于 composition 代替
4. React 19 APIs (MEDIUM)
⚠️ React 19+ only. Skip this section if using React 18 or earlier.
react19-否-forwardref- Don't 使用forwardRef; 使用使用()代替 的useContext()
如何 到 使用
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 的 为什么 matters
- 错误 code 示例 带有 explanation
- 正确 code 示例 带有 explanation
- Additional context 和 references
满 Compiled Document
For the complete guide with all rules expanded: AGENTS.md
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制