index
Welcome to the New Era of Building
Forget wrestling with boilerplate and manual setup. Lovable is a new kind of IDE. You describe what you want, and it instantly scaffolds production-ready apps—UI, backend, auth, and integrations—with no local setup required. You keep full control of your code with two-way GitHub sync.
The result? You can build in hours, not weeks. Technical teams accelerate, and non-technical creators can bring their ideas to life. It's the best of both worlds: AI scaffolds the heavy lifting so you can focus on refining and perfecting the details.
How This Playbook Works
This isn't just a guide. It's a field manual for turning fuzzy ideas into shipped features. We've distilled the art of AI prompting into a practical framework with clear steps and repeatable patterns.
Each section gives you:
- The "why" behind the "what": Understand the principles, not just the commands.
- Copy-paste prompts: Use our proven templates to get immediate results.
- Real-world code examples: See how it works in practice.
- Tables and checklists: Quick-reference guides to keep you moving fast.
The New Starter Prompt
Ready to build? Let's go. Use this prompt to get a feel for how Lovable works.
You are a senior AI coding assistant working in Lovable.
Goal
: Scaffold a minimal landing page with a hero, features grid, CTA, and footer.
Constraints
: Use Tailwind + shadcn/ui. Ensure it's mobile-first and uses WCAG AA-compliant colors. Use simple, real copy—no lorem ipsum.
Deliverables
: A single React page, an extracted, reusable `
<FeatureCard>
` component, and a quick README in the file header.
Don't
: Touch any other files.
The Art of Prompting
The success of your AI outputs depends entirely on how well you write your prompts. With the right mix of clear instructions and context, you can turn a general-purpose AI into a specialized helper—whether you need a marketing whiz, data analyst, or coding buddy. Prompt engineering is a craft that combines creative writing, UI design, and technical specs, not just random chatting with AI.
Before you craft a single word, master these foundational principles. They’ll guide you no matter which model or use-case you tackle.
Dimension | How to approach |
Clarity & scope | Start with the why. Then outline the what and who to set the context. |
PTCF / RTF framing | Cover persona, task, context, and format; or role, task, and format for quick tasks. |
Guided thinking (CoT) | Ask for a “think step-by-step” approach on reasoning tasks. |
Reason + Act | Integrate reasoning with specific actions and connected tools. |
Few-shot examples | Show standard outputs and expected outcomes. |
Version everything | Prompts are UI—treat them like code. |
Export to Sheets
Follow these key steps to systematically optimize your prompts:
- Start with a minimal viable prompt: Create a basic version that captures your core requirements.
- Test thoroughly: Validate it against diverse, real-world scenarios and different LLMs.
- Iterate through variants: Compare different approaches to find what works best.
- Document and track changes: Maintain a clear version history with detailed notes.
Beyond optimization, protect your prompts against these critical vulnerabilities:
- Prevent hallucinations: Anchor responses to authoritative sources and set explicit context limits.
- Block injection attacks: Implement strong boundaries and stress-test your security measures.
- Ensure fairness: Maintain neutrality and use content filtering for sensitive applications.
- Protect privacy: Handle user data responsibly and clearly disclose when AI is involved.
- Enable quick recovery: Set up monitoring and rollback capabilities for rapid incident response.
Anatomy of a Prompt
Think of prompts as modular building blocks. Each component serves a specific purpose in the conversation between the system and the user.
- The system message acts as your application's core DNA, defining its personality, boundaries, and capabilities.
- The user message contains the specific request and any contextual information.
Keeping these separate is crucial for maintaining prompt integrity.
Let's examine a typical prompt structure. While AI responses can vary, a well-crafted initial prompt significantly shapes the quality of the output:
system
;
You are {{ROLE}}. Respond in {{STYLE}}. Follow RACE.
/system;
user
;
###
Task
{{TASK}}
###
Context
{{CONTEXT}}
###
Output Format
Return JSON: {"answer": string, "steps": string[]}
/user;
Frameworks, Patterns & Controls
After mastering the basics, you can fine-tune your prompts using specific parameters to enhance reliability or creativity. While many parameters are available, focusing on temperature and max_tokens is usually sufficient for most applications.
Key LLM parameters in Lovable (via OpenAI):
Parameter | Default | Usage guide |
Temperature | 0.7 | Use lower values (< 0.3) for factual responses; higher (> 0.9) for creative tasks. |
Tokens | 1K | Adjust to optimize response length and costs. |
The C.L.E.A.R. Framework
Building with AI is all about communication. The C.L.E.A.R. framework gives you a repeatable process to get the right output every single time.
Principle | What it means | Example |
Concise | Remove fluff; say exactly what to build. | “Create a /pricing page with 3 tiers and a FAQ accordion.” |
Logical | Order your steps; think like a checklist. | “Plan first → scaffold → wire data → test roles.” |
Explicit | State the must-haves and must-nots clearly. | “Use shadcn Card ; do not edit AuthContext.tsx .” |
Adaptive | Iterate based on the results you get. | “Summarize what changed; propose 2 better variants.” |
Reflective | Capture learnings for reuse. | “Document decisions at the file top as comments.” |
Prompt Structure Template
Think of a prompt as a contract with the AI. This structure is your secret weapon for success.
- Role: Define the AI's persona (
You are a senior AI dev...
) - Context: Provide the product vision, users, and design system.
- Task: Specify one single, concrete outcome.
- Guidelines: List style, libraries, accessibility, and performance rules.
- Constraints: List files to avoid touching, limits, and security rules.
- Acceptance: What proves the task is complete and working?
Structure, Context & the Knowledge File
AI can't read your mind. The more context you provide, the better the output.
- Recommended prompt layout:
Context
→Task
→Guidelines
→Constraints
- Knowledge File: A single source of truth for your project. Lovable can use it for better, more consistent results.
Section | What to include |
Vision & Users | One-liner value prop, primary personas. |
IA & Routing | Key pages, URL structure. |
Design System | Colors, type scale, spacing (8pt), shadcn variants. |
UI Patterns | Modals, toasts, forms, empty states. |
Code Standards | Lint rules, folder layout, naming. |
Security | Secrets policy, RLS posture, logging. |
Integrations | Supabase schema, Stripe usage, email provider. |
Chat Mode vs Default Mode
Mode | Use it for | Credit Risk |
Chat Mode | Plan, analyze, debug without writing code. | Low |
Default | Make code changes now. | Normal |
Build Like LEGOs: Component-Driven Development
Don't build pages. Build components. Request small, reusable blocks—cards, badges, toasts—then compose them into pages. This is the fastest way to get to a production-ready app.
Component-First Prompt
Create a reusable
<FeatureCard title description icon />
using shadcn Card.
Constraints
: Use a responsive grid, visible focus ring, and ensure dark mode readiness.
Provide a usage example in a /components/examples file.
Design System Checklist
You can use the AI to generate or refine your design system components. A component like FeatureCard.tsx
should be fully reusable, flexible, and consistent with your design language.
Compose in Bricks
Build one flow or feature at a time, test it, and refine it. Always reuse your global components and avoid one-off styles.
Advanced AI Techniques
Go from a basic prompt to a strategic collaborator.
Multi-Step Problem Solving
Break down complex tasks into smaller, manageable steps.
Goal
: Add a /pricing page.
Plan 5 steps max with files to touch, then wait for my OK.
Constraints
: shadcn, mobile-first, copy in plain English (no lorem), do not modify auth or Stripe.
Context Management
Keep the AI focused.
- Opener: "Investigate and outline options—no code edits yet."
- Closer: "Confirm only the files listed below were changed and summarize diffs."
Error Handling & Edge Cases
When things break, don't just ask for a fix. Ask for an investigation.
Use the console error below to locate the root cause. Propose 2 safe fixes and the minimal diff.
[Paste error stack]
Integrating External Services
Lovable knows common APIs and models. You describe the outcome, and it wires the code.
- API Fundamentals: Lovable handles boilerplate like logging and error handling for you.
- GitHub Integration: Use the two-way sync to manage your codebase. Lovable is a tool in your CI/CD pipeline, not a replacement for it.
- Supabase (Auth, DB, RLS): Use prompts to define your schema and Row Level Security policies for secure, scalable backends.
- Stripe (Payments): Describe the user's journey, and Lovable will scaffold the server-side logic and client-side components to handle payments securely.
- Other Services: Lovable integrates with Clerk, various LLMs (OpenAI, Claude, Groq), and specialized tools like ElevenLabs, n8n, and Make.
Performance & Optimization
Get speed and reliability baked into your code from the start.
- Frontend Performance: Use
React.memo
,useMemo
, anduseCallback
to prevent unnecessary re-renders. - Refactoring Without Behavior Changes: Keep your codebase clean without introducing new bugs.
Refactor
<PricingTable/>
to smaller functions. Keep identical UI and outputs. List changes first, then apply them in one commit. Add tests if trivial.
Debugging & Troubleshooting
When the code breaks, don't panic. Use the AI as your expert debugging co-pilot.
- Common Issues (Quick Map): A guide to the first steps for common problems.
- Errors = Learning: When you fix a bug, capture the
why
and thehow
as a reusable prompt for the future. - Provide Evidence: Always include stack traces, screenshots, and clear reproduction steps.
- Ask "Why?": Don't just patch the problem; identify and remove the root cause.
- Codebase Audit Prompt: Use the AI to find potential issues before they become problems.
Perform a codebase audit for architecture, modularity, naming, and DX. List top 10 risks with file references and suggest incremental fixes. No code changes yet.
Launching & Scaling Your App
Ready to go live? This is where your AI-built app starts its journey.
- Finishing Mindset: Ship small, iterate fast.
- Simple Deployment: Deploy directly from Lovable or connect to services like Netlify or Vercel.
- Self-Hosting & Control: Use the two-way GitHub sync for full portability and control.
- Measuring Success (KPIs): Track traffic, conversions, and retention.
- Organic Marketing: Talk to users, not just code. The best marketing is a product people love.
- Long-Term Sustainability: Keep improving and be willing to restart when a new, better path emerges.
Workflow Add-ons & Appendix
Supercharge your workflow with these tools and reusable prompts.
Why Add-ons?
They reduce friction and amplify your AI's power. Examples include Lovify by Talisha
and Lovable.dev Add-ons by Rezaul
, which offer features like voice debugging, context-aware prompts, and real-time code analysis.
Appendix: Prompt Library, Checklists & FAQ Schema
A1. Copy-Paste Prompt Library
- Start a Feature
Role
: Senior AI dev in Lovable.
Task
: Add /pricing page with 3 tiers and FAQ.
Guidelines
: Tailwind + shadcn; mobile-first; AA contrast; no lorem.
Constraints
: Only touch /app/pricing/* and /components/pricing/*.
Acceptance
: Renders on mobile/desktop; snapshot attached.
- Investigate First
Investigate the failing signup flow. Summarize root cause candidates, affected files, and the safest fix. No code yet.
- Refactor No Behavior Change
Refactor utils/formatPrice.ts into smaller pure functions. Keep identical outputs. Add 3 unit tests.
- RLS Authoring
Write RLS so users can read/update only their profile row. Admin can read all. Show SQL and explain.
A2. Do / Don’t Table
Do | Don’t |
Plan in Chat Mode | Ask for a huge feature in one go |
Work in bricks | Edit unrelated files |
Be explicit | Use lorem placeholders |
Pin versions | Ignore diffs and rollbacks |
Provide logs/screens | Say “nothing works” |
A3. Pre-Publish Checklist
A4. JSON-LD FAQ (SEO)
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is Lovable?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Lovable is an AI-powered IDE that scaffolds full-stack apps from natural language prompts with two-way GitHub sync."
}
},
{
"@type": "Question",
"name": "How do I write better prompts?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Use the C.L.E.A.R. framework—Concise, Logical, Explicit, Adaptive, Reflective—and work in small, testable steps."
}
},
{
"@type": "Question",
"name": "Can I use Supabase and Stripe?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes. Lovable integrates natively with Supabase and Stripe. Keep secrets server-side and use RLS for least-privilege access."
}
}
]
}
Last word: Keep prompts short, specific, and scoped. Ship small, learn fast, and save what works into your own prompt library.