pair-programmingtipsai-codingproductivityguide

AI Pair Programming: 10 Tips to Get Better Results

Billy C

AI pair programming is the most practical application of AI in software development. Not the flashy demos, not the autonomous agents — just you and an AI working through code together. After a year of doing this daily, here are 10 tips that consistently produce better results.

Tip 1: Think Out Loud

The best pair programming sessions involve constant communication. The same applies with AI. Before writing code, explain your thinking:

I need to add rate limiting to the review API endpoint.
The current flow is: user sends POST /api/reviews, we validate the input,
check auth, insert into Supabase, and return the review.

I want to add IP-based rate limiting before the insert step.
Limit: 5 reviews per IP per hour.
I already have the ip_address column in the reviews table.

This context helps AI understand not just what you want, but why and where it fits in the existing architecture.

Tip 2: Review Every Line

AI-generated code is not always correct. Treat it like code from a junior developer — competent but needs review:

  • Check imports. AI sometimes imports packages that do not exist or uses wrong import paths.
  • Verify logic. Trace through the main code path mentally.
  • Test edge cases. What happens with null? Empty arrays? Invalid input?
  • Check types. TypeScript types might be too loose (using any) or too strict.

This takes 30-60 seconds per generation. Skip it and you will spend 10 minutes debugging later.

Tip 3: Use Small, Focused Requests

Bad: "Build me a blog system with index page, post page, author page, markdown rendering, and SEO."

Good:

  1. "Create the blog index page. Server component, fetch from Supabase, card grid layout."
  2. "Now create the blog post page. Fetch by slug, render markdown, add JSON-LD."
  3. "Add the author page. Filter posts by author_slug."

Small requests produce better code because the AI can focus on one thing at a time. Chain them together for complex features.

Tip 4: Provide Examples of What "Good" Looks Like

The best prompt is an existing file that shows your patterns:

Here is how our tool detail page works: @app/tool/[slug]/page.tsx
Create a blog post page following the same patterns.

AI replicates patterns more accurately than it implements descriptions. Show, do not tell.

Tip 5: Use AI for the Boring Parts

Maximize AI usage on:

  • Boilerplate (CRUD operations, form handling, API routes)
  • Tests (generating test cases from function signatures)
  • Types (generating TypeScript interfaces from data)
  • Documentation (JSDoc, README sections)
  • Configuration (webpack, ESLint, Tailwind config)

Minimize AI usage on:

  • Core business logic (you need to understand it)
  • Security-critical code (you need to verify it)
  • Complex algorithms (you need to trust it)

Tip 6: Iterate, Do Not Regenerate

When AI output is 80% correct, do not start over. Fix the 20%:

The component is good but:
1. The date formatting should use "January 15, 2026" not "1/15/26"
2. Add a line-clamp-2 to the excerpt
3. The tags should link to /blog?tag={tag}

Targeted corrections produce better results than regenerating from scratch. The AI keeps the good parts and fixes the specific issues.

Tip 7: Explain Your Constraints

AI does not know your constraints unless you state them:

Constraints:
- Must be a React Server Component (no useState, useEffect)
- Cannot install new npm packages
- Must use our existing Supabase client from @/lib/supabase/server
- Must match the dark theme (zinc-900 backgrounds, zinc-400 text)
- Must handle the case where no data is returned

Explicit constraints prevent AI from generating code that technically works but does not fit your project.

Tip 8: Use AI to Rubber Duck

When you are stuck, explain the problem to AI like you would explain it to a rubber duck:

I am trying to figure out why the sitemap returns 404 on the deployed site
but works locally. The sitemap is generated by app/sitemap.ts.
The site is deployed on Cloudflare Pages via OpenNext.

What I have checked:
- The file exists and builds correctly
- Other dynamic routes work
- robots.txt also returns 404

What could cause dynamic routes to fail on Cloudflare Pages
but work locally?

This structured problem description often leads AI to identify the issue (in this case, the _routes.json exclude list blocking the routes).

Tip 9: Know When to Stop

If you have prompted the AI three times for the same thing and it is still wrong, stop using AI for that specific task. Write it manually.

Signs AI is not the right tool:

  • The logic requires deep domain knowledge the AI lacks
  • The code involves complex state interactions
  • You keep fixing AI's output and reintroducing bugs
  • The task is faster to do manually than to describe

Tip 10: Build Your Workflow

Develop a consistent workflow:

  1. Plan: Describe what you are building (to yourself or the AI)
  2. Scaffold: Let AI generate the file structure and boilerplate
  3. Implement: Work through features one at a time, small focused requests
  4. Test: Generate tests with AI, review for edge cases
  5. Review: Read through all generated code before committing
  6. Refine: Fix issues with targeted edits, not regeneration

Consistency produces better results than sporadic AI usage. The more you pair program with AI, the better you get at directing it.

The Honest Truth About AI Pair Programming

AI is not a senior developer. It is a very fast junior developer with encyclopedic knowledge and no judgment. It generates code quickly but does not understand your business, your users, or your constraints unless you explain them.

The developers getting the most value from AI pair programming are the ones who:

  1. Know what good code looks like (so they can evaluate AI output)
  2. Communicate clearly (so the AI understands the task)
  3. Work incrementally (small requests, frequent validation)
  4. Use AI strategically (boring parts, not critical parts)

AI pair programming is a skill that improves with practice. Start with these tips and develop your own techniques as you learn what works for your specific workflow.


Find AI pair programming tools on BuilderAI

More Articles

AI Pair Programming Tips — 10 Pro Techniques | BuilderAI