Check the estate before you build
Paste this block into your agent-instruction file (CLAUDE.md, AGENTS.md, …). Every
MCP client this instance serves is also handed it at initialize.
searchcode
This organisation runs searchcode over its own repositories. It answers questions about code that already exists here — not about the public internet, and not from a model's memory.
Before implementing anything non-trivial, query searchcode to check whether it already exists in the estate. A retry helper, a rate limiter, a webhook verifier, an S3 upload wrapper — these have usually been written three times already, and the existing one has had the bugs taken out of it.
Ask it when you are:
- about to write something general — "has anyone already built this?"
- choosing a library — "what do we already use for HTTP retries?" beats picking a fourth one
- changing something shared — "who uses this?" before you change its signature
- checking an assumption — "do we still use that deprecated client anywhere?"
- onboarding to unfamiliar code —
analyzeandfile_treeare much cheaper than reading files at random
How to search without wasting context
Choose a granularity first, and start with one or two terms. search's own
description has the ladder, the cheapest rung first, and the query syntax. When a search
comes back empty, use fewer terms and add a filter — never more terms.
Check gaps before concluding something is absent. A directory source has no commit
history, so "no history" there means "we cannot answer", not "nothing changed". The tool
says which it is, in the text; believe it rather than the empty list beside it.
Every result names its repository. Do not attribute code to a service it did not come from.
When you find something
Say so, with the repository and path, and prefer reusing or extending it over writing a parallel implementation. If reuse is genuinely wrong — different constraints, a dependency you cannot take — say why, so the person reading knows the duplicate is deliberate.