vercel-composition-patterns

bởi sentry

Các mẫu composition React có khả năng mở rộng. Sử dụng khi tái cấu trúc các component với

npx skills add https://github.com/getsentry/webvitals.com --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 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

Thêm skills từ sentry

generate-frontend-forms
sentry
Hướng dẫn tạo biểu mẫu bằng hệ thống biểu mẫu mới của Sentry. Sử dụng khi triển khai biểu mẫu, trường biểu mẫu, xác thực hoặc chức năng tự động lưu.
official
sentry-snapshots-cocoa
sentry
Thiết lập đầy đủ Sentry Snapshots cho các dự án Apple/Cocoa. Sử dụng khi được yêu cầu "thiết lập SnapshotPreviews", "thiết lập kiểm thử snapshot Apple", "tải lên snapshot Apple lên…
official
architecture-review
sentry
Đánh giá sức khỏe mã nguồn ở cấp độ nhân viên. Phát hiện các module nguyên khối, lỗi âm thầm, khoảng trống an toàn kiểu dữ liệu, lỗ hổng độ phủ kiểm thử và các vấn đề về thân thiện với LLM.
official
linear-type-labeler
sentry
Phân loại các vấn đề Linear và áp dụng nhãn Loại từ hệ thống phân loại nhãn của không gian làm việc Sentry dựa trên nội dung tiêu đề và mô tả của từng vấn đề.
official
sentry-flutter-sdk
sentry
Thiết lập đầy đủ Sentry SDK cho Flutter và Dart. Sử dụng khi được yêu cầu "thêm Sentry vào Flutter", "cài đặt sentry_flutter", "thiết lập Sentry trong Dart", hoặc cấu hình lỗi…
official
sentry-svelte-sdk
sentry
Thiết lập đầy đủ Sentry SDK cho Svelte và SvelteKit. Sử dụng khi được yêu cầu "thêm Sentry vào Svelte", "thêm Sentry vào SvelteKit", "cài đặt @sentry/sveltekit", hoặc cấu hình…
official
vercel-react-best-practices
sentry
Hướng dẫn tối ưu hiệu suất React và Next.js từ Vercel Engineering. Kỹ năng này nên được sử dụng khi viết, xem xét hoặc tái cấu trúc mã React/Next.js…
official
sentry-tanstack-start-sdk
sentry
Thiết lập đầy đủ Sentry SDK cho TanStack Start React. Sử dụng khi được yêu cầu "thêm Sentry vào TanStack Start", "cài đặt @sentry/tanstackstart-react", hoặc cấu hình lỗi…
official