InfraOneInfraOneSchool of AI
Prompt Engineering Techniques: Few-Shot, CoT & More
Generative AI & Agents

Prompt Engineering Techniques: Few-Shot, CoT & More

Jai JhaJai Jha· Updated 25 Nov 2026· 10 min read

Prompt engineering techniques are reusable ways to tell an AI model what to do, what context to use, and how to shape the output. Use this cheat sheet as a fast reference for 2026 work: writing, analysis, automation, coding, data tasks and GenAI workflows in India or anywhere else.

Prompt engineering techniques quick map

Most failures come from using a vague prompt for a task that needs constraints, examples or verification. Start with the task type, then choose the lightest technique that gives reliable results.

prompt technique workflow

Technique

Best for

Core move

Avoid when

Zero-shot

Simple known tasks

Ask directly

Output must match strict style

Few-shot

Pattern matching

Show examples

Examples are poor or biased

Chain-of-thought

Multi-step reasoning

Ask for stepwise thinking

Sensitive tasks needing concise answer only

Role prompting

Domain tone

Assign a role

Role is vague or fake authority

Constraint prompting

Format control

Set rules

Rules conflict

Context prompting

Grounded tasks

Provide source material

Context is too long or stale

RAG prompting

Knowledge retrieval

Use fetched documents

Retrieval quality is weak

Self-critique

Quality checks

Ask model to review

Review criteria are unclear

Tool prompting

Automation

Let model call tools

Tool permissions are unsafe

If you are new to the foundations, read what generative AI is and how it works before using advanced patterns.

Prompt structure for beginners

A reliable prompt usually has five blocks: role, task, context, constraints and output format. You do not need all five every time, but missing context and missing format are the two most common reasons prompts fail.

Block

What it does

Example phrase

Role

Sets viewpoint

Act as a data analyst

Task

Defines action

Summarise this sales report

Context

Adds source facts

Use only the notes below

Constraints

Limits scope

Keep it under 120 words

Format

Controls shape

Return a 3-column table

Act as a data analyst.
Task: Find the top three risks in the project note below.
Context: Paste the note here.
Constraints: Do not add facts not present in the note.
Output: Return a table with Risk, Evidence and Mitigation.

One-line explanation: this format separates intent from evidence and reduces accidental assumptions.

Zero-shot prompting

Zero-shot prompting means asking the model to perform a task without showing examples. Use it when the task is common, the expected answer is flexible, and mistakes are easy to detect.

Use case

Prompt pattern

Output risk

Summarisation

Summarise the text in 5 bullets

Missing nuance

Rewriting

Rewrite for a CXO audience

Tone drift

Classification

Label as positive, neutral or negative

Borderline cases

Extraction

Extract names, dates and actions

Missed fields

Classify the customer message as Positive, Neutral or Negative.
Return only one label.
Message: The delivery was late, but support resolved the refund quickly.

One-line explanation: zero-shot works best when labels and output rules are simple.

Few-shot prompting

Few-shot prompting gives the model two to five examples before the actual task. This is one of the most useful prompt engineering techniques when you need a specific tone, format, classification style or transformation pattern.

Good examples

Bad examples

Short and consistent

Long and inconsistent

Cover edge cases

Repeat the same case

Match final task

Use unrelated domains

Show exact format

Explain too much

Convert user requests into intent labels.

Example 1
User: I forgot my password.
Intent: account_recovery

Example 2
User: Where is my invoice for March?
Intent: billing_document

Example 3
User: Please cancel my subscription today.
Intent: cancellation

Now classify:
User: I cannot log in after changing my phone.
Intent:

One-line explanation: few-shot examples teach the pattern better than a long instruction.

Chain-of-thought prompting

Chain-of-thought, often shortened to CoT, asks the model to reason through intermediate steps. Use it for planning, maths, diagnosis, comparisons and logic-heavy work, but keep sensitive or customer-facing outputs concise.

Variant

When to use

Prompt phrase

Stepwise reasoning

Complex analysis

Think step by step

Hidden reasoning summary

Production answers

Briefly explain the rationale

Plan then answer

Strategy tasks

First make a plan, then answer

Check assumptions

Ambiguous tasks

List assumptions before solving

A team has 6 analysts. Each analyst reviews 14 tickets per day.
Demand is 480 tickets per week. Assume 5 working days.
Calculate whether the team has enough capacity.
Show the calculation, then give the final answer in one sentence.

One-line explanation: CoT improves reasoning tasks by forcing structure around intermediate work.

For a deeper business view, see the purpose of prompt engineering in real AI systems.

Role prompting

Role prompting gives the model a professional lens, but it should not replace facts, credentials or verification. A strong role is specific about responsibility, not just seniority.

Weak role

Better role

Act as an expert

Act as a B2B SaaS product marketer

Be a lawyer

