1 Quick Fixer 2 One-Click Wonder ~8 min

Search First, Write Later: The Prompt That Saves You Hours

Why forge a hammer when there's one sitting in the garage?

The vibecoder habit of search first, write later: how to make your AI agent hunt for ready-made libraries and solutions before writing code — and save yourself hours, money, and headaches.

ECC skills in this lesson: search-first

What “search first, write later” actually means

You need to drive a nail. Option one: you walk into the garage, grab a hammer — it’s right there, tried and true, comfortable, your granddad swung it too. Option two: you forge your own hammer from a raw chunk of iron, because “hey, I made it myself, that’s more fun.”

Sounds like a joke. Now the twist: option two is exactly what the agent picks by default — until you tell it otherwise. Ask it to “build a form that validates email” and it’ll cheerfully cook up its own little chunk of validation code. Even though the world has long had ready-made tools, polished by thousands of people, that do the same thing — better, more reliably, and for free.

The “search first, write later” habit is simple. You make the agent take a look around first: is there already something ready-made? And only if there genuinely isn’t — then it gets to start forging.

A person forging a hammer out of iron, while a ready-made hammer sits on the shelf next to them
On the left — “I'll write it myself.” On the right — what already exists.

Why a ready-made solution beats hand-written code

You’re a vibecoder. You don’t write the code by hand — but you direct the one who does. And if you don’t steer the agent, it’ll fall back on habit and start reinventing everything from scratch. How does that hit you personally?

  • Slower. Building your own from scratch takes hours. Plugging in something ready-made takes minutes.
  • Pricier. The agent burns tokens (your money) inventing something that was already sitting on the shelf.
  • Buggier. Fresh hand-written code is almost always half-baked. Ready-made stuff has already been battle-tested by millions of users.
  • Scarier to fix. When your own code breaks, you untangle it from scratch. A popular library has docs and forums where someone solved your exact problem three years ago.

The difference between “the agent built me a site that fell apart in a week” and “the agent assembled my site out of solid building blocks” often comes down to a single habit: search first, write later.

Where an AI agent looks for ready-made code: four shelves

When you tell the agent to “search first,” it doesn’t rush off to code. It walks past four “ready-made shelves” — roughly in this order, from closest to farthest.

Sodi — our mascot and resident vibecoding companion — is a walking demo of the “search first” principle. In the sketch further down, instead of rushing straight to “write code,” Sodi grabs a basket and methodically works through all four shelves — “my project,” libraries, tools, the internet — and only then heads for the desk. That’s exactly how it should go: search first, code later.

1. Your own project

Start with the nearest thing. What if it’s already written somewhere in your own project? A classic case: you ask for a “submit button,” and a button just like it is already living in a neighboring file. The agent finds it and reuses it — instead of churning out a second copy of the exact same thing.

2. Ready-made libraries and packages

Next — the big wide world. There are massive warehouses of other people’s code: libraries you can install with one command. Need data validation, sending emails, a nice little calendar — chances are someone already built it and put it out there.

3. Tools, extensions, and MCP

Sometimes the thing you need isn’t a library but a whole ready-made tool — like a pluggable MCP or skill. In that case the agent has nothing to code at all — it just grabs the ready-made thing and uses it.

4. Open-source code and examples online

And only if nothing else pans out does the agent check GitHub for a similar template or example. That way, at the very least, it isn’t starting from a blank page — it’s building on someone else’s experience.

When to grab ready-made, and when to write your own

Finding something ready-made is only half the battle. Next you have to figure out: is it actually worth using? Here’s how the agent (and you alongside it) makes the call.

Grab the ready-made one if it's...
  • Popular — thousands of people use it, so the bugs got found before you did.
  • Alive — updated recently, not abandoned five years ago.
  • Well-documented — there are docs, examples, and answers on forums.
  • A precise fit for your task — it does exactly what you need, nothing extra.
Write your own if...
  • Nothing suitable genuinely turned up (and you let the agent search properly).
  • The task is truly one of a kind — there's no ready-made thing for your specific case.
  • The ready-made option is huge and heavy for one tiny function — it's easier to write five lines.
  • What you found is abandoned and buggy — your own code beats someone else's landmine.

Example: a signup form with email validation

You tell the agent: “build a newsletter signup form — and make it check that the email is real.”

Without the right prompt: the agent cheerfully cooks up its own email check. It writes some clever formula that looks like it works but actually lets broken addresses through and blocks valid ones. A week later you find out half your people can’t sign up — and off you go to the agent to fix the thing it broke in the first place.

Now here’s how a vibecoder who gets it does it. They add one instruction to the request — “search first”:

Prompt — copy it and give it a try

I need a newsletter signup form with email validation.

Before you write any code, do this:

  1. Check whether suitable code already exists in my project — maybe a similar form or validation is already there.
  2. Look for popular, ready-made libraries for email validation and for forms. Pick the ones people actually use and that were updated recently.
  3. Show me 2-3 options as a short list: what you found, why each is good, which one you’d choose, and why.
  4. Only after that, plug in the chosen one. Write your own code only where nothing ready-made truly exists.
Four shelves of ready-made solutions, with the agent walking past them before sitting down to write code
First do a lap past the shelves — only then sit down to code.

Common beginner mistakes when searching for solutions

Meme: the agent proudly shows off a hand-written chunk of code, while a ready-made library sits sad next to it
When you could've grabbed the ready-made one, but went with “I'll do it myself.”
  • You ask “write X” instead of “find a ready-made X.” Without the word “find,” the agent writes from scratch by default. Add the instruction to search — every single time.
  • You grab the first thing you see. Found a library? Check whether it’s alive and whether people actually use it. Abandoned code will come back to bite you at exactly the moment you have no time for it.
  • You drag in a behemoth for a trifle. You don’t need a giant library for one button. Match the size to the task.
  • You don’t ask what the agent picked. Ask it to show the options as a list — and you’ll see what your project stands on, with no nasty surprises.
  • You reinvent what’s already in your own project. The most common and most painful case — duplicating something that’s sitting quietly in a neighboring file.

TL;DR - если коротко

  • Don't let the agent code from scratch — make it look for something ready-made first: in your project, in libraries, in tools. That's what search first means.
  • Ready-made is almost always more reliable than hand-written: thousands of people have road-tested it, so it doesn't fall apart out of nowhere.
  • The number-one mistake is saying “write me X” instead of “check whether a ready-made X already exists.”
  • A good library = popular, alive, well-documented. Abandoned code with three stars is a landmine, not a friend.
  • Pick the ready-made tool that fits the job: hauling a truck to deliver one carton of milk is overkill too.
  • Memorize the line: “first look for ready-made solutions, compare them, and only then write your own code.”

Search Wiki

Press Esc to close

Enter a search term to query all course pages and lessons.