Back to Blog
Tutorial2025-01-0812 min read

Prompt Engineering for Developers: A Practical Guide

Stop getting mediocre results from AI. Learn the prompting techniques that 10x developers use to get better code, faster.

K

Kevin M.

Founder


Why Prompting Matters

The difference between a good prompt and a great prompt can be 10x better code. Most developers just type what they want and hope for the best. Let's do better.

The CRISP Framework

I use a framework I call CRISP for coding prompts:

  • Context: What's the situation?

  • Role: Who should the AI be?

  • Instructions: What exactly do you want?

  • Specifics: Technical constraints and preferences

  • Patterns: Examples of desired output
  • Context

    Always start with context. The AI doesn't know what project you're in, what framework you're using, or what conventions you follow.

    Bad prompt:
    > "Add a login form"

    Good prompt:
    > "I'm working on a Next.js 14 app with TypeScript, using shadcn/ui components and Tailwind CSS. The auth is handled by Supabase."

    Role

    Telling the AI what role to play focuses its responses.

    Without role:
    > "Review this code"

    With role:
    > "As a senior security engineer, review this authentication code for vulnerabilities"

    Instructions

    Be explicit about what you want. Don't assume the AI knows your intent.

    Vague:
    > "Make this better"

    Specific:
    > "Refactor this function to: 1) Use early returns instead of nested ifs, 2) Add TypeScript types, 3) Handle the null case explicitly"

    Specifics

    Include technical constraints upfront.

    > "Use only standard library functions, no external dependencies. The function should be pure (no side effects). Time complexity should be O(n) or better."

    Patterns

    Show examples of what you want. This is incredibly powerful.

    > "Format the response like this existing component: [paste example]. Match the naming conventions, prop patterns, and styling approach."

    Real Examples

    Example 1: Bug Fix

    Before:
    > "Fix the bug in userService.ts"

    After:
    > "There's a race condition in userService.ts where concurrent calls to updateUser() can override each other's changes. The symptoms are: users report their settings reverting randomly. I need a fix that: 1) Uses optimistic locking or similar pattern, 2) Is backwards compatible with existing API consumers, 3) Includes a test case that reproduces the race condition."

    Example 2: New Feature

    Before:
    > "Add pagination to the users list"

    After:
    > "Add cursor-based pagination to the /api/users endpoint. Requirements: 1) Use the 'id' field as cursor (it's a UUID), 2) Default page size 20, max 100, 3) Return 'hasNextPage' and 'nextCursor' in response, 4) Handle the case where a cursor points to a deleted record. Follow the existing pagination pattern in /api/posts for consistency."

    Prompt Templates

    Save these templates for common tasks:

    Code Review Template


    Review this code as a senior [framework] developer.
    Focus on:
  • Security vulnerabilities

  • Performance issues

  • Code maintainability

  • Error handling gaps
  • For each issue, explain:

  • What the problem is

  • Why it matters

  • How to fix it with a code example

  • Refactoring Template


    Refactor this code following these principles:
  • [Your coding standards]

  • Keep the public API unchanged

  • Add types where missing

  • Extract magic numbers to constants
  • Show the full refactored code, then explain the changes.

    Debug Template


    Help me debug this issue:

    Expected behavior: [what should happen]
    Actual behavior: [what happens]
    Steps to reproduce: [how to trigger it]
    Relevant code: [paste code]
    Error messages: [paste errors]

    Analyze the possible causes and suggest debugging steps.

    Practice Makes Perfect

    Prompting is a skill. The more you practice, the better you get. Start using the CRISP framework today and watch your AI coding sessions become dramatically more productive.

    Use Craaft's Prompt Queue

    With Craaft, you can queue multiple prompts while the AI works on the current one. Write your CRISP prompts in advance, queue them up, and let the AI work through your task list.

    Try Craaft free →

    Share this article

    Ready to try Craaft?

    14 days free. No credit card required.

    Start your free trial