1. Zero-shot

Fundamental
When to use: Direct instruction without examples. Fast, works for common tasks. Use when the task is well-defined and the model understands the domain.
Template
Example: Stock Analysis Prompt: "Analyze HDFCBANK.NS (HDFC Bank, India) as an investment for a 5-year horizon. List 3 key risks and 3 opportunities in bullet points."

Model output: โ€ข Risk 1: Interest rate sensitivity... โ€ข Opportunity 1: Digital banking growth...

2. Few-shot

Intermediate
When to use: Provide 2โ€“3 examples of the task, then ask for the same task on new data. Better accuracy than zero-shot for specific formats or tones.
Template
Example: Sentiment Classification Prompt: "Example 1. 'TCS shares jumped 8% on strong Q4 earnings.' โ†’ Sentiment: BULLISH. Example 2. 'RELIANCE.NS falls amid geopolitical tension.' โ†’ Sentiment: BEARISH. Now classify: 'Jumia Kenya reports record GMV growth in logistics.'โ†’ Sentiment:"

Model output: BULLISH

3. Chain-of-Thought (CoT)

Advanced
When to use: Complex reasoning, multi-step logic, or problems requiring arithmetic/planning. Ask the model to "think step by step" or "show your work."
Template
Example: M-Pesa Revenue Projection Prompt: "Safaricom (SAFCOM.NR) reported M-Pesa transaction value of $187B in 2024. Assume 12% YoY growth and 2.5% take rate. What's the projected M-Pesa revenue for 2025? Think step by step."

Model output: "Step 1: 2025 transaction value = $187B ร— 1.12 = $209.4B. Step 2: Revenue = $209.4B ร— 2.5% = $5.235B. Answer: ~$5.2B"

4. Role Prompting

Intermediate
When to use: Frame the model as a specific expert or persona. Improves quality and tone for specialized tasks (analyst, teacher, developer, etc.).
Template
Example: Equity Research Report Prompt: "You are a senior equity analyst at a top Indian brokerage. Write a 3-line investment thesis for RELIANCE.NS (Reliance Industries) based on its energy transition strategy."

Model output: "RELIANCE is pivoting to renewables with $75B capex. Green hydrogen and solar positions strong. BUY for long-term energy exposure."

5. Output Formatting

Essential
When to use: You need structured output (JSON, markdown table, bullet lists). Specify format explicitly; the model will comply.
Template
Example: Stock Comparison Table Prompt: "Compare TCS.NS, HDFCBANK.NS, and RELIANCE.NS. Return as a markdown table with columns: Ticker, Sector, P/E Ratio, Dividend Yield."

Model output: "| Ticker | Sector | P/E | Div Yield |
| TCS.NS | IT | 32.5 | 1.2% |
| HDFCBANK.NS | Finance | 28.0 | 2.3% |"

6. System Prompt Patterns

Advanced
When to use: Set up a consistent persona, constraints, and behavior for multi-turn conversations. System prompts define the "character" of the assistant.
Template (System Prompt)
Example: Finance Bot System prompt: "You are an equity research assistant specializing in African and Indian markets. You only analyze stocks from SAFCOM.NR, HDFCBANK.NS, RELIANCE.NS, TCS.NS, and Jumia Kenya. Always cite data sources. Never provide financial advice; only analysis."

User: "What's TCS.NS's competitive advantage?"
Model: "TCS dominates IT services in India due to its global delivery model, large talent pool, and 1M+ employee base. [Source: Annual Report 2024]"

7. Delimiter Patterns

Intermediate
When to use: Separate different parts of your input (instructions, context, data) using clear delimiters. Reduces confusion and improves accuracy on complex prompts.
Template
Example: Article Analysis Prompt: "===INSTRUCTION=== Extract key financial metrics. ===DATA=== 'Safaricom reported KES 1.2T revenue, M-Pesa GMV up 15% YoY.' ===OUTPUT=== JSON with keys: company, revenue_kes, mpesa_growth. ===QUESTION=== Extract metrics."

Model output: {"company": "Safaricom", "revenue_kes": "1.2T", "mpesa_growth": "15%"}

