The Pattern

Not all inputs should be handled the same way. A routing pattern uses one prompt to classify the input, then directs it to the right specialized prompt based on that classification.

The flow: Input → Classifier Prompt → Category → Specialized Handler Prompt

Example: Customer Support Router

Here's how you might route customer messages to specialized response handlers:

1
Classify the Message
Classifier Prompt
Classify this customer message into exactly one category:

- BILLING: Payment issues, refunds, subscription questions
- TECHNICAL: Product bugs, how-to questions, feature requests
- SHIPPING: Delivery status, address changes, lost packages
- OTHER: Anything else

Customer message: "I was charged twice for my subscription this month and I need a refund for the duplicate charge."

Respond with only the category name.
AI
BILLING
↓ routes to the BILLING handler
2
Available Handlers
BILLING
Empathetic, knows refund policies
TECHNICAL
Step-by-step troubleshooting
SHIPPING
Tracking info, logistics
↓
3
Specialized Response
Billing Handler Prompt
You are a billing support specialist. You have access to these policies:
- Duplicate charges are refunded within 3-5 business days
- Refunds go to original payment method
- Customer can also get account credit (instant) instead

Respond to this billing issue with empathy. Acknowledge the problem, explain the solution, and offer options.

Customer message: "I was charged twice for my subscription this month and I need a refund for the duplicate charge."
AI
I'm sorry about the duplicate charge — that's definitely not supposed to happen, and I understand how frustrating unexpected charges can be.

I can process a refund for the duplicate charge right away. You have two options:

1. Refund to your original payment method — typically takes 3-5 business days.

2. Instant account credit — applied to your next billing cycle immediately.

Which would you prefer?

Why Routing Works

A single prompt that tries to handle everything becomes bloated and unfocused. Specialized prompts can include domain-specific context, policies, tone, and examples that wouldn't fit in a general-purpose prompt.

The classifier prompt stays simple — its only job is categorization. The handler prompts can go deep on their specific domain.

This is like having specialists instead of generalists. A billing expert knows refund policies. A technical expert knows troubleshooting steps.

The Technique

First, ask AI to classify the input into categories. Then, based on the classification, use a different specialized prompt for each category. Each handler is an expert in its domain.

When to Route

Making Classification Reliable

The classifier prompt is critical. Make categories mutually exclusive and provide clear examples. Ask for just the category name — nothing else — so you can easily use the response.

Consider adding an "OTHER" or "UNKNOWN" category for inputs that don't fit. This prevents forcing bad fits and lets you handle edge cases gracefully.