How to Talk to AI: The AI Coder's Prompting Guide | SheCodes
Beginner 5 min read

How to Talk to AI: The AI Coder's Prompting Guide

The #1 skill that makes everything else easier. Better prompts = better results.

The Prompt Formula

Context What tech stack and project type
Component What you want built (use correct names)
Details Colors, sizes, behavior, layout
Constraints Responsive, accessible, animated

The Golden Rules

Be Specific Say exactly what you want, not vaguely what you feel
Give Context Your stack, the file, what you already tried
Show the Error Copy-paste the actual error message, every time
One Thing at a Time Ask for one change per message for best results
Iterate, Don't Restart Refine what you have instead of starting over

Before & After: Prompt Upgrades

See how specific language transforms vague requests into precise instructions.

Buttons Add a button Add a primary CTA button with text 'Get Started', purple gradient background (#8B5CF6 to #EC4899), white text, rounded-xl, and a subtle shadow that increases on hover.
Layout Make a landing page Create a landing page with: 1) Hero section with gradient text headline, subtitle, and two CTA buttons. 2) Features grid with 6 cards. 3) Testimonials carousel. 4) Footer with 4 columns.
Colors Make it look nice Use #8B5CF6 as primary, #F472B6 as accent, #1A1A3E for text, white background. Success green: #10B981, warning: #FBBF24, error: #FB7185.
Responsive Make it mobile-friendly On desktop, show a 3-column grid. On tablet (below 768px), switch to 2 columns. On mobile (below 640px), stack in a single column with reduced padding.
Data Show some users Create a data table with columns: Avatar, Name, Email, Role (dropdown), Status (colored badge), and Actions (edit/delete). Add sorting on Name and Email columns.
Animation Add animations Add a fade-up animation to each card in the features section. Cards should appear one at a time with a 100ms stagger delay as they scroll into view.

How to Share an Error

The difference between getting a fix in 10 seconds vs. going back and forth for 10 minutes.

Bad: Vague complaint

"My app is broken. The page won't load. Help?"

Good: Full context

"I'm getting this error in src/app/page.tsx:" TypeError: Cannot read properties of undefined (reading 'map') "I expected the list of users to render, but the data is coming back as undefined. I'm using Next.js with the App Router."

Prompt Patterns

Start from scratch

“Create a [component] using [tech stack] with [specific details].”

Example: Create a pricing card component using React + Tailwind with three tiers: Basic, Pro, and Enterprise.

Modify existing

“In [file/component], change [specific thing] to [new behavior].”

Example: In the navbar component, change the mobile menu from a dropdown to a full-screen overlay with a fade animation.

Fix a bug

“The [component] is [wrong behavior]. It should [correct behavior]. Here's the code: ...”

Example: The modal overlay doesn't close when clicking outside. It should close when clicking the backdrop.

Add a feature

“Add [feature] to the existing [component]. It should [behavior] when [trigger].”

Example: Add dark mode toggle to the navbar. It should switch all colors and persist the preference in localStorage.

Style update

“Update the styling of [component] to match [reference]. Keep [constraints].”

Example: Update the cards to have a glass-morphism effect with backdrop-blur and semi-transparent white background.

Iterate & refine

“This is close but [adjustment needed]. Also [additional change].”

Example: The spacing is too tight, increase padding to p-6. Also make the heading text larger (text-3xl) and bolder.

Power Words AI Understands

Using these specific terms helps AI generate exactly what you want.

Layout grid flexbox sidebar hero section sticky header full-width container two-column masonry
Style rounded-xl shadow-lg gradient glass-morphism blur backdrop border hover effect transition opacity
Responsive mobile-first breakpoint collapse hamburger menu stack on mobile hide on mobile responsive grid
Animation fade-in slide-up stagger on scroll hover scale skeleton loader smooth transition spring animation
Components modal drawer toast accordion carousel breadcrumb FAB data table pagination tabs
Behavior on click on hover on scroll debounce lazy load infinite scroll drag and drop auto-complete
Accessibility ARIA label focus ring screen reader keyboard navigation alt text semantic HTML skip link
Performance lazy load code splitting memoize virtual scroll optimistic update cache prefetch SSR SSG

When to Start a New Chat

Sometimes the best move is a fresh start. Here's how to know when.

AI is going in circles You've asked the same thing 3 times and keep getting the same wrong answer. The conversation context is polluted with bad attempts. → Start fresh. Paste only your current code and the specific problem.
The context is too long You've been chatting for 50+ messages. AI is forgetting what you said earlier and contradicting itself. → Start a new chat. Summarize what you've built so far and what you need next.
You've changed direction You started asking about a navbar but now you're debugging a database query. The conversation has drifted. → New topic = new chat. Give AI fresh context about the new problem.
You made big changes outside AI You manually edited several files since the last AI message. The AI's understanding of your code is now stale. → Start fresh and paste your updated code so AI sees the current state.

Building a Page Step by Step

