Prompt Recipes & Examples

This page is your prompt cookbook.

It includes real-world prompt examples for common use cases in your AI builder — from generating components to debugging issues. Use them as-is, or tweak them to fit your project.

Each recipe follows best practices (CLEAR, structured or conversational formats) and is designed to be copy-paste ready.


UI Component: Form with Validation

Context: You are a frontend developer working on a React app.

Task: Create a user registration form with fields for name, email, and password. On submit, validate all fields and log the data to the console.

Guidelines: Use React and Tailwind CSS. Show inline error messages. Use controlled components with useState.

Constraints: Do not use any external form libraries. Only modify the RegisterForm.tsx file.

Backend: Secure Auth with Supabase

I need to implement a secure login system using Supabase.

Use email/password authentication

On success, store the JWT in localStorage

Show an error if the login fails

Include form validation and loading state

Use React and Supabase client SDK.

Debugging: Fix Undefined State

Here’s the issue: when the app loads, user.id is undefined even though the user is logged in.

Code snippet:
const user = useAuth();

Why might this be happening, and how can we fix it? Walk through possible causes and give a solution.

Styling: Make Component Mobile-Responsive

Make the TaskCard component mobile responsive.

Stack elements vertically on small screens

Use Tailwind’s sm / md / lg breakpoints

Keep padding and spacing consistent

Do not change functionality or remove any elements

Integration: Stripe Checkout Button

Add a “Buy Now” button that opens a Stripe Checkout session.

Use the Stripe JavaScript SDK

On click, call an API route to create the session

Redirect to the Stripe-hosted checkout page

Assume the product ID is already available in product.id

Use Next.js with API routes. Do not include server-side logic in the frontend component.

Refactor: Clean Up Logic Without Changing Behavior

Refactor the logic in handleFormSubmit for readability and maintainability.

Requirements:

No behavior should change

Use early returns instead of nested ifs

Add inline comments to explain each step

Only modify this function. Do not touch other parts of the file.

Generate Prompt from Feature Description

We just built a blog post editor with Markdown support, autosave, and tag suggestions.
Can you write a reusable prompt template someone else could use to build the same feature from scratch?

Meta Prompt Recipe

Here’s my current prompt:

“Build a login form using Supabase.”

Can you improve it? Make it more specific, add constraints, and suggest a better format.

Prompt for Checklist or Step-by-Step Output

List the steps required to:

Connect a Next.js app to Supabase

Add email/password login

Protect a route using auth middleware

Write it as a clear checklist I can follow.

Image-Based Prompt

This screenshot shows the layout we want.
Please create a responsive UI that matches this style and structure.

Use Tailwind CSS. Add placeholder text and buttons for now.

Final Tips

  • Always adjust the level of detail depending on task complexity
  • For repeat tasks, turn successful prompts into templates
  • Save useful prompts in your team’s docs or Knowledge Base
  • Combine prompt styles: start structured, then iterate conversationally

Up Next

Want to go even further? Check out our best practices for debugging, verifying output, and minimizing hallucinations in AI-generated code.

➡️ Back to: Advanced Techniques