From b63a4255c7319cbbf034f959992dcced7623508a Mon Sep 17 00:00:00 2001 From: divyeshio <79130336+divyeshio@users.noreply.github.com> Date: Tue, 3 Mar 2026 22:34:12 +0530 Subject: [PATCH 1/4] feat: update package.json scripts and dependencies; add tools.json generation script - Added a new script "tools:build" to generate tools.json from tools-collection. - Updated "build" script to run tools:build before vite build. - Updated dependencies: "@ai-sdk/openai" to "^3.0.39" and "ai" to "^6.0.108". - Added new dependency "@tanstack/react-store" and "nitro". chore: create public/tools.json with tool definitions - Added a new tools.json file containing metadata for various tools. fix: update json-output component for ScrollArea styling - Adjusted className for ScrollArea in json-output component to fix styling issues. feat: implement script to generate tools.json from tools-collection - Created generate-tools-json.ts script to read tool definitions from JSON files and output a consolidated tools.json. chore: add skills-lock.json for skill management - Introduced skills-lock.json to manage skill dependencies. fix: improve theme switcher component for hydration issues - Added mounted state to prevent hydration mismatch in theme switcher. refactor: clean up tool-card component - Removed unused navigation logic and simplified tool-card component. fix: update tools.api.ts for fetching tools - Refactored fetchTools to use createIsomorphicFn for server and client fetching. fix: update routeTree for consistent route paths - Adjusted route paths to ensure trailing slashes are consistent. refactor: rename createRouter to getRouter in router.tsx - Renamed createRouter function to getRouter for clarity. fix: update root component for consistent navbar behavior - Removed pathname dependency from RootDocument to simplify rendering logic. fix: update tools index route for fetching tools - Refactored tools index route to use fetchToolsList and removed local tools loading logic. chore: update tsconfig for stricter type checking - Changed target to "esnext" and enabled strict mode for better type safety. chore: update vite.config for improved build configuration - Added tailwindcss plugin and adjusted prerender settings for better output. --- .../vercel-composition-patterns/AGENTS.md | 946 ++++++++++++++++++ .../vercel-composition-patterns/README.md | 60 ++ .../vercel-composition-patterns/SKILL.md | 89 ++ .../rules/architecture-avoid-boolean-props.md | 100 ++ .../rules/architecture-compound-components.md | 112 +++ .../patterns-children-over-render-props.md | 87 ++ .../rules/patterns-explicit-variants.md | 100 ++ .../rules/react19-no-forwardref.md | 42 + .../rules/state-context-interface.md | 191 ++++ .../rules/state-decouple-implementation.md | 113 +++ .../rules/state-lift-state.md | 125 +++ bun.lock | 157 ++- package.json | 10 +- public/tools.json | 112 +++ registry/commandly/json-output.tsx | 2 +- scripts/generate-tools-json.ts | 22 + skills-lock.json | 10 + src/components/theme-switcher.tsx | 6 +- src/components/tool-editor-ui/tool-card.tsx | 15 +- src/lib/api/tools.api.ts | 40 +- src/routeTree.gen.ts | 19 +- src/router.tsx | 4 +- src/routes/__root.tsx | 7 +- src/routes/index.tsx | 66 +- src/routes/tools/$toolName/index.tsx | 2 +- src/routes/tools/index.tsx | 82 +- tsconfig.json | 7 +- vite.config.ts | 28 +- 28 files changed, 2369 insertions(+), 185 deletions(-) create mode 100644 .agents/skills/vercel-composition-patterns/AGENTS.md create mode 100644 .agents/skills/vercel-composition-patterns/README.md create mode 100644 .agents/skills/vercel-composition-patterns/SKILL.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/architecture-compound-components.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/react19-no-forwardref.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/state-context-interface.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/state-decouple-implementation.md create mode 100644 .agents/skills/vercel-composition-patterns/rules/state-lift-state.md create mode 100644 public/tools.json create mode 100644 scripts/generate-tools-json.ts create mode 100644 skills-lock.json diff --git a/.agents/skills/vercel-composition-patterns/AGENTS.md b/.agents/skills/vercel-composition-patterns/AGENTS.md new file mode 100644 index 0000000..558bf9a --- /dev/null +++ b/.agents/skills/vercel-composition-patterns/AGENTS.md @@ -0,0 +1,946 @@ +# React Composition Patterns + +**Version 1.0.0** +Engineering +January 2026 + +> **Note:** +> This document is mainly for agents and LLMs to follow when maintaining, +> generating, or refactoring React codebases using composition. Humans +> may also find it useful, but guidance here is optimized for automation +> and consistency by AI-assisted workflows. + +--- + +## Abstract + +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. + +--- + +## Table of Contents + +1. [Component Architecture](#1-component-architecture) — **HIGH** + - 1.1 [Avoid Boolean Prop Proliferation](#11-avoid-boolean-prop-proliferation) + - 1.2 [Use Compound Components](#12-use-compound-components) +2. [State Management](#2-state-management) — **MEDIUM** + - 2.1 [Decouple State Management from UI](#21-decouple-state-management-from-ui) + - 2.2 [Define Generic Context Interfaces for Dependency Injection](#22-define-generic-context-interfaces-for-dependency-injection) + - 2.3 [Lift State into Provider Components](#23-lift-state-into-provider-components) +3. [Implementation Patterns](#3-implementation-patterns) — **MEDIUM** + - 3.1 [Create Explicit Component Variants](#31-create-explicit-component-variants) + - 3.2 [Prefer Composing Children Over Render Props](#32-prefer-composing-children-over-render-props) +4. [React 19 APIs](#4-react-19-apis) — **MEDIUM** + - 4.1 [React 19 API Changes](#41-react-19-api-changes) + +--- + +## 1. Component Architecture + +**Impact: HIGH** + +Fundamental patterns for structuring components to avoid prop +proliferation and enable flexible composition. + +### 1.1 Avoid Boolean Prop Proliferation + +**Impact: CRITICAL (prevents unmaintainable component variants)** + +Don't add boolean props like `isThread`, `isEditing`, `isDMThread` to customize + +component behavior. Each boolean doubles possible states and creates + +unmaintainable conditional logic. Use composition instead. + +**Incorrect: boolean props create exponential complexity** + +```tsx +function Composer({ + onSubmit, + isThread, + channelId, + isDMThread, + dmId, + isEditing, + isForwarding, +}: Props) { + return ( +
+
+ + {isDMThread ? ( + + ) : isThread ? ( + + ) : null} + {isEditing ? ( + + ) : isForwarding ? ( + + ) : ( + + )} +