the prompt that ships a feature
the difference between a prompt that gives you a half-baked stub and one that gives you a working feature is mostly about what you put before the request. here's our template.
a thing we see all the time, especially with people new to this: they ask the model for a feature, and they get back a stub. some boilerplate. a vague plan. nothing they can ship. they get frustrated. they think the model is dumb.
the model is not dumb. the prompt is incomplete.
a prompt that ships a feature has four things in it, in this order: the context, the constraints, the contract, and the request. miss any one of them and you're going to get back something you can't use.
1. the context
what is this codebase? what does it do? what stack is it on? what are the conventions? if the model doesn't know this, it's going to default to the most generic possible solution — which is often nothing like what your codebase needs.
in cursor or claude code, this is mostly handled for you — they read the repo. but you still need to point them at the right files. don't make the model guess where things live.
2. the constraints
what should this not do? what libraries are off-limits? what patterns does the team hate? what do other features in this codebase look like, that this one should match?
this is the highest-leverage section in the prompt. one sentence like “don't add a new dependency” or “match the pattern in users.tsx” will save you an hour of cleanup.
3. the contract
what does “done” look like? what should the input be? what should the output be? what should happen if it fails? if you don't specify this, the model picks a reasonable answer, and “reasonable” might not be what you want.
the contract is not the implementation. you don't need to say how. you need to say what “done” means.
4. the request
the actual ask. by the time you get here, this can usually be one line. “ok, build it.” or “wire up the form.” or “add the route.”
if your prompts are 90% request and 10% everything else, flip the ratio. context-heavy prompts ship features. request-heavy prompts ship stubs.
the template
here's the template, as a single block you can copy:
# context
this codebase is a [next.js / rails / whatever] app that does [x].
the relevant files are: [...]
conventions: [...]
# constraints
- don't add new deps
- match the pattern in [file]
- preserve [thing] working
# contract
inputs: [...]
outputs: [...]
done when: [...]
# request
[the one-line ask]use this for one week. count how many fewer follow-up prompts you send. tell us what happened.