Day 3: Prompt Engineering Warm-Up

A short, hands-on introduction to prompting AI well — before you open RStudio

Author
JP Adjadeh
Published
July 30, 2026

1. Introduction


You'll be prompting AI constantly today — for R code, for debugging help, for explanations of error messages. This short warm-up covers the one skill that determines whether that goes well: writing prompts that actually give the model what it needs. AI is a fast collaborator, not a source of truth — every section below builds toward a habit of verification that you should carry into RStudio right after this.

2. Human in the Loop: Why You Always Verify


AI models are fluent, not necessarily correct. A model can produce a confident, well-formatted answer that is factually wrong — a plausible-looking but incorrect statistic, code that runs without error but does the wrong thing. Nothing about how polished the output looks tells you whether it's accurate.

This is the idea of human in the loop: the model generates, but a person checks. That responsibility stays with you today, whether you're refining a prompt or asking AI to write a line of R.

⚠ The One Rule
Never run or trust AI output you have not personally checked. If you can't verify it, don't rely on it yet.

3. What Makes a Good Prompt


Compare these two prompts. Both were given to the same model.

Weak prompt

"I need to understand American democracy for a paper I'm writing."

Strong prompt

"You are a PhD student studying comparative political institutions. Explain, in plain terms, how democratic accountability works in the United States, focusing on the checks between the executive and legislative branches. Bullet points, under 150 words, written for an undergraduate audience."

The weak prompt sounds like it has context — "a paper I'm writing" — but tells the model nothing about the argument, the angle, or what "understand" should actually produce. The strong prompt succeeds because it supplies five things the model cannot guess on its own:

R–T–C–F–E

Same Problem, Your Field

Each of these has the same gaps as the example above — "my data," "my research," "my paper" are gestured at but never actually described:

GIS"I have some GIS data on land use — what should I do with it?"
Criminology"I'm looking at crime data for my research — what does the data say?"
Economics"I found this economic trend in my data — what does it mean?"
Political Science"I need some background on political institutions for my paper."
⚠ Exercise 1
Find the card above closest to your discipline. Run the weak version first and see what you get. Then rebuild it using R–T–C–F–E, swapping in your own real topic, and run it again. Note which single addition changed the output the most.

Check your rebuild against a model answer for each discipline:

GIS — reveal the rebuilt version
Before

"I have some GIS data on land use — what should I do with it?"

After

"You are a PhD student using GIS to study land-use change. I have parcel-level land-use data for a mid-sized U.S. county from 2010–2020. Suggest three exploratory analyses that could reveal patterns of urban sprawl, and briefly explain what each would show. Bullet points, under 200 words."

Criminology — reveal the rebuilt version
Before

"I'm looking at crime data for my research — what does the data say?"

After

"You are a PhD student in criminology analyzing city-level crime data. My dataset has monthly reported crime counts by offense type for one city from 2015–2023. Suggest three visualizations that would help spot seasonal or long-term trends, and explain what each would reveal. Bullet points, under 200 words."

Economics — reveal the rebuilt version
Before

"I found this economic trend in my data — what does it mean?"

After

"You are a PhD student in economics studying a trend in my dataset. My data shows quarterly unemployment and inflation rates for one country over the last 20 years, both rising together. Explain what that pattern would suggest about the underlying economy, and note two limitations of drawing conclusions from this data alone. Bullet points, under 200 words."

Political Science — reveal the rebuilt version
Before

"I need some background on political institutions for my paper."

After

"You are a PhD student in political science. I'm writing a paper comparing how presidential and parliamentary systems handle legislative gridlock. Summarize the key structural differences relevant to gridlock, formatted as a short comparison table."

Common Failure Modes

⚠ Up Next
Every prompt you write to AI for R code today — cleaning data, debugging, building a chart — follows the same five pieces. Vague prompt in, vague code out. Continue to Introduction to R and RStudio.