Loading...
Loading...
The same question phrased two different ways produces dramatically different results. Vague prompts get vague code. Specific prompts get production-ready implementations. This lesson teaches you seven patterns that consistently produce high-quality output.
Use when: Building something from scratch.
"Build a REST API with Express and TypeScript. Include user CRUD endpoints, input validation with Zod, and error handling middleware."
Include the tech stack, key features, and constraints. The more specific, the better the scaffold.
Use when: Adding to existing code.
"Add pagination to the /api/articles endpoint. Support page and limit query params, default to 20 items per page, return total count in the response."
Use when: Debugging errors.
"When I click the submit button, I get a 500 error. The console shows 'Cannot read property id of undefined' in the UserForm component. Fix this."
Always include: what you did, what happened, and what you expected.
Use when: Improving existing code without changing behavior.
"Refactor the auth middleware to use early returns instead of nested if-else. Keep the same behavior but make it easier to read."
Use when: Adding test coverage.
"Write tests for the checkout flow covering: successful purchase, expired card, insufficient funds, and empty cart. Use Jest and React Testing Library."
Review: "Review the auth module for security vulnerabilities, missing error handling, and race conditions." Great for catching bugs before they ship.
Plan: "Plan how to migrate from REST to GraphQL. List the steps, risks, and estimated effort before writing any code." Forces Claude to think before acting.
The pattern is always the same: what you want, where it lives, and what success looks like.
Take one of these patterns and use it right now on your own project. Pick the pattern that matches your current need:
Notice the difference between a vague instruction and a specific one. The quality gap is immediate and obvious.