8. Self-Consistency

Advanced
When to use: Critical decisions or ambiguous questions. Ask the model N times (e.g., 5), collect responses, and take the majority vote for robustness.
Template
Example: Stock Rating Prompt (asked 3 times): "Given RELIANCE.NS's energy transition strategy and current valuation, is it a BUY, HOLD, or SELL for a 2-year horizon? Respond: [BUY / HOLD / SELL]"

Responses: BUY, BUY, HOLD
Consensus: BUY (2 out of 3)

9. ReAct Pattern (Thought/Action/Observation)

Advanced
When to use: Multi-step tasks requiring tool calls, lookups, or external data. Forces explicit reasoning before action and feedback loops.
Template
Example: Investment Decision Prompt: "Should I invest in SAFCOM.NR or HDFCBANK.NS? Use ReAct to reason."

Model output: "Thought: I need current P/E, growth rate, and dividend yield for both. Action: Lookup SAFCOM.NR metrics. Observation: P/E=22, Growth=8%, Div=3.5%. Thought: Now lookup HDFCBANK.NS. Action: Lookup HDFCBANK.NS. Observation: P/E=28, Growth=12%, Div=2.3%. Final Answer: SAFCOM offers higher yield; HDFC offers growth. Choose based on your goals."

10. Structured Extraction

Intermediate
When to use: Parse documents, articles, or data into a fixed schema. Use field definitions (like Pydantic) to enforce structure and types.
Template
Example: Earnings Report Prompt: "Extract: {company (string), ticker (string), revenue_usd_m (float), net_income_usd_m (float), eps (float)}. Text: 'TCS reported Q4 revenue of $8.2B, net income of $1.8B, EPS of $8.50. Ticker: TCS.NS.' Return JSON only."

Model output: {"company": "TCS", "ticker": "TCS.NS", "revenue_usd_m": 8200, "net_income_usd_m": 1800, "eps": 8.50}

11. Guardrail Patterns

Essential
When to use: Safety and reliability. Tell the model what to do if uncertain, what topics to refuse, and how to handle edge cases.
Template
Example: Financial Guardrails Prompt: "Constraints: Never provide personalized financial advice. If asked 'Should I buy X?', respond with 'This depends on your risk profile. Consider consulting a fiduciary.' If data is missing, say 'Data not available.' Question: Is RELIANCE.NS a good buy right now?"

Model output: "This depends on your risk profile, time horizon, and portfolio goals. Consider consulting a fiduciary before investing."

12. Multi-Turn Memory Patterns

Advanced
When to use: Long conversations where context matters. Summarize or "forget" old turns to stay within token limits while preserving key context.
Template (Summarization)
Example: Multi-turn Analysis Turn 1: "Summarize HDFCBANK.NS's strengths."
Turn 2: "Now compare to ICICI Bank on profitability."
Turn 3 (summarization): "Summary: We discussed HDFC's tech advantage and ICICI's cost structure. Now tell me about dividend policy for both."

Model uses prior context without re-asking for the details.**

13. Evaluation Prompts

Advanced
When to use: Grade model outputs, score research, or compare options objectively. Use rubrics and judge prompts.
Template
Example: Investment Thesis Evaluation Prompt: "Evaluate this thesis on Jumia Kenya: 'Jumia is Africa's e-commerce leader with 2M+ orders/month. Growth: 25% YoY. Risks: logistics, competition.' Score on: Accuracy (data verified?), Completeness (risks/upside covered?), Clarity (understandable?), Actionability (guides investment decision?)."

Model evaluation: "Accuracy: 4/5 (data reasonable). Completeness: 3/5 (missing profitability analysis). Clarity: 5/5. Actionability: 4/5."
Africa & India's Best AI Academy
๐Ÿค– AI-first ๐ŸŽ“ Placement Assistance

Ready to go further?

Join the Best AI Program: The AI-Era Agentic Engineer โ€” 5 months, fully online, with placement assistance. Week 1 is free.

Explore The AI-Era Agentic Engineer โ†’