Back to All Questions
Learning & SkillsReady to Build

How do I write good prompts for AI coding tools?

Quick Answer

Be specific, provide context, break complex requests into steps, and include examples when possible. Treat it like giving instructions to a capable but literal-minded assistant.

Full Explanation

Prompt quality dramatically affects AI output quality. Here's what works:

Core principles:

Be specific: 'Add a button' vs 'Add a blue submit button in the bottom right of the form that says Submit and is disabled until all required fields are filled'.

Provide context: 'I'm building a task manager for freelancers. Add a way to track billable hours.' Context helps AI make better decisions.

Break complex requests into steps: Instead of 'Build a complete e-commerce checkout', try:

  • . 'Create a cart page showing items'
  • . 'Add a checkout form for shipping address'
  • . 'Integrate Stripe for payment'

Include examples: 'Make the pricing table look like Stripe's pricing page' gives clearer direction than vague descriptions.

Prompt patterns that work:

'Create a [component/feature] that [does X]. It should [requirement 1], [requirement 2], and [requirement 3]. Style it similar to [reference].'

'I'm getting [error]. Here's what I expected: [expected]. Here's what happens: [actual]. The relevant code is: [code].'

'Refactor [this code] to [goal]. Keep [constraint] but change [specific thing].'

Common mistakes:

- Too vague: 'Make it better' vs 'Improve loading performance by lazy-loading images'

  • Too much at once: Asking for 10 features simultaneously
  • No acceptance criteria: Not explaining how you'll know it's right
  • Assuming context: The AI doesn't know your app as well as you do

Prompting is a skill that improves with practice. Notice what works and refine your approach.

Two ways to go from question to shipped

Reading is fine. Shipping is better. Pick the path that fits where you are.