Review this clause for commercial risk, not legal advice

Be a teacher

Explain to first-year engineering students

Be creative

Generate 10 campaign angles for Indian SMBs

Act as a senior data analyst explaining findings to a non-technical operations manager.
Use simple language, avoid jargon and focus on decisions.
Input: Paste dashboard observations here.

One-line explanation: role prompting is strongest when it defines audience and decision context.

Constraint prompting

Constraints turn a broad answer into a usable answer. They are essential when output must fit a UI, a report template, a JSON schema, a brand voice or an approval process.

Constraint type

Example

Length

Maximum 80 words

Style

Plain English, no jargon

Scope

Use only the pasted policy

Format

Return valid JSON only

Exclusion

Do not include recommendations

Rewrite the paragraph for a mobile app notification.
Constraints:
- Maximum 18 words
- Friendly but not promotional
- No exclamation marks
- Mention the deadline
Paragraph: Paste text here.

One-line explanation: constraints prevent over-generation and make outputs easier to use directly.

Context and grounding prompts

Context prompting tells the model what information to rely on. This matters for company policies, meeting notes, customer histories, research snippets and any task where hallucination is costly.

grounded prompting with documents

Context rule

Why it helps

Put source text after instructions

Keeps task clear

Use delimiters

Separates prompt from source

Ask for citations to sections

Improves auditability

Say what to do if missing

Reduces guessing

Answer the question using only the source between the delimiters.
If the answer is not present, say: Not found in the provided source.

Question: What is the refund window?

Source:
---
Paste policy text here.
---

One-line explanation: grounding is the simplest way to reduce unsupported claims.

Retrieval augmented generation prompts

RAG prompts combine retrieval with generation. The model receives chunks from documents, then answers using those chunks instead of relying only on training data.

RAG prompt part

Purpose

User question

Defines need

Retrieved context

Supplies evidence

Ranking instruction

Prioritises relevant chunks

Refusal rule

Handles missing evidence

Citation request

Supports checking

Use the retrieved passages to answer the user question.
Rules:
- Prefer the most relevant passage.
- Do not use outside knowledge.
- Cite passage IDs used.
- If passages conflict, mention the conflict.

User question: Paste question here.
Retrieved passages: Paste passages here.

One-line explanation: RAG prompts are only as good as the retrieval and chunk quality behind them.

Output formatting prompts

Formatting prompts make the result machine-readable or presentation-ready. Use them when the next step is a spreadsheet, API call, dashboard, ticketing system or document template.

Format

Best for

Prompt rule

Table

Comparison

Use 3 columns only

JSON

Automation

Return valid JSON only

Bullets

Briefing

5 bullets maximum

Email

Communication

Include subject and body

CSV

Data transfer

No extra commentary

Extract the following fields from the email:
- customer_name
- company
- issue_type
- urgency

Return valid JSON only. Use null if a field is missing.
Email: Paste email here.

One-line explanation: structured output reduces manual cleanup and makes automation safer.

import json

raw = '''{"customer_name": "Asha", "company": "Kite Retail", "issue_type": "refund", "urgency": "high"}'''
data = json.loads(raw)
print(data['urgency'])

One-line explanation: if your workflow parses model output, validate the format before using it downstream.

Self-critique and refinement prompts

Self-critique asks the model to review an answer against criteria, then improve it. It is useful for quality checks, but it should not be treated as independent verification.

Review criterion

Good prompt line

Accuracy

Identify unsupported claims

Completeness

List missing user requirements

Clarity

Flag vague or confusing sentences

Compliance

Check against the rules below

Tone

Compare with the target audience

Review the draft below against these criteria:
1. Uses only the provided facts
2. Gives a clear recommendation
3. Avoids jargon
4. Stays under 150 words

Return:
- Issues found
- Revised version

Draft: Paste draft here.
Facts: Paste facts here.

One-line explanation: critique prompts work best when the scoring criteria are explicit.

Decomposition prompts

Decomposition breaks a large task into smaller steps. Use it when one prompt would otherwise mix research, reasoning, drafting and formatting.

task decomposition workflow

Large task

Better decomposition

Create a strategy

Goals, audience, constraints, options, recommendation

Analyse feedback

Themes, evidence, severity, actions

Write a report

Outline, draft, review, final

Build an automation

Trigger, inputs, logic, errors, output

Break this task into a 5-step workflow before doing it.
For each step, mention the input needed and the output produced.
Task: Create a monthly customer support insights report from ticket notes.

One-line explanation: decomposition improves control because each subtask can be reviewed separately.

Prompt chaining for workflows

Prompt chaining uses multiple prompts in sequence. It is more reliable than asking for everything in one giant prompt, especially in business workflows.

Chain stage

Example output

Extract

Key facts from source

Classify

Category or priority

Analyse

Pattern or implication

Draft

Message or report

Verify

