How to Write Better Prompts for Your AI Coding Assistant

6 minutes read

Your AI coding assistant is only as good as the prompts you give it.

GPT-5 hits different than the old models. That "BE SUPER DETAILED" energy? Yeah, that's not it anymore.

Here's what actually works now.

How to Use This Guide

Step 1: Bookmark this page. Seriously.

Step 2: Pick the templates that match your workflow. Don't try to use everything at once.

Step 3: Copy a template, fill in the brackets [LIKE_THIS] with your actual info.

Step 4: Paste it into your AI tool (Cursor, ChatGPT, Claude, whatever).

Step 5: Watch the magic happen.

Pro tip: Save your customized templates in a notes app or snippet manager. You'll use them way more than you think.

The New Rules for AI Prompting

1. Be Precise, Avoid Conflicts

GPT-5 is lowkey perfectionist energy. It follows instructions really well but gets confused with wishy-washy directions.

❌ Don't do this:

Make this component reusable but also specific to our use case

✅ Do this:

Create a reusable Button component with these specific variants: primary, secondary, destructive

2. Use XML-Like Structure

This might look extra but trust me, it works. Structure your prompts like this:

<code_editing_rules>
  <guiding_principles>
    - Every component should be modular and reusable
    - Follow single responsibility principle
    - Include proper TypeScript types
  </guiding_principles>
 
  <frontend_stack_defaults>
    - Styling: TailwindCSS
    - State: React hooks or Zustand
    - Forms: React Hook Form + Zod
  </frontend_stack_defaults>
</code_editing_rules>

3. Match Reasoning Effort to Task Complexity

Don't make the AI overthink simple stuff:

  • High reasoning: Big brain architecture stuff, nasty bugs
  • Medium reasoning: Normal feature work, code reviews
  • Low reasoning: Quick fixes, formatting, "how do I..." questions

4. Drop the Firm Language

The all-caps demanding thing? Cringe. GPT-5 actually does worse with that energy.

❌ Old approach:

Be THOROUGH when gathering information.
Make sure you have the FULL picture before replying.

✅ New approach:

Review the relevant files and dependencies before suggesting changes.

Copy-Paste Prompt Templates

Template 1: Component Creation

<task>
Create a [COMPONENT_NAME] component that [SPECIFIC_FUNCTIONALITY]
</task>
 
<requirements>
- TypeScript with proper interfaces
- Responsive design using TailwindCSS
- Accessible (ARIA labels, keyboard navigation)
- Include loading and error states
</requirements>
 
<constraints>
- Keep bundle size minimal
- Follow existing project patterns in /src/components
- Use existing design tokens from globals.css
</constraints>

Template 2: Bug Fixing

<issue>
[DESCRIBE THE BUG - be specific about what's happening vs expected]
</issue>
 
<context>
- Relevant files: [LIST FILES]
- Error messages: [PASTE EXACT ERRORS]
- Steps to reproduce: [NUMBERED LIST]
</context>
 
<investigation_approach>
- Check the most likely causes first
- Verify assumptions with console logs if needed
- Suggest fix with explanation
</investigation_approach>

Template 3: Code Review

<review_focus>
- Performance implications
- Security considerations
- Code maintainability
- TypeScript type safety
</review_focus>
 
<feedback_style>
- Highlight what's working well
- Suggest specific improvements with examples
- Prioritize critical issues over style preferences
</feedback_style>

Advanced Techniques

Self-Reflection for Complex Projects

Building something big from zero? Make the AI think first:

<self_reflection>
- First, create a mental rubric for what makes a world-class [PROJECT_TYPE]
- Consider 5-7 key categories that are critical to get right
- Use this rubric internally to evaluate and iterate
- Don't show the rubric to me - use it for your own planning
</self_reflection>
 
<execution>
- Build incrementally, starting with core functionality
- Test each piece before moving to the next
- Document decisions and trade-offs as you go
</execution>

Control AI Eagerness

GPT-5 can be a bit much sometimes. Set some boundaries:

<tool_budget>
- Maximum 3 file reads before providing initial assessment
- Ask for clarification only if requirements are genuinely unclear
- Parallelize context gathering when possible
</tool_budget>
 
<persistence>
- Proceed with reasonable assumptions rather than asking for every detail
- Document assumptions made for later validation
- Focus on delivering working code quickly
</persistence>

Real-World Examples

Example 1: API Integration

<task>
Integrate the Stripe payment API into our checkout flow
</task>
 
<technical_requirements>
- Use Stripe Elements for card input
- Handle 3D Secure authentication
- Store payment intent ID in our database
- Show loading states during processing
</technical_requirements>
 
<existing_patterns>
- Follow the pattern in /src/lib/api-client.ts for API calls
- Use the same error handling as /src/components/forms/contact-form.tsx
- Match the loading spinner from /src/components/ui/button.tsx
</existing_patterns>

Example 2: Performance Optimization

<performance_issue>
The dashboard loads slowly with 100+ items in the list
</performance_issue>
 
<current_implementation>
- Rendering all items at once in a simple map()
- Each item makes individual API calls for additional data
- No caching or memoization
</current_implementation>
 
<optimization_priorities>
1. Reduce initial render time
2. Minimize API calls
3. Maintain smooth scrolling
4. Keep memory usage reasonable
</optimization_priorities>

Common Mistakes to Avoid

❌ Being Too Vague

"Make this better"
"Fix the styling issues"
"Optimize this code"

✅ Being Specific

"Reduce the bundle size of this component by lazy-loading the chart library"
"Fix the mobile responsive issues - the sidebar overlaps content below 768px"
"Optimize this function to handle 1000+ items without blocking the UI"

❌ Conflicting Instructions

"Make it simple but also feature-rich"
"Keep it minimal but add all these features..."

✅ Clear Priorities

"Prioritize simplicity - if we need advanced features, we'll add them later"
"Focus on core functionality first: user auth, data display, basic CRUD"

The Bottom Line

Good prompts = good results. It's that simple.

The AI doesn't need a pep talk. It needs clear instructions and context.

Copy these templates, make them yours, and watch your coding sessions actually slap.

Getting Started Right Now

If you're new to this: Start with Template 1 (Component Creation). It's the most useful day-to-day.

If you're debugging: Jump straight to Template 2 (Bug Fixing). Fill in the exact error messages.

If you're building something big: Use the Self-Reflection technique. Let the AI plan before it codes.

If the AI is being extra: Use the Control AI Eagerness section to chill it out.

Where to use these:

  • Cursor: Paste in the chat or use in your .cursorrules file
  • ChatGPT: Copy-paste directly into the conversation
  • Claude: Works the same way
  • Any AI coding tool: These templates are universal

Quick Reference

For simple tasks: Be direct, use low reasoning effort For complex builds: Use XML structure + self-reflection For debugging: Provide exact errors + reproduction steps For reviews: Focus on specific aspects, not everything at once

Bookmark this, customize for your stack, and thank me later.