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.

When to use

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

1

List requirements and constraints

Start by explicitly stating what must be included, technical constraints, performance requirements, and dependencies. Be concrete with examples where possible.

"Add a search feature to our product catalog. Requirements: must support fuzzy matching, filter by category and price range, return results within 100ms, work with our existing PostgreSQL database. Don't use Elasticsearch—we want to avoid new infrastructure."
2

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.

"Don't use class components—we're standardizing on functional components with hooks. Avoid lodash—we're trying to reduce bundle size. No inline styles—use our existing CSS modules system."
3

Confirm assumptions before implementation

Ask Claude to state its understanding of requirements and proposed approach before writing code. This catches misunderstandings early.

"Before implementing, confirm: 1) You understand we need server-side search, not client-side filtering, 2) Results should paginate at 20 items per page, 3) Search should update the URL for shareability. Do these assumptions match the requirements?"
4

Provide examples and edge cases

Show concrete examples of desired behavior, including edge cases and error scenarios. Examples clarify intent better than descriptions.

"Example searches: 'blue widget' should match 'Blue Widget Pro', 'bluewidget', and 'Widget (Blue)'. Searching for '$50-100' should filter by price. If no results, show 'No products found' with a link to browse all categories."

Example prompts

Feature with specific constraints

"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."

Code generation with style preferences

"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."

Debugging with context

"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."

Architecture with constraints

"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

Be specific about versions, frameworks, and patterns—'use React' is vague, 'use React 18 with functional components and hooks' is clear
Include examples of desired output—showing is often clearer than describing
State both what you want and what you don't want—negative constraints prevent unwanted solutions
Provide context about your codebase conventions—Claude can match existing patterns if you point them out
Specify how to handle errors and edge cases—don't assume Claude will guess correctly

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.""

Related workflows