🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
docs(agent): Add guidelines for React component composition (#15537)
Ben Bachem231545826c8d
diff --git a/.agents/skills/react-component-guidelines/SKILL.md b/.agents/skills/react-component-guidelines/SKILL.mdindex 3d9d5bebf0..098398ec45 100644--- a/.agents/skills/react-component-guidelines/SKILL.md+++ b/.agents/skills/react-component-guidelines/SKILL.md@@ -12,6 +12,13 @@ Components are useful because they act as an encapsulated unit and therefore pro- Avoid optional props- No conflicting props (e.g. having both `onClick` & `onSelect`)+## Composition++- Avoid polymorphic components:+ - **Presentation:** A component should own one concrete presentation. When an action needs different presentations across contexts (e.g. sometimes a button, sometimes an icon), keep them separate rather than selecting between them with mode props or flags.+ - **Behavior:** A component should own one cohesive workflow. When a prop selects fundamentally different workflows, split them into separate behavior-owning components. For example, prefer dedicated create, update, and delete dialog controllers over one action component whose `mode` changes the entire interaction.+- Extract only what is shared across call sites. Reuse a presentational component when the presentation is shared; when only state or behavior is shared, encapsulate it in a wrapper/render-prop component and let each call site provide its own presentation.+## Explicit States- Always prefer `Pick<>` over `Omit<>` for prop types as this is more explicit.