Workflow
Prompt Specificity
Write prompts with clear constraints and success criteria.
Overview
Vague prompts lead to generic solutions that don't meet your needs. Specific prompts with clear constraints, requirements, and success criteria produce focused, accurate results. By investing time upfront to articulate exactly what you want—and what you don't want—you eliminate ambiguity and reduce back-and-forth iterations. This workflow helps you craft prompts that get the right answer the first time.
Use this workflow when requesting features, debugging complex issues, asking for architectural advice, generating code with specific patterns, or anytime precision matters more than speed.
Step-by-step process
List requirements and constraints
Start by explicitly stating what must be included, technical constraints, performance requirements, and dependencies. Be concrete with examples where possible.
Define what to avoid
Negative constraints are just as important as positive ones. Tell Claude what patterns, libraries, or approaches you don't want and explain why.
Confirm assumptions before implementation
Ask Claude to state its understanding of requirements and proposed approach before writing code. This catches misunderstandings early.
Provide examples and edge cases
Show concrete examples of desired behavior, including edge cases and error scenarios. Examples clarify intent better than descriptions.
Example prompts
"Add email notifications for order status changes. Requirements: use SendGrid (API key in env vars), send only to verified email addresses, include order number and status in subject, support HTML and plain text, retry failed sends 3 times with exponential backoff. Constraint: must complete within 5 seconds to not block the order update API."
"Generate a TypeScript API client for our REST endpoints. Use: axios for requests, zod for validation, our existing error handling patterns from src/utils/errors.ts. Format: one file per resource, typed request/response, JSDoc comments. Don't: use any, generate tests (we'll write those), add extra dependencies."
"Users report 'cart total is wrong' on checkout. The bug happens only when: applying discount codes, cart has 3+ items, user is in Canada. It doesn't happen for US users or carts with 1-2 items. Currency is CAD. Tax calculation is in src/utils/pricing.ts. Start by analyzing the discount logic in that file."
"Design a real-time notification system. Requirements: support 10k concurrent users, deliver notifications within 2 seconds, persist unread notifications, work with our existing Node.js/PostgreSQL stack. Constraints: budget limits prevent Redis or managed services, we can't modify the database schema extensively. Propose an approach that works within these limits."
Expected outputs
Clear requirements
Documented understanding of what's needed, what's constrained, and what success looks like, reducing misalignment
Reduced scope creep
Explicit boundaries prevent Claude from adding features or complexity you didn't ask for
Less overengineering
Specific constraints guide Claude toward simple, appropriate solutions rather than overly complex architectures
Faster iterations
Precise prompts get closer to the right answer on the first attempt, reducing back-and-forth refinement
Best practices
Common pitfalls
Assuming Claude knows your conventions
Solution: Explicitly reference existing patterns: 'Follow the error handling pattern in src/utils/errors.ts' or 'Use the same component structure as UserProfile.tsx'.
Being too brief to save time
Solution: Spend 2 extra minutes on prompt detail to save 30 minutes of clarification and rework. Specificity upfront pays dividends.
Not specifying constraints until after the fact
Solution: State constraints in the initial prompt, not after reviewing output. 'That's too complex' or 'Don't use library X' should be said before implementation.
Pro tips
Use your codebase as reference
""Implement this feature following the same patterns as the existing user settings page. Match the validation approach, error handling, and component structure from src/pages/settings/*.""
Specify the level of abstraction
""Don't create abstract factories or complex inheritance. Keep it simple: one function per operation, pure functions where possible, minimal indirection.""
Provide success criteria
""Success means: function completes in under 100ms, handles null inputs gracefully, returns typed results, and has zero ESLint warnings. Don't ship until these criteria are met.""