Issues and corrections

Step 1: Extract all customer complaints from the transcript.
Step 2: Group complaints by theme.
Step 3: Rank themes by business impact.
Step 4: Draft a short action memo for the operations head.

One-line explanation: chained prompts make intermediate outputs visible and easier to fix.

If you want to practise these workflows with projects, explore InfraOne's GenAI Bootcamp for applied AI skills.

Tool-use and automation prompts

Tool-use prompting tells the model when and how to use external functions, APIs, databases or scripts. The key is to define permissions, inputs, stopping conditions and error handling.

Tool rule

Example

Permission

Ask before sending email

Input check

Confirm required fields

Error handling

If API fails, return error summary

Safety

Never expose tokens

Logging

Summarise actions taken

You can use the calendar tool only to check availability.
Do not create or edit events.
Find three 30-minute slots next week between 10 AM and 4 PM.
If the calendar is unavailable, say what information is missing.

One-line explanation: automation prompts must limit action, not just request action.

India 2026 use cases

In India, 2026 prompt work is likely to sit inside multilingual support, sales operations, education, analytics, hiring workflows and small-business automation. The practical challenge is not just English prompting; it is context, policy fit, language switching and verification.

Use case

Prompt technique to start with

Customer support in mixed Hindi-English

Few-shot plus constraints

Sales call summarisation

Context plus structured output

Policy Q&A for employees

RAG plus refusal rule

Analytics explanation

Role plus decomposition

Training content

Audience role plus examples

Resume screening assistance

Criteria plus self-critique

Summarise this Hinglish customer chat for a support manager.
Return:
- Main issue
- Customer sentiment
- Action needed
- Exact phrases that show urgency
Do not translate names, product IDs or ticket numbers.
Chat: Paste chat here.

One-line explanation: local context often matters more than adding more examples.

Debugging prompts

When a prompt fails, change one variable at a time. Do not keep adding instructions blindly; that creates conflicts and makes the prompt harder to maintain.

Symptom

Likely cause

Fix

Too generic

Weak context

Add source details

Wrong format

No schema

Specify exact output

Hallucination

Ungrounded task

Add source-only rule

Verbose answer

No length limit

Add word or bullet limit

Missed edge cases

Poor examples

Add contrasting examples

Inconsistent results

Ambiguous task

Define labels and criteria

The previous answer did not follow the requested table format.
Redo the task.
Return exactly 4 rows and 3 columns: Problem, Evidence, Fix.
Do not include any text before or after the table.

One-line explanation: debugging prompts should state the failure and the corrected rule.

Copy-ready prompt templates

Use these templates as starting points, not as universal scripts. Replace vague nouns like output, audience and context with real project details.

Template

Use it for

Role plus task

Advisory outputs

Source-only answer

Grounded Q&A

Few-shot classifier

Labels and routing

Extract to JSON

Automation

Review and revise

Quality improvement

Act as [role] for [audience].
Your task is to [task].
Use this context: [context].
Constraints: [constraints].
Return the answer as [format].

One-line explanation: this is the default prompt skeleton for most business tasks.

Use only the source below to answer.
If the answer is missing, say you cannot determine it from the source.
Question: [question]
Source: [source]

One-line explanation: use this when accuracy matters more than creativity.

Classify the input into one of these labels: [labels].
Definitions:
[label 1]: [definition]
[label 2]: [definition]
Examples:
[input] -> [label]
Now classify: [new input]

One-line explanation: label definitions plus examples reduce classification drift.

Next step

Pick three prompt engineering techniques from this cheat sheet and test them on the same task: zero-shot, few-shot and context-grounded prompting. Compare the outputs for accuracy, format control and effort required, then keep the simplest prompt that reliably works.

Frequently asked questions

Which prompt engineering technique should I learn first?

Start with clear task framing, constraints and output formatting. Once those are comfortable, move to few-shot prompting because it quickly improves tone, classification and structured outputs.

Is chain-of-thought always better than a direct prompt?

No. Chain-of-thought is useful for reasoning-heavy work, but it can be unnecessary for simple extraction, rewriting or classification. For production responses, ask for a concise rationale rather than a long reasoning trace.

How many examples should a few-shot prompt include?

Use enough examples to show the pattern and edge cases, usually two to five for many practical tasks. More examples are not automatically better if they are repetitive, inconsistent or too long.

Do prompt engineering skills still matter with newer AI models?

Yes. Better models reduce some basic prompting effort, but real work still needs context, constraints, evaluation and workflow design. Prompting becomes less about tricks and more about clear task design.

Can prompt engineering help non-technical teams in India?

Yes. Sales, support, HR, education and operations teams can use prompt patterns for summaries, drafting, analysis and multilingual workflows. The main requirement is careful review when outputs affect customers, compliance or business decisions.

Share this article
XLinkedInWhatsApp

Related reads