Prompting Techniques
Rubber Duck

The Rubber Duck

Use AI to think through problems, not just write code.

The Concept

Before writing code, use AI to explore the problem space:

"I'm trying to decide between approach A (polling) and approach B 
(websockets) for real-time updates. What are the tradeoffs for a 
chat app with ~1000 concurrent users?"

AI helps you think, then you decide, then AI implements.

When to Rubber Duck

Use rubber ducking when you're not sure HOW to approach something, before asking AI to build it.

Architecture Decisions

"We need to store user preferences. Compare:
1. JSON column in PostgreSQL
2. Separate preferences table
3. Redis for fast access

Our app has 10k users, preferences change rarely, 
but are read on every page load."

Technology Choices

"For file uploads in our Next.js app, compare:
1. Direct to S3 with presigned URLs
2. Through our API with streaming
3. Using a service like Uploadthing

Consider: 100MB max file size, need progress bars, 
must work on mobile."

Tradeoff Analysis

"Should we use server-side rendering or client-side for our 
dashboard? Users are logged in, data is dynamic, SEO doesn't 
matter. What are the performance implications?"

Rubber Duck → Implement Flow

Step 1: Rubber duck the approach
        "Compare X vs Y for [use case]..."

Step 2: Make your decision
        You: "Let's go with approach Y"

Step 3: Now implement
        "Implement approach Y using [specifics]..."

Good Rubber Duck Questions

TypeExample
Compare"Compare X vs Y for [use case]"
Tradeoffs"What are the tradeoffs of X?"
Best practice"What's the standard approach for X?"
Pitfalls"What could go wrong with X?"
Scale"Will X work at [scale]?"

Example Session

You: "I need to implement rate limiting for our API. 
     What are my options?"

AI: [Explains token bucket, sliding window, fixed window, etc.]

You: "We have a distributed system with 3 servers. 
     Which approach works best?"

AI: [Recommends Redis-based sliding window, explains why]

You: "Implement Redis sliding window rate limiting as 
     middleware for our Express app. 100 requests per 
     minute per IP."

The implementation is better because you understood the options first.