Here's how to build a complete landing page through iterative prompting:

  1. 1
    Set the foundation Create a Next.js page with Tailwind CSS. Set up the basic structure: a fixed navbar at top, main content area, and footer.
  2. 2
    Build the hero Add a hero section with a gradient text heading that says 'Build faster with AI', a subtitle paragraph, and two buttons: a primary 'Get Started' and a secondary 'Learn More'.
  3. 3
    Add features section Below the hero, add a features section with 6 cards in a 3-column grid. Each card has an icon, title, and description. Use purple/pink accent colors.
  4. 4
    Add social proof Add a testimonials section with 3 testimonial cards showing a user avatar, name, role, and quote. Use a subtle background color.
  5. 5
    Style & polish Add hover animations to the cards (slight lift + shadow), fade-in animations on scroll, and make sure everything is responsive on mobile.
  6. 6
    Final touches Add a CTA banner before the footer with a gradient background. Add meta tags for SEO. Make the navbar highlight the active link.

Common Prompting Mistakes

Being too vague Be specific about component names, colors (hex), sizes, and behavior. "Make it pretty" → "Use a purple-to-pink gradient with rounded corners and a subtle shadow."
Asking for everything at once Break complex pages into smaller steps: layout first, then components, then interactions. Build the full app → Step 1: Create the layout. Step 2: Add the navbar. Step 3: Build the hero section.
Not specifying tech stack Always tell AI what framework and libraries you're using. "Build a form" → "Build a form using React Hook Form with Zod validation and Tailwind styling."
Forgetting responsive design Always mention how things should look on different screen sizes. "Add a grid" → "Add a 3-column grid on desktop, 2 on tablet, 1 on mobile with gap-6 spacing."
Not iterating The first result is a starting point. Refine with follow-up prompts. "Perfect, but make the font larger, add more padding, and change the blue to purple."

Copy-Paste Prompts

Real prompts that work well. Copy any of them, change the details to fit your project, and paste into your AI tool.

Landing Page

“Create a landing page with Tailwind CSS. Include: 1) A hero section with a large heading, subtitle, and two buttons. 2) A features section with 6 cards in a 3-column grid. 3) A testimonials section with 3 cards. 4) A CTA banner with a gradient background. 5) A footer with 4 columns. Use purple (#8B5CF6) as the main color.”

Responsive Navbar

“Create a navbar with: logo on the left, links in the center, and a button on the right. Fix it to the top of the page with a blurred background. On mobile, hide the links behind a hamburger menu icon that opens a slide-in drawer. Highlight whichever link is active.”

Pricing Section

“Create a pricing section with 3 tiers: Basic ($9/mo), Pro ($29/mo), and Enterprise (Custom). Each card shows the name, price, a list of features with checkmarks, and a button. Make the Pro card stand out with a colored border and a 'Most Popular' badge. On mobile, stack the cards vertically.”

Contact Form

“Create a contact form with fields for Name, Email, a Subject dropdown (General, Support, Sales), and a Message textarea. All fields are required. Show a red error message below any empty field when the user tries to submit. Show a success message after submitting.”

Dashboard Layout

“Create a dashboard with: 1) A sidebar on the left with navigation links and icons. 2) A top bar with a search input and a user avatar. 3) A main area with 4 stat cards at the top showing numbers, and a data table below. On smaller screens, collapse the sidebar to just icons.”

Dark Mode Toggle

“Add dark mode to the app. Put a sun/moon toggle button in the navbar. Dark colors: background #0F0E17, cards #1A1A2E, text white, muted text #A7A9BE. Save the user's choice so it stays the same when they come back.”

Hero Section

“Create a hero section with a large heading that has a purple-to-pink gradient text effect, a subtitle in gray, and two buttons side by side (one filled, one outlined). Center everything. Add a subtle fade-up animation when the page loads.”

FAQ Accordion

“Create an FAQ section with 6 questions. Clicking a question opens the answer and closes the others. Use a smooth animation for opening and closing. Add a plus icon that turns into a minus when open. Below the questions, add a 'Still have questions? Contact us' link.”

Frequently Asked Questions

How do I write good prompts for AI coding tools?

Be specific about what you want: describe the feature, the look and feel, and any constraints. Break big requests into smaller steps. Include context like 'I'm using Next.js with Tailwind CSS' so the AI generates compatible code. Show examples of what you want when possible.

Why does AI give me bad code sometimes?

AI works best with clear, specific instructions. Vague prompts like 'make it better' produce vague results. Instead, say exactly what's wrong and what you want: 'The button is too small on mobile, make it full-width below 640px'. The more context you provide, the better the output.

Should I give AI my entire project or one piece at a time?

Work in small steps. Ask for one feature or fix at a time, test it, then move on. Giving the AI too much at once leads to errors and makes it harder to identify what went wrong. Think of it like giving directions: step-by-step works better than dumping a whole map.

What is prompt engineering for coding?

Prompt engineering is the skill of writing clear instructions that get the best results from AI. For coding, this means describing what you want built, what tech stack you're using, what the current code looks like, and what specific changes you need. It's the core skill of AI coding.