๐Ÿช Prompt Engineering Exercise 1: Merchant Risk Assessment Narrative

Evolve a basic prompt into a production-grade, reusable template for generating merchant risk assessments โ€” through iterative prompt engineering.

โฑ 40 minutes

Exercise Overview

AnyCompany's risk teams assess thousands of merchants across Southeast Asia. Each assessment requires analyzing transaction data, chargeback rates, complaint history, and compliance status โ€” then writing a clear narrative that non-technical stakeholders can act on.

Currently, analysts spend 30-45 minutes per merchant writing these manually. In this exercise, you'll build a prompt template that produces consistent, high-quality assessments in seconds.

โš™๏ธ Setup: How to run this exercise

Use Kiro chat for this exercise. You'll paste prompts into the chat panel and observe how the AI responds differently as you refine your prompt technique.

Session management:
  • Steps 1โ€“5: Start a New Session for each step (to isolate the impact of each technique)
  • Step 6: Continue in the same session as Step 5 (the model needs the context to extract the template)
  • Step 7: Start a New Session (to test the template cold, like a real user would)
๐ŸŽฏ Exercise Approach

In this exercise, you'll iteratively refine a prompt through 6 steps โ€” each applying a specific technique from the Advanced Prompting curriculum. At the end, you'll extract a reusable prompt template with variables, then test it against a completely different merchant profile to validate that it works at scale. The final deliverable is a production-ready prompt template that your team can deploy across thousands of merchant assessments.

Techniques You'll Practice

StepPrompting TechniqueCurriculum ReferenceDuration
Step 1Zero-Shot BaselineModule 1: Prompt Fundamentals3 min
Step 2Role & Persona PromptingModule 3: Role & Persona4 min
Step 3Few-Shot PromptingModule 1: Few-Shot vs Zero-Shot5 min
Step 4Structured Output (JSON/Sections)Module 4: Structured Outputs5 min
Step 5RAG Grounding + Self-CritiqueModule 5: RAG Patterns + Module 5.1: Self-Critique5 min
Step 6Template Extraction (Meta-Prompting)Module 5.2: Meta-Prompting8 min
Step 7Template Validation (New Data)Production Testing5 min

Sample Merchant Data

You'll use this data throughout all 6 steps. Copy it once โ€” you'll paste it into each prompt.

MERCHANT DATA โ€” Copy this for use in all steps
MERCHANT PROFILE: QuickMart Express (ID: MRC-2847) Market: Singapore Category: Convenience Store / Mini-Mart Onboarded: March 2023 Payment channels: GrabPay, PayLater TRANSACTION DATA (Last 6 months): - Monthly transaction volume: 4,200 โ†’ 4,800 โ†’ 5,100 โ†’ 8,900 โ†’ 12,400 โ†’ 15,600 - Monthly GMV (SGD): $42,000 โ†’ $48,000 โ†’ $51,000 โ†’ $89,000 โ†’ $124,000 โ†’ $156,000 - Average transaction size: $10.00 โ†’ $10.00 โ†’ $10.00 โ†’ $10.00 โ†’ $10.00 โ†’ $10.00 - PayLater adoption rate: 8% โ†’ 12% โ†’ 15% โ†’ 22% โ†’ 35% โ†’ 48% CHARGEBACK DATA: - Chargeback rate (last 6 months): 0.3% โ†’ 0.4% โ†’ 0.5% โ†’ 1.2% โ†’ 2.8% โ†’ 4.1% - Industry benchmark: 0.5% - 1.0% - Chargeback reasons: "Item not received" (45%), "Unauthorized transaction" (30%), "Item not as described" (25%) - Dispute resolution rate: 62% (industry avg: 78%) COMPLAINT DATA: - Customer complaints (monthly): 3 โ†’ 5 โ†’ 4 โ†’ 12 โ†’ 28 โ†’ 45 - Top complaint: "Charged but order not fulfilled" (60%) - Response time: 72 hours average (SLA: 24 hours) COMPLIANCE STATUS: - KYC: Verified (last updated: Jan 2025) - Business registration: Active - Beneficial owner: Tan Wei Ming (Singapore PR) - Related merchants: None flagged - Previous risk flags: None prior to Month 4 ADDITIONAL CONTEXT: - Merchant opened 2 new outlet locations in Month 4 and Month 5 - Hired 15 new part-time staff in last 3 months - Recently started accepting PayLater for transactions under $5 (previously $10 minimum)

Step 1: Zero-Shot Baseline

