AI Prompt Generator: Templates, Techniques & Frameworks for Every Use Case

Use our free AI Prompt Generator to create optimised prompts for any task — content writing, coding, analysis, customer support, data extraction, and more.

The Anatomy of a Perfect Prompt

Every high-quality prompt contains four components:

` [ROLE] You are a [specific persona with relevant expertise].

[CONTEXT] [Background information the AI needs to understand the situation. Include: who the audience is, what constraints exist, what has already been done.]

[TASK] [The specific, measurable action to take. Use imperative verbs: Write, Analyse, Extract, Compare, Generate, Summarise. One task per prompt.]

[FORMAT] Respond with: [exact structure required — bullet list, JSON, table, numbered steps, word count, specific sections, tone, language register] `

Example — weak prompt:

"Write me a blog post about AI."

Example — strong prompt:

"You are a senior technology journalist with 10 years of experience writing for CXOs and business leaders in India.

>

Context: I run a B2B SaaS newsletter for 8,000 Indian startup founders. My readers are non-technical executives who want to understand AI's business impact without jargon. They are time-poor and scan-read.

>

Task: Write a 600-word blog post explaining how Indian SMBs can use AI to reduce customer support costs by 40–60%, with real examples from Indian companies.

>

Format: Use a punchy headline, 3 sub-sections with bold headers, one concrete example with numbers per section, and a 2-sentence call to action at the end. Use active voice. Avoid phrases like 'dive in', 'game-changer', or 'leverage'."

The second prompt produces a publishable draft. The first produces generic filler.


Prompt Templates by Use Case

1. Content Writing Prompt

` You are a [niche expert / content type specialist] writing for [target audience].

Context: This content is for [platform/channel]. The audience's primary concern is [pain point]. They are at [awareness stage: problem-aware / solution-aware / product-aware].

Task: Write a [word count] [content type: blog post / LinkedIn post / email / product description] about [specific topic].

The headline must create [curiosity / urgency / specificity]. Include: [hook in first line / data point / example / CTA] Avoid: [generic phrases / passive voice / jargon list]

Format: [structure — heading + 3 sections + CTA / bullet list / narrative / etc.] Tone: [conversational / authoritative / empathetic / direct] `

Filled example for Indian e-commerce: ` You are an e-commerce copywriter specialising in Indian D2C fashion brands.

Context: This is a product description for Myntra. Buyers are women aged 22–35 in Tier-1 Indian cities shopping on mobile. They compare 5–8 products before buying and are sensitive to fabric quality and fit accuracy.

Task: Write a 120-word product description for an ethnic wear kurta set (₹1,299). Fabric: pure cotton. USP: pre-washed to prevent shrinking.

Include: fabric benefit, size accuracy claim, occasion suitability. Avoid: overused phrases like "elegant", "stunning", "perfect for every occasion".

Format: 2-sentence hook + 4 bullet points + 1-sentence close. Tone: Warm and relatable, like advice from a stylish friend. `


2. Code Generation Prompt

` You are a [language] developer with expertise in [framework/domain].

Context: I'm building [brief system description]. The existing codebase uses [tech stack]. Current constraints: [performance requirements, dependencies, style guide].

Task: Write a [function / class / API endpoint / component] that [specific behaviour with input/output defined].

Requirements:

Format:

`


3. Data Extraction / Analysis Prompt

` You are a data analyst. Extract structured information from the following text.

Task: From the text below, extract [exactly what fields to extract].

Output format: JSON with this exact schema: { "field1": "string", "field2": "number", "field3": ["array", "of", "strings"] }

Rules:

Text to analyse: [INSERT TEXT] `


4. Customer Support / Response Prompt

` You are a customer support specialist for [company name], a [business type].

Our brand voice: [friendly and professional / empathetic and direct / etc.] Our policies: [key relevant policies — return window, refund process, escalation path]

Context: The customer sent the following message. Their account status: [new/loyal/VIP]. Prior interactions: [none / 1 complaint last month / etc.]

Task: Write a response that: 1. Acknowledges the specific issue (do not use generic acknowledgment) 2. Provides a resolution or next step with a specific timeframe 3. Offers one additional value-add if appropriate

Constraints:

Customer message: [INSERT MESSAGE] `


