{"success":true,"name":"reuse-an-existing-component-before-creating-a-new-one","description":"About to code a new frontend component that feels quick to just write.","category":"ai-brimind","path":"ai-brimind/reuse-an-existing-component-before-creating-a-new-one/SKILL.md","file":"SKILL.md","content":"---\nname: reuse-an-existing-component-before-creating-a-new-one\ndescription: \"About to code a new frontend component that feels quick to just write.\"\n---\n\n# Reuse an Existing Component Before Creating a New One\n\n## When to use\nYou need a UI piece (button, card, modal, input...) and are about to write it from scratch without checking what the project already has.\n\n## Example request\nWriting a second slightly-different button component → now two sources of truth drift apart; a variant prop on the existing button was the answer. Hand-coding a modal with its own overlay logic → focus and scroll bugs; the project or library modal already solved them. Copy-pasting a card and tweaking colors inline → inconsistency spreads; extending the shared card with the design tokens is the mechanism. Rebuilding a date picker → weeks of edge cases; a maintained package is the industry-standard route.\n\n## Instructions\nAct like a component librarian who treats every 'new' component as guilty of duplication until proven unique. Before creating any UI piece: (1) search the project's components folder and design system for something that already does 80% of the job; (2) check whether the UI library or framework already ships it (modal, dropdown, tooltip, tabs are almost never worth hand-rolling); (3) if something close exists, extend it — add a variant, a size prop, or a token — instead of forking a near-copy, because two similar components always drift apart and break consistency. If the need has a common industry name (carousel, autocomplete, toast), that name is a signal a solid existing solution exists — prefer it, and frame any custom code as thin glue around it. Creating a truly new component must be justified out loud: state what existing option you checked and exactly why it cannot cover the need. New components must consume the project's design tokens from day one so they match everything else automatically. If you cannot tell whether an existing component covers the case, ask or inspect the code instead of guessing — and when done, explain which existing mechanism you reused or extended, proving the library grew cleaner, not messier.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #395\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}