๐Ÿ“– Technique: Zero-Shot Prompting (Module 1: Prompt Fundamentals)

Zero-shot means giving the model a task with no examples, no role, and minimal instruction. This establishes a baseline โ€” you'll see what the model produces with almost no guidance, then improve from there.

In the Kiro chat panel, start a New Session and paste the merchant data above, then add this simple instruction:

PROMPT โ€” Step 1: Zero-Shot
Assess the risk of this merchant based on the data below. [PASTE MERCHANT DATA HERE]
๐Ÿ” Observe the output: The response is likely generic, unstructured, and missing key analysis. It may hallucinate details not in the data. Note what's missing โ€” this is your improvement baseline.
๐Ÿ’ฌ Discussion point: What's wrong with this output? Common issues:
  • No clear structure โ€” hard to scan quickly
  • May include assumptions not supported by the data
  • No risk rating or actionable recommendation
  • Inconsistent depth โ€” some areas over-analyzed, others ignored
  • Would look different every time you run it โ€” not repeatable

Step 2: Add Role & Persona

๐Ÿ“– Technique: Role & Persona Prompting (Module 3)

Assigning a specific role shapes the model's vocabulary, reasoning depth, and what it considers important. A "risk analyst" will focus on different signals than a "customer support agent" looking at the same data.

Start a New Session in Kiro. This time, add a persona before the task:

PROMPT โ€” Step 2: Persona
You are a Senior Merchant Risk Analyst at a Southeast Asian fintech company. You have 8 years of experience assessing payment merchants for fraud risk, operational risk, and compliance risk. You are known for being thorough, data-driven, and fair โ€” you always distinguish between genuine business growth and suspicious patterns. Assess the risk of this merchant based on the data below. [PASTE MERCHANT DATA HERE]
๐Ÿ” Compare with Step 1: The vocabulary should be more professional. The analysis should be deeper โ€” the model now "thinks like" a risk analyst. But the output is still unstructured and the format varies each time.
๐Ÿ’ฌ Why does persona work? The model has been trained on millions of documents written by risk analysts. When you say "You are a Senior Merchant Risk Analyst," you're activating that specific knowledge cluster โ€” the model draws on risk assessment frameworks, industry terminology, and analytical patterns it learned from real analyst writing.

Step 3: Add Few-Shot Examples

๐Ÿ“– Technique: Few-Shot Prompting (Module 1)

Providing 1-2 examples of the desired output teaches the model your exact format, tone, and level of detail. This is the single most effective technique for getting consistent, repeatable outputs.

Start a New Session in Kiro. Now include two short example assessments before the actual task:

PROMPT โ€” Step 3: Few-Shot
You are a Senior Merchant Risk Analyst at a Southeast Asian fintech company. You have 8 years of experience assessing payment merchants for fraud risk, operational risk, and compliance risk. Here are two examples of how merchant risk assessments should be written: --- EXAMPLE 1 (LOW RISK): Merchant: FreshDaily Grocers (MRC-1102) | Market: Malaysia | Category: Grocery Assessment: FreshDaily Grocers demonstrates a healthy, stable transaction profile. Monthly volumes have grown steadily at 8-10% month-over-month, consistent with organic business expansion. Chargeback rate of 0.4% is well within the industry benchmark of 0.5-1.0%. Customer complaints are minimal (2-3/month) and resolved within SLA. KYC documentation is current and no compliance flags exist. Risk Rating: ๐ŸŸข GREEN โ€” No action required. Next review in 6 months. --- EXAMPLE 2 (HIGH RISK): Merchant: LuxeDeals Online (MRC-3391) | Market: Indonesia | Category: E-Commerce Assessment: LuxeDeals Online presents significant risk indicators requiring immediate attention. Transaction volume spiked 400% in one month with no corresponding business explanation. Chargeback rate has reached 6.2%, far exceeding the 1.0% industry benchmark. 70% of chargebacks cite "unauthorized transaction," suggesting potential card-testing or account takeover fraud. The merchant has not responded to two compliance review requests. Risk Rating: ๐Ÿ”ด RED โ€” Recommend immediate PayLater suspension and enhanced monitoring. Escalate to Fraud Investigation team. --- Now assess this merchant using the same format and depth: [PASTE MERCHANT DATA HERE]
๐Ÿ” Compare with Step 2: The output should now match the format of your examples โ€” same structure, similar length, consistent tone. The model learned your "house style" from just 2 examples.
๐Ÿ’ฌ Key insight: Few-shot examples are like showing a new analyst "here's how we write these reports." The model mimics the pattern. Notice how 2 examples (one GREEN, one RED) are enough โ€” the model interpolates for AMBER cases on its own.

