Open a file your agent wrote and you will see the same shapes repeat: a piece that routes requests, a piece that talks to the database, a piece that holds the rules. These are not the agent's invention. They are named, proven solutions that engineers reach for over and over. Learn the names and two things happen: you recognize what you are looking at, and you can ask your agent for the right shape by name.
5.6.1A pattern is a proven shape
A design pattern is a reusable solution to a problem that comes up again and again, packaged under a name everyone knows. Someone hit the problem years ago, found a clean answer, and the answer stuck.
You do not memorize patterns or learn to build them from scratch. Your agent already knows dozens. Your job is lighter: recognize a few by sight, so the code stops looking like an undifferentiated wall.
5.6.2The handful you'll actually meet
A handful of names cover most of what you will see in a typical app:
- MVC splits a feature into three parts: the data (model), the screen (view), and the glue between them (controller).
- Middleware is a checkpoint every request passes through, for things like login checks or logging.
- A factory is one function whose job is to build and hand back an object, so the rest of the code never builds it by hand.
- A repository is the one place that talks to the database, so nothing else has to know how data is stored.
- A service layer holds the business rules, sitting between the request and the repository.
- An adapter is a thin wrapper around an outside service. Swap one payment or email provider for another and the rest of the app never notices, which keeps coupling loose and the code easy to change.
A repository, for instance, is often just this shape:
Everything else in the app asks userRepository for a user and never touches the database directly.
5.6.3Patterns are a shared language
The real value of the names is precision. "Put the database calls behind a repository" is one clear instruction; describing that same shape in your own words takes a paragraph and still leaves room to be misread.
The names are a language you and your agent already share. Using them, you say exactly what you mean in three words, and the agent builds exactly the shape you pictured.
5.6.4No pattern is also an answer
Knowing the names creates a new risk: asking for them everywhere. A pattern earns its place when there are two real callers, or a real reason to swap the thing behind it later. When neither is true, a plain function is the better answer.
A factory that builds exactly one object, or an interface with a single implementation, is a pattern applied for its own sake. That is an anti-pattern: a shape that looks professional and makes the code harder to change. Ask for the pattern when you can name what it buys you, not because it sounds senior.
5.6.5Ask the agent to use the right one
You can point at code and ask which patterns are in it, or ask the agent to reshape a tangled feature into the right one. Either way you lead with the name.
Do this now: paste the prompt over one feature your agent built, and have it name the patterns already there and flag any place a more standard shape would fit.