Back to Playbook
PlaybookAI Tools

Prompting Tips

The quality of AI output depends on the quality of your input. Good prompts = good results. Think of it like giving instructions to a brilliant but literal-minded assistant.

The Core Principle

AI doesn't read your mind. It responds to exactly what you write. Vague prompt = vague output. Specific prompt = specific output.

Vague Prompt

"Make my code better"

Better how? Faster? Cleaner? More secure?

Specific Prompt

"Refactor this function to use async/await instead of callbacks, and add error handling"

Clear goal, clear outcome.

Be Specific & Give Context

Include the what, why, and constraints. More context = better results.

Include:

  • What you're building: "A Next.js e-commerce site"
  • Current state: "I have a products table in Neon"
  • What you want: "Add a shopping cart feature"
  • Constraints: "Using Drizzle ORM, no Redux"

Good example:

"I'm building a Next.js 14 app with Drizzle and Neon. I need to add a shopping cart that persists to the database for logged-in users and localStorage for guests. The cart should sync when they log in. Here's my current schema: [paste schema]"

Show Examples (Few-Shot Prompting)

Want output in a specific format? Show an example. AI learns patterns from what you give it.

Example prompt:

"Generate product descriptions in this format:

Product: Wireless Headphones
Tagline: Sound that moves with you
Description: Premium audio meets all-day comfort...

Now generate one for: Running Shoes"

Pro Tip

Give 2-3 examples for complex formats. One example might be seen as coincidence; multiple examples establish a pattern.

Iterate & Refine

First response not perfect? That's normal. Prompting is a conversation, not a one-shot deal.

1

Start broad: "Build a contact form component"

2

Refine: "Add validation for email and phone fields"

3

Polish: "Make the submit button disabled while sending"

4

Fix: "The email regex isn't catching .co.uk domains"

Claude Code Specific Tips

Use @ mentions for file context

Type @filename to include a file in context. Claude Code will read and understand it.

"Update @lib/db/schema.ts to add a createdAt column to the users table"

Reference existing patterns

Point to code that already exists: "Follow the same pattern as..."

"Create a new API route for orders following the same pattern as @app/api/products/route.ts"

Use slash commands

Claude Code has built-in commands for common tasks:

/commitAuto-commit
/clearClear context

Be explicit about what NOT to do

Constraints are helpful: "Don't use any external libraries" or "Keep it under 50 lines".

"Add form validation. Use native HTML5 validation, don't install any validation libraries."

Common Pitfalls

Being too vague

"Make it better" or "Fix the bug" without context leaves AI guessing.

Fix: Describe the current behavior, expected behavior, and relevant code.

No context about your stack

AI might suggest React patterns for a Vue project, or npm commands when you use pnpm.

Fix: Mention your stack: "I'm using Next.js 14, Drizzle, and Tailwind".

Expecting perfection on first try

Complex features need iteration. One prompt rarely produces production-ready code.

Fix: Build incrementally. Get the basic structure, then refine with follow-up prompts.

Accepting code without understanding

Copy-pasting without review leads to bugs you can't fix.

Fix: Ask "explain this code" or "walk me through what this does". Understand before you ship.

Quick Tips Cheat Sheet

Start with context about your project

Describe current state AND desired state

Include relevant code snippets

Show examples of the format you want

Specify constraints and limitations

Iterate—don't expect perfection

Ask for explanations when unsure

Review and test before shipping

Get more from Claude Code

Learn advanced techniques and workflows for vibe coding.

Claude Code Tips →