Step 4: Add Structured Output Requirements

๐Ÿ“– Technique: Structured Output (Module 4)

Defining exact sections and format ensures every assessment covers the same areas. This makes outputs comparable across merchants and scannable by busy stakeholders.

Start a New Session in Kiro. Now add explicit section requirements:

PROMPT โ€” Step 4: Structured Output
You are a Senior Merchant Risk Analyst at a Southeast Asian fintech company with 8 years of experience in payment merchant risk assessment. Produce a Merchant Risk Assessment Report with EXACTLY these sections: 1. MERCHANT SUMMARY - One paragraph: who they are, what they do, how long on platform 2. TRANSACTION ANALYSIS - Volume and GMV trends (highlight any anomalies) - Average transaction size analysis - PayLater adoption trends and risk implications 3. CHARGEBACK & DISPUTE ANALYSIS - Current rate vs. industry benchmark - Trend direction (improving/worsening) - Root cause breakdown - Dispute resolution effectiveness 4. CUSTOMER COMPLAINT ANALYSIS - Volume trend and top categories - SLA compliance - Correlation with chargeback patterns 5. RISK FACTORS - List each identified risk factor - For each: severity (HIGH/MEDIUM/LOW) and supporting data point 6. MITIGATING FACTORS - Any legitimate business explanations for the patterns observed 7. RISK RATING - ๐ŸŸข GREEN (low risk) | ๐ŸŸก AMBER (elevated, monitor) | ๐Ÿ”ด RED (high, action required) - One-sentence justification 8. RECOMMENDED ACTIONS - Numbered list of specific, actionable next steps with owners and timelines [PASTE MERCHANT DATA HERE]
๐Ÿ” Compare with Step 3: Every assessment now has the same 8 sections. You can compare Merchant A vs Merchant B side by side. Stakeholders know exactly where to look for the information they need.

Step 5: Add RAG Grounding + Self-Critique

๐Ÿ“– Technique: RAG Grounding + Self-Critique (Module 5)

Grounding instructions prevent the model from hallucinating facts not in the data. Self-critique makes the model review its own output for errors, bias, or unsupported claims โ€” like having a second analyst review the report.

Start a New Session in Kiro. Add grounding rules and a self-review step:

PROMPT โ€” Step 5: Grounding + Self-Critique
You are a Senior Merchant Risk Analyst at a Southeast Asian fintech company with 8 years of experience in payment merchant risk assessment. CRITICAL GROUNDING RULES: - Base your assessment ONLY on the data provided below. Do not infer, assume, or add information not present in the data. - Every claim must reference a specific data point. Example: "Chargeback rate increased from 0.3% to 4.1% over 6 months" โ€” not "chargebacks are high." - If data is insufficient to assess an area, explicitly state: "[INSUFFICIENT DATA: need X to assess Y]" - Do not speculate on intent or motivation. State patterns, not judgments about the merchant's character. - Distinguish between correlation and causation. If two trends coincide, note the correlation but do not claim one caused the other. Produce a Merchant Risk Assessment Report with these sections: 1. MERCHANT SUMMARY 2. TRANSACTION ANALYSIS 3. CHARGEBACK & DISPUTE ANALYSIS 4. CUSTOMER COMPLAINT ANALYSIS 5. RISK FACTORS (each with severity and supporting data point) 6. MITIGATING FACTORS 7. RISK RATING (GREEN / AMBER / RED with justification) 8. RECOMMENDED ACTIONS (numbered, with owners and timelines) After completing the report, perform a SELF-REVIEW: - Re-read your assessment and check: Is every claim supported by a specific data point from the input? - Are there any assumptions or inferences that go beyond the data? - Is the risk rating consistent with the evidence presented? - Would a different analyst reading the same data reach the same conclusion? If you find any issues, correct them before presenting the final report. [PASTE MERCHANT DATA HERE]
๐Ÿ” Compare with Step 4: The output should now cite specific numbers for every claim. The self-review section catches errors the model might have made. This is production-safe โ€” auditable and defensible.
๐Ÿ’ฌ Why self-critique matters for risk assessments: In regulated environments, every assessment may be audited. A report that says "chargebacks are concerning" is useless. A report that says "chargeback rate increased from 0.3% to 4.1% over 6 months, exceeding the 1.0% industry benchmark by 4x" is auditable. The grounding rules + self-critique ensure this level of rigor automatically.

