skills/component-reuse-first/SKILL.md
Search existing components before creating new ones. When a new component is unavoidable, design it for future reuse with proper props, composition, and placement in shared directories. Use when building UI, creating React/Vue/Svelte/Angular/SwiftUI components, adding buttons/forms/cards/modals/tables, scaffolding pages, or any time the user says "create a component", "add a component", "build a UI", or mentions component-like work.
npx skillsauth add ronnycoding/.claude component-reuse-firstInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before creating any UI component, exhaustively check whether an existing component (or close variant) already covers the need. Only create a new component when reuse is genuinely impossible — and when you do, design it to be reused next time.
Run all of these in parallel before writing any new component:
**/components/**/*.{tsx,jsx,ts,js,vue,svelte}**/ui/**/*.{tsx,jsx,vue,svelte}**/shared/**/*.{tsx,jsx,vue,svelte}**/design-system/**/*, **/lib/components/**/*Modal|Dialog|Popup|Overlay|Sheet|DrawerButton|Btn|IconButton|CTACard|Panel|Tile|BoxInput|TextField|TextInput|FormFieldList|Table|DataGrid|ItemsAfter search:
State the decision explicitly to the user before coding: e.g. "Found Button at src/ui/Button.tsx with variant prop — adding ghost variant" or "No matching modal — creating new Modal at src/ui/Modal.tsx."
When a new component is necessary, build it for the next caller, not just this one:
Placement
components/ui/, src/ui/, or the project's design-system pathfeatures/<feature>/components/API design
className and forward refs (React: forwardRef + cn(className) pattern)...props / v-bind="$attrs")cva, tv, prop unions) instead of duplicating componentsvariant, size, tone, intent) — not visual ones (bigBlueButton)Composition over configuration
Card.Header, Card.Body) over giant prop bags*Content propsStyling
Type safety (TS projects)
ButtonHTMLAttributes<HTMLButtonElement>as="link" | "button")Accessibility
index.ts barrel (if the project uses one)Button2, NewButton, CustomButton next to existing Buttonfunction Button( and a Button already exists in the repo → stop, reuse.User: "Add a confirmation modal for the delete action."
You: Grep for Modal|Dialog|Confirm. Found ConfirmDialog at src/ui/ConfirmDialog.tsx. → Reuse it; pass title, onConfirm, destructive props.
User: "Create a pricing card component."
You: Grep for Card. Found Card primitive in src/ui/Card.tsx. → Compose PricingCard from Card + Card.Header + Card.Body; place in features/pricing/components/. Don't reinvent the card frame.
User: "I need a button with a loading spinner."
You: Grep for Button. Found one without loading prop. → Add loading?: boolean prop to existing Button; do not create LoadingButton.
This skill should activate whenever the conversation involves:
development
Expert guide for WebGL API development including 3D graphics, shaders (GLSL), rendering pipeline, textures, buffers, performance optimization, and canvas rendering. Use when working with WebGL, 3D graphics, canvas rendering, shaders, GPU programming, or when user mentions WebGL, OpenGL ES, GLSL, vertex shaders, fragment shaders, texture mapping, or 3D web graphics.
tools
Guide for using the Sentry CLI to interact with Sentry from the command line. Use when the user asks about viewing issues, events, projects, organizations, making API calls, or authenticating with Sentry via CLI.
development
Guide for performing secure web searches with privacy protection, source verification, and information validation. Use when the user wants to search the web securely, verify sources, fact-check information, or mentions secure search, privacy, source validation, or web research.
development
Drive the OpenWA WhatsApp HTTP API from the terminal with curl. Use when sending WhatsApp messages (text/image/video/audio/document/location/contact/bulk), managing sessions and QR login, listing contacts/groups/chats, registering webhooks, or managing scoped API keys against an OpenWA server. Triggers on "OpenWA", "penwa", "send WhatsApp via API", "WhatsApp session", or mentions of base URL http://0.0.0.0:2785.