extend-before-create

Guides search-first reuse decisions before creating new code in T3 Turbo monorepos.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/skills --skill extend-before-create-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extend-before-create
Source: https://github.com/leonardoacosta/skills/tree/main/leo-core/skills/extend-before-create
Command: npx skills add https://github.com/leonardoacosta/skills --skill extend-before-create-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents and developers often create duplicate services, components, types, tests, and scripts instead of reusing what already exists, causing code bloat, orphan caches, and maintenance drift in T3 Turbo monorepos. This Skill enforces a search-first protocol that walks domain-specific decision trees before any new file is created. ## Core Features & Use Cases - Domain Decision Trees: Provides search commands and extend-vs-create tables for services, Drizzle schemas, tRPC procedures, API endpoints, atomic UI components, types, tests, query keys, docs, and one-off scripts. - Reuse Ladder & YAGNI Gate: Climbs from existing code through stdlib, native platform features, and installed dependencies before permitting new code, and bans speculative generality phrases like "future-proofing". - Defer-to-User Protocol: Defines explicit triggers (auth scope changes, >5 caller rewrites, >50% duplication) requiring a two-option trade-off proposal instead of silent greenfield creation. - Portable Templates: Ships a canonical GitHub Actions CI workflow and pre-commit hooks that block doc rot, hand-written TS migrations, bare strict-mode in sourced libs, and deferred-checkbox dialects. - Use Case: Before adding a Stripe payout retry, grep existing services, find the PayoutService factory, and add a 20-line method instead of a new file. ## Quick Start Before I create a new tRPC procedure or component, walk the extend-before-create decision trees and tell me whether to extend an existing surface instead.

Frequently Asked Questions about extend-before-create

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide whether to extend existing code or create a new file?

Search the canonical locations first, then extend the lowest-friction match by adding a parameter, column, or variant. Compose only if extension would muddy the existing thing, and defer to the user with two named options when reuse genuinely does not fit.

When should I use a custom API route instead of tRPC?

Custom /api/* route handlers are reserved for webhooks, file streaming, OAuth callbacks, server-sent events, and infrastructure health checks. Anything outside that exception list should be a tRPC procedure or deferred to the user.

How do I avoid duplicating types in a tRPC and Drizzle stack?

Derive types instead of declaring them: use $inferSelect and $inferInsert for database rows, RouterInputs and RouterOutputs for tRPC payloads, and extend existing Zod schemas with .extend(), .merge(), or .pick(). Redeclaring these types in components is banned.

Where should one-off scripts live in a pnpm monorepo?

Scripts importing workspace packages like db or api belong in apps/scripts/src/, while pure infrastructure scripts with no workspace imports can live in the repo root scripts/ directory. Root scripts must never import workspace internals because pnpm does not hoist them.

When must the agent defer to the user instead of creating code?

Deferral is required when reuse does not fit and the change crosses a package boundary, extension needs more than five caller updates, auth scope differs, duplication exceeds 50 percent, or the problem is speculative. The deferral must present two named options with explicit trade-offs.