Step 6: Extract the Reusable Template

๐Ÿ“– Technique: Meta-Prompting (Module 5.2)

Meta-prompting asks the AI to analyze your conversation and produce a reusable artifact. Instead of manually extracting the template, you ask the model to do it โ€” turning your iterative work into a production-ready template with variables.

In the same session from Step 5 (do not start a new one), paste this follow-up:

PROMPT โ€” Step 6: Template Extraction
Excellent work. Now I want to turn this into a reusable template that any analyst on my team can use for ANY merchant โ€” not just QuickMart Express. Create a Markdown file called "merchant-risk-assessment-prompt-template.md" and save it in a "prompt-templates" folder. The file should contain a complete, self-contained prompt template with the following structure: ## HEADER - Title: "Merchant Risk Assessment โ€” Prompt Template" - Version number, last updated date, purpose statement - Brief usage instruction: copy from ---START PROMPT--- to ---END PROMPT---, replace variables, paste into LLM ## TEMPLATE USAGE GUIDE A table with ALL variables used in the template. Columns: | Variable | Description | Expected Format | Example | Include every variable: {{merchant_name}}, {{merchant_id}}, {{market}}, {{merchant_category}}, {{onboarded_date}}, {{payment_channels}}, {{beneficial_owner}}, {{related_merchants}}, {{kyc_status}}, {{business_registration_status}}, {{analysis_period}}, {{transaction_data}}, {{chargeback_data}}, {{industry_chargeback_benchmark}}, {{complaint_data}}, {{complaint_sla}}, {{compliance_status}}, {{additional_context}}, {{currency}} ## DATA FORMAT EXAMPLES Show the exact format expected for each complex variable (transaction_data, chargeback_data, complaint_data, compliance_status, additional_context) with realistic sample data. ## PREREQUISITES Numbered list of what to prepare before using the template. ## ---START PROMPT--- / ---END PROMPT--- The actual prompt template containing: - The persona we refined - The grounding rules from Step 5 - The 8-section output format from Step 4 - Risk rating definitions (GREEN/AMBER/RED with specific criteria) - The self-review instructions from Step 5 - A MERCHANT DATA INPUT block at the end with all {{variables}} organized by category ## CUSTOMIZATION NOTES (after ---END PROMPT---) Three subsections: 1. **Market-Specific Adjustments** โ€” Table of SEA markets (Singapore/MAS, Malaysia/BNM, Indonesia/OJK, Thailand/BOT, Vietnam/SBV, Philippines/BSP) with key regulatory considerations. Include a snippet showing how to add a regulatory compliance section to the output format. 2. **Adjusting Risk Thresholds by Merchant Category** โ€” Table of categories (Convenience, E-commerce, F&B, Digital Goods, Travel, Subscription) with typical chargeback benchmarks. 3. **Modifiable Sections** โ€” Table showing which parts of the template can/cannot be modified and why. Grounding rules and self-review should be marked as "Do not modify." The template must be self-contained โ€” a new team member should be able to use it without any additional context or training.
โœ… Final deliverable: Kiro will create a prompt-templates/merchant-risk-assessment-prompt-template.md file. This is your production-ready, reusable artifact.

What Your Template Should Include

The generated template should contain these key sections:

SectionPurpose
Header & Usage InstructionsVersion, purpose, how to use the template
Variable Reference TableEvery {{variable}} with description, format, and example
Data Format ExamplesExact format for complex inputs (transaction data, chargebacks, etc.)
PrerequisitesWhat to prepare before running the template
---START PROMPT--- to ---END PROMPT---The actual prompt: persona + grounding rules + 8 sections + self-review
Market-Specific AdjustmentsRegulatory table (MAS, BNM, OJK, BOT, SBV, BSP)
Category Risk ThresholdsChargeback benchmarks by merchant type
Modifiable Sections GuideWhat can/cannot be changed and why

A reference example of the expected output is available at reference/merchant-risk-assessment-prompt-template.md in the workshop files.

Step 7: Validate the Template with New Data

๐Ÿ“– Technique: Production Testing

A template is only useful if it works beyond the data it was built with. In this step, you'll test your template against a completely different merchant profile โ€” different market, different category, different risk pattern โ€” to validate that it generalizes.

Start a New Session in Kiro (this simulates a real user picking up your template for the first time). Paste your template from Step 6, then fill in the variables with this new merchant data:

