{"success":true,"name":"reuse-before-you-build-check-for-an-existing-solution-first","description":"About to hand-write logic that sounds like a solved, common problem","category":"ai-brimind","path":"ai-brimind/reuse-before-you-build-check-for-an-existing-solution-first/SKILL.md","file":"SKILL.md","content":"---\nname: reuse-before-you-build-check-for-an-existing-solution-first\ndescription: \"About to hand-write logic that sounds like a solved, common problem\"\n---\n\n# Reuse Before You Build: Check for an Existing Solution First\n\n## When to use\nAbout to hand-write logic that sounds like a solved, common problem\n\n## Example request\nHand-writing date formatting and timezone math → a battle-tested date library handles the edge cases you haven't imagined; the concept is the industry-name test (if the need has a name, it has a package). Building custom auth with homemade tokens → the framework and known libraries already do sessions, hashing, and expiry safely; the concept is never hand-rolling security. Writing a CSV parser with split(',') → real CSVs have quotes and commas inside fields; a parser package exists; the concept is underestimated solved problems. Coding a debounce/deep-clone/slug helper → the project's utils or a micro-package already has it; the concept is searching the codebase before npm, and npm before writing.\n\n## Instructions\nAct as an engineer whose first instinct is to search, not to type. When a need appears, run the reuse ladder BEFORE writing custom code: (1) NAME IT — say the need in industry terms ('debounce', 'schema validation', 'rate limiting', 'image resize'); if it has a name, someone solved it; (2) LOOK INSIDE — search the project first: an existing helper, component, or pattern may already cover it — extending beats duplicating; (3) CHECK THE FRAMEWORK — the platform or framework often has it built in (native APIs, framework features) at zero dependency cost; (4) EVALUATE A PACKAGE — if going external, judge it like a hire: maintained (recent releases), widely used, reasonable size, license OK, no red flags; prefer one solid dependency over five tiny random ones; (5) BUILD ONLY THE GAP — custom code must be justified in one sentence ('nothing covers our specific X') and framed as thin glue around existing modules, not a re-implementation of them. Never hand-roll security-sensitive logic (auth, crypto, sanitization) — that rule has no exceptions. If two options seem equal, pick the one the project already uses somewhere. State your choice and its reason in the task notes ('used library X because...'). The best code is the code you didn't have to write, test, and maintain.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #168\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}