The usual prompt names a feature. “Add search.” The model then invents a box, a route, a ranking idea, an empty state, and a place to store history. Some of that may be what you wanted. Most of it is a product decision you did not make, written down as code so it feels finished.
Ask for a function instead. Name the inputs, the output, and the one error it may return. Say which existing function it should sit beside, and which files it must not touch. “Add a function that takes a query string and a list of titles and returns the matching titles in their original order. Do not add a route.”
You can still build the feature. You build it as a sequence of functions you have each accepted. The route is a separate change. The empty state is a separate change. When something is wrong, you know which decision it belonged to.
If the model returns a framework, a new folder, and a paragraph of suggested next steps, the prompt was still a feature. Cut it back and ask again. The constraint is the work.