Skip to main content

The Prompt Template I Use for Every AI Coding Request

One bad afternoon with Claude led me to write a five-section template on a sticky note. I've used it for every AI request since. Here it is — take it.

I learned this lesson the hard way.

I asked Claude to build a checkout flow for my app. It came back with a full Stripe integration: customer portal, subscription management, invoice history, cancellation flow, proration logic. All of it. Technically correct. Completely not what I needed.

I needed one API route. One Stripe Checkout session. Redirect to /success on payment, redirect to /cancel on cancel. That's it.

What I said was "build a checkout flow." To me that was specific. To Claude, "checkout flow" is a category with dozens of valid implementations — and it built a thorough one.

I lost an afternoon untangling it. That afternoon is why I now have a template.

The template (copy it)

STACK: [framework, database, auth, styling]
EXISTING: [relevant files, tables, packages, integrations already in place]

BUILD: [one specific thing, described precisely]

CONSTRAINTS:
- Do not install new packages without asking
- Only modify the files I mention
- [any other hard rules for this request]

SUCCESS: [the exact test I'll run to confirm it worked]

Five sections. STACK gets filled in once per project and stays the same. The other four get filled in for every request.

What each section does

STACK tells the AI what it's working with. Without this, it makes assumptions — and AI assumptions usually look like generic examples from tutorials, not your actual setup. I put this at the top of every single prompt.

EXISTING prevents duplication and wrong turns. If Stripe is already installed, say so. If auth is set up, say where the session lives. If there's a utility function that does what you need, point to it. The AI can't read your mind, but it can absolutely use what you have.

BUILD is the hardest section and the most important. One thing. Described as if you were handing it to a contractor who's never seen your app and needs to know exactly what to produce. If you're struggling to write this section specifically, that's usually a sign you don't know what you want yet — and that's worth figuring out before you ask.

CONSTRAINTS is the section most people skip, and skipping it is how you get Claude rebuilding your auth system when you asked it to add a button. The two I put in almost every prompt: "don't install new packages without asking" and "only modify the files I mention." Add anything else that's project-specific.

SUCCESS gives the AI a target beyond "it compiles." "The route returns a Stripe Checkout URL I can open in a browser" is a test. "It works" is not.

What this looks like in practice

Here's what I should have sent that afternoon instead of "build a checkout flow":

STACK: Next.js 14, Supabase, Tailwind, Stripe (already installed)
EXISTING: STRIPE_SECRET_KEY in .env. No existing Stripe code.

BUILD: POST route at app/api/create-checkout/route.ts.
Creates a Stripe Checkout Session for price ID price_xxx.
On payment success, redirect to /success.
On cancel, redirect to /cancel.
Returns the checkout URL.

CONSTRAINTS:
- One file only: app/api/create-checkout/route.ts
- Do not create any other files
- Do not add webhook handling, subscription management, or customer portal

SUCCESS: The route returns a Stripe Checkout URL I can open in a browser and complete a test payment.

That's about 80 words. It would have saved me four hours.

The template is yours — take it. If you'd rather not fill it in by hand every time, Briefli generates it through a short interview. You describe what you're building, it asks the clarifying questions, it writes the prompt.

Try it free at briefli.io →

Get your free AI prompt

Enter your email and we’ll send you a custom prompt for your project.

Stop re-writing prompts. Let Briefli build them for you.

Two-minute interview → precise, first-attempt prompt. Free to start.

Try It Free →