Back to all tips

Write Better Prompts by Being Specific

Learn how to write prompts that give AI coding assistants the context they need to help you effectively.

promptingbasicscursorcopilot
2024-12-151 min read

The difference between a mediocre AI response and a great one often comes down to how specific your prompt is.

The Problem

Vague prompts lead to vague responses. When you ask your AI assistant to "make it better," you'll get generic suggestions that might not fit your needs.

The Solution

Be specific about:

  1. What you're building - "I'm building a user authentication flow for a Next.js app"
  2. What you want - "Add email validation to this form"
  3. Any constraints - "Use Zod for validation, keep it under 50 lines"

Example

Instead of:

Fix this function

Try:

This function should validate email addresses.
It's returning false for valid emails like "user+tag@example.com".
Use a regex that handles edge cases like plus signs and subdomains.

Key Takeaway

The more context you provide, the better your AI can help. Think of it like explaining a task to a new team member who's brilliant but knows nothing about your project.