TEST DATA โ€” Different merchant for validation
MERCHANT PROFILE: WarungMakan Digital (ID: MRC-5521) Market: Indonesia Category: Food & Beverage / Cloud Kitchen Onboarded: November 2024 Payment channels: AnyCompany Wallet, PayLater TRANSACTION DATA (Last 6 months): - Monthly transaction volume: 800 โ†’ 1,200 โ†’ 1,800 โ†’ 2,100 โ†’ 2,400 โ†’ 2,600 - Monthly GMV (IDR): 24M โ†’ 36M โ†’ 54M โ†’ 63M โ†’ 72M โ†’ 78M - Average transaction size: IDR 30,000 (~$2.80 SGD) - PayLater adoption rate: 5% โ†’ 8% โ†’ 10% โ†’ 12% โ†’ 14% โ†’ 15% CHARGEBACK DATA: - Chargeback rate (last 6 months): 0.1% โ†’ 0.2% โ†’ 0.2% โ†’ 0.3% โ†’ 0.3% โ†’ 0.4% - Industry benchmark (F&B Indonesia): 0.3% - 0.8% - Chargeback reasons: "Order not received" (70%), "Wrong item" (20%), "Double charge" (10%) - Dispute resolution rate: 85% (industry avg: 78%) COMPLAINT DATA: - Customer complaints (monthly): 2 โ†’ 3 โ†’ 4 โ†’ 5 โ†’ 5 โ†’ 6 - Top complaint: "Late delivery during peak hours" (55%) - Response time: 18 hours average (SLA: 24 hours) COMPLIANCE STATUS: - KYC: Verified (last updated: March 2025) - Business registration: Active (PT WarungMakan Digital Indonesia) - Beneficial owner: Budi Santoso (Indonesian citizen) - Related merchants: 1 related entity โ€” WarungMakan Catering (MRC-5522, active, no flags) - Previous risk flags: None ADDITIONAL CONTEXT: - Merchant participates in AnyCompany's "Go Digital" small business program - Recently integrated with 3 food delivery platforms - Seasonal volume spike expected during Ramadan (March-April)

Paste your template from Step 6 into a New Session, replace the {{variables}} with this data, and run it.

๐Ÿ” Validate the output: Does the template produce a well-structured assessment for this very different merchant? Check:
  • Are all 8 sections populated correctly?
  • Does it handle IDR currency (not just SGD)?
  • Does it correctly identify this as a low-risk merchant?
  • Are the recommended actions appropriate for a healthy F&B merchant in Indonesia?
  • Does it reference the OJK (Indonesia's regulator) instead of MAS?
๐Ÿ’ฌ If the template doesn't work well: That's valuable feedback. Go back to Step 6 and refine the template โ€” maybe it needs a {{currency}} variable, or the regulatory section needs to be market-aware. This iterate-and-test cycle is exactly how production prompt templates are developed.

Reflection & Discussion

What You Built

Through 6 iterative steps, you evolved a 10-word prompt into a production-grade template that:

Technique Recap

StepTechniqueWhat It Fixed
1. Zero-ShotBaselineEstablished what "bad" looks like
2. PersonaRole assignmentBetter vocabulary, deeper analysis
3. Few-ShotExample-drivenConsistent format and tone
4. StructuredSection requirementsComparable, scannable outputs
5. GroundingRAG + Self-CritiqueNo hallucination, auditable claims
6. Meta-PromptTemplate extractionReusable at scale
7. ValidationTest with new dataConfirmed template generalizes
๐Ÿ’ก Key takeaway: The prompt IS the product. In many business workflows, you don't need to build software โ€” you need to build a great prompt template. A well-engineered template that takes 35 minutes to create can save your team hundreds of hours per month when deployed across thousands of merchant assessments.

Try It Yourself

To validate your template, try it with a completely different merchant profile โ€” a high-volume e-commerce merchant in Indonesia, or a small food stall in Thailand. Does the template still produce a useful assessment? If not, what needs adjusting?

What You Accomplished

  • ๐Ÿ“ Applied 6 advanced prompting techniques in a real business context
  • ๐Ÿ”„ Experienced iterative prompt refinement โ€” the core skill of prompt engineering
  • ๐Ÿ“‹ Produced a reusable, production-grade prompt template with variables
  • ๐Ÿ” Learned to ground AI outputs in data and add self-critique for quality assurance
  • ๐Ÿ—๏ธ Built an artifact your team can deploy immediately for merchant risk assessments