Skip to content

search-before-you-build

Search Before You Build — The Repo Usually Has It Already

Section titled “Search Before You Build — The Repo Usually Has It Already”

Before writing a query, helper, or check, spend one search looking for it: grep the concept and the column/field (exact commands: docs/search-before-you-build.md § “How to apply”).

An existing solution encodes decisions you do not have — usually in its docstring; read it before deciding you need your own.

Corpus first, grep second. Before naming a capability greenfield, sweep the knowledge-retrieval corpus (mcp__knowledge-retrieval__doc_search) for prior art, then ground a hit with local grep (real path, on-disk version). Technique and reporting: the t1k-knowledge-retrieval skill. A greenfield / no prior art claim is not valid until the sweep has run and its verdict is recorded (reuse-search: not-found-after-corpus-and-grep + scope: <swept> | swept: <date> on the adjacent line); MCP unreachable after a reconnect → say so and mark the finding unverified, never greenfield.

Sweep while you are still choosing, not only when about to claim absence — run it as an INPUT to the option set, when weighing approaches or naming what to build. An option that duplicates shipped capability is not an option.

Narrow exception: the existing implementation is genuinely wrong or unfit — fix or extend it rather than adding a rival.

Close the loop on a hit. Found it? STOP and reuse it — never build a parallel version. Reused or genuinely new, record the outcome in the artifact that should have surfaced it (a docstring, a skill’s reference doc) in the SAME change, not a follow-up PR.

Miss in a game project. A reusable capability with no hit is contributed to the studio library and consumed as a package, not built in-game; the engine kit’s reuse rule and t1k-lib-contribute (contributeDestination) own the procedure.

Incidents and cross-references: docs/search-before-you-build.md.