Bad prompts waste more time than they save. You get garbage, fix it manually, and wonder why AI is hyped. The problem isn’t the AI – it’s the prompt. Here are the 10 mistakes developers make most, with before/after examples.
Mistake 1: Being Too Vague
Bad: “Write a function to process data”
Good: “Write a TypeScript function that takes an array of user objects ({id, email, createdAt}), filters out users created before 2024, and returns their emails sorted alphabetically.”
Why it fails: AI can’t read your mind. “Process data” could mean 1000 things.
Mistake 2: Not Specifying the Stack
Bad: “Create a login page”
Good: “Create a login page using Next.js 14 App Router, shadcn/ui Form component, react-hook-form, and Zod validation. POST credentials to /api/auth/login.”
Why it fails: Without stack info, AI picks random frameworks (maybe jQuery in 2026).
Mistake 3: Asking for Everything at Once
Bad: “Build me a complete e-commerce backend with products, cart, checkout, payments, auth, admin panel, and email notifications”
Good: “Start with the product listing API. Create a GET /api/products endpoint that returns paginated results from Supabase with title, price, image_url, and stock.”
Why it fails: Giant prompts produce giant, untestable outputs. Break into steps.
Mistake 4: Not Showing Existing Patterns
Bad: “Add a new API endpoint”
Good: “Add a new API endpoint following this existing pattern: [paste existing endpoint code]. New endpoint should handle [specific task].”
Why it fails: Without examples, AI invents its own style that doesn’t match your codebase.
Mistake 5: Forgetting Error Handling
Bad: “Fetch user data from the API”
Good: “Fetch user data from /api/users/:id. Handle: 401 (redirect to login), 404 (show user not found), network error (show retry button), loading state (show skeleton).”
Why it fails: AI only builds the happy path unless you explicitly mention errors.
Mistake 6: Not Mentioning Types
Bad: “Create a function to calculate price”
Good: “Create a TypeScript function: calculateTotal(items: CartItem[], discount?: number): { subtotal: number, discount: number, total: number }. CartItem has: id: string, price: number, quantity: number.”
Why it fails: Without type info, you get untyped code that needs manual type-fixing.
Mistake 7: Not Setting Boundaries
Bad: “Improve this code”
Good: “Improve this code for: 1) Performance (reduce re-renders), 2) Accessibility (add aria labels), 3) Type safety (remove any types). Don’t change the component structure or styling.”
Why it fails: “Improve” is subjective. AI might rewrite everything when you wanted small fixes.
Mistake 8: Pasting Errors Without Context
Bad: “Fix this error: TypeError: Cannot read properties of undefined”
Good: “Getting TypeError: Cannot read properties of undefined (reading ’email’) at line 23 of UserProfile.tsx. The user object comes from useAuth() hook which fetches from /api/auth/me. Error happens on page refresh. Here’s the component: [paste code]”
Why it fails: Same error has 100 causes. Context narrows it to the actual one.
Mistake 9: Not Iterating
Bad: Getting imperfect output -> throwing it away -> trying a completely new prompt
Good: Getting imperfect output -> “Good, but change X. Also add Y. And the error handling should be Z.”
Why it fails: First output is rarely perfect. Iteration is faster than starting over.
Mistake 10: Treating AI Like Google
Bad: “How do I use useEffect?”
Good: “In my component, I need to fetch user data when the component mounts and when userId changes. Write the useEffect with proper cleanup, loading state, and error handling. Use the abort controller pattern.”
Why it fails: AI isn’t a search engine. Give it a JOB, not a QUESTION.
The Meta-Rule
Before hitting send, ask yourself: “If I gave this prompt to a new developer on their first day, would they have enough context to do the task correctly?” If no, add more context.
Full prompting guide | AI coding tools | Practice at hackathons