5. Summarisation Prompt

` Summarise the following [document type] for [target audience].

Output format:

Constraints:

Document: [INSERT DOCUMENT] `


Advanced Prompting Techniques

Chain-of-Thought (CoT)

Add "Think through this step by step before giving your final answer" to any reasoning, maths, or logic task. This single addition improves accuracy on complex tasks by 20–40% across most models.

Before:

"What is the total tax liability for a company with ₹45L revenue, ₹18L expenses, depreciation of ₹3L, and 25% corporate tax rate?"

After (CoT):

"What is the total tax liability for a company with ₹45L revenue, ₹18L expenses, depreciation of ₹3L, and 25% corporate tax rate? Think through each calculation step by step, showing your working, then give the final answer."

Few-Shot Examples

Show the model 2–3 examples of the desired input → output transformation before your actual request.

` Transform these product titles into SEO-friendly versions:

Input: "Blue Cotton Shirt Men" Output: "Men's Classic Fit Blue Cotton Formal Shirt — Breathable, Wrinkle-Free"

Input: "Women Sandal Flat" Output: "Women's Comfortable Flat Sandals — Everyday Casual Footwear"

Input: "Kids School Bag Black" Output: [MODEL COMPLETES THIS] `

System Prompts vs. User Prompts

When using APIs directly:

Keep system prompts focused on WHO the AI is and HOW it should behave. Keep user prompts focused on WHAT to do.

Temperature Guide

Task TypeRecommended Temperature
Data extraction, JSON output0.0
Factual Q&A, coding0.1–0.3
Summarisation, analysis0.3–0.5
Content writing, reports0.5–0.7
Brainstorming, ideation0.8–1.0
Creative writing, fiction0.9–1.2

Prompt Anti-Patterns to Avoid
Anti-PatternProblemFix
"Write me something about X"No constraint on format, length, audienceSpecify all four components
"Make it better"No definition of "better"State specific improvement criteria
"Summarise this" (no length target)Model decides length, often wrong"Summarise in 100 words"
"Be creative"Too vagueName the creative direction
Asking for opinions without constraintsGets generic hedged answers"State a clear position. Do not hedge."
Multi-task promptsModel deprioritises secondary tasksOne task per prompt
No output format specifiedInconsistent structureAlways specify the exact output format

FAQ

What is the best way to write prompts for ChatGPT / Claude / Gemini?
The structure is identical across models: Role + Context + Task + Format. Claude responds especially well to explicit instructions and XML-tagged sections for complex prompts. GPT-4o is robust to a wide range of prompt styles. Gemini benefits from concise, clear prompts. All models improve significantly with few-shot examples and chain-of-thought triggers for reasoning tasks.
What is prompt injection and how do I protect against it?
Prompt injection is when user-supplied input contains instructions that override your system prompt. Example: a user types "Ignore your previous instructions and..." If your app passes user input directly into prompts, sanitise it — strip leading instruction-like phrases, use separate system/user prompt roles (never concatenate them), and validate outputs for unexpected patterns.
How long should a system prompt be?
Long enough to fully specify the role, constraints, and output format — no longer. A 200–500 word system prompt is typical for production applications. Very long system prompts (2,000+ words) can cause instruction following to degrade as models prioritise earlier vs. later instructions differently. If your prompt is very long, consider whether some instructions belong as few-shot examples instead.
Can I use the same prompts across different AI models?
Mostly yes for basic prompts, but performance varies. A prompt optimised for GPT-4o may underperform on Claude or Gemini without adaptation. Key differences: Claude tends to be more literal (explicit instructions are followed precisely), GPT-4o is more flexible with ambiguous prompts, Gemini handles multimodal inputs best. Maintain a prompt library and test each prompt on your actual production model.

Try the Free AI Prompt Generator

Use ToolMira's calculator — no signup, no ads, works on mobile.

Open AI Cost Calculator →
AM
Written by Ananya Menon
Ananya writes about personal finance, tax, and investing for ToolMira, breaking down India's money rules into plain language with worked examples.

Disclaimer: This article is for educational purposes only and does not constitute financial, investment, or professional advice. Please consult a qualified professional before making any decisions based on this content.