Skip to content

AI Diabetes Coach—AI Prompt Engineering

How I went from asking 'Why is my glucose high?' to getting personalized daily coaching that improved my time in range from 82% to 98%. Six iterations of prompt engineering that transformed generic AI into an essential health tool.

The Generic AI Problem

Why basic ChatGPT doesn't work for health coaching

With diabetes (or any health issue), asking an AI a generic question gets you a generic answer—interesting perhaps, but rarely helpful. As they say, "Garbage in, garbage out".

For example, if I ask ChatGPT:

Why is my glucose high?"

I get something like this:

High blood glucose can happen for several reasons, depending on your situation (whether you have diabetes, what you’ve eaten, stress levels, etc.). Common causes include:

- Diabetes - Your body can't regulate sugar properly- Food - Carbs raise blood sugar- Stress and illness - Hormones affect glucose- Medications - Some drugs raise blood sugar- Lack of sleep - Disrupts insulin sensitivity- Inactivity - Exercise helps lower glucose- Dawn phenomenon - Morning hormone surge
What you can do right now:Check your glucose againDrink waterTake a short walk if safeReview what you ate and when
If you want, tell me your glucose reading(s), when you measured (fasting, after eating, etc.), and any symptoms... and I can help you narrow down the likely cause.

So what does this tell me? Not much.

It's like asking "Why is the sky blue?" without any context about where I am, what time it is, or what I'm actually seeing. The response lists every possible reason the sky might appear blue, but doesn't help me understand "my specific sky" right now.

What I actually need is to understand my timelines, patterns, and trends. Not generic possibilities—but specific insights about my glucose, my meals, my insulin, and my daily patterns. That's what lets me learn and adapt to improve my health.

Generic AI can't do that. But engineered prompts can.

Six Prompt Iterations

How I evolved from questions to coaching

Iteration 1: Basic Questions

No context, generic answers

What I tried:
Just asking health questions directly:

  • "What should my glucose be after breakfast?"
  • "Is 156 mg/dL too high?"
  • "Why did I spike to 180?"

What I got:
Generic medical ranges and boilerplate advice:

  • "Normal post-meal glucose is 140-180 mg/dL"
  • "Consult your doctor about target ranges"
  • Spikes can be caused by many factors..."

What was missing:
Any knowledge of ME:

  • My Type 1 diabetes
  • My insulin doses
  • My meal timing
  • My target ranges (70-160, not 140-180!)
  • My patterns over time

What I learned:
AI needs MY context, not generic medical facts.

Iteration 2: Added My Diabetes Type

What changed, why it mattered

What I tried:

  • "I have Type 1 diabetes. Why is my glucose high?"
  • As someone with T1D, is 156 too high after breakfast?

What I got:
Type 1-specific information—better than generic:

  • References to insulin dependence
  • Mentions of carb counting
  • Tighter target ranges suggested

What was missing:
Still no knowledge of MY specific situation:

  • My current insulin regimen
  • My actual breakfast and timing
  • My glucose trend (rising? stable? falling?)
  • My exercise plans or stress levels

What I learned:
Diagnosis is important context, but I needed current data—not just historical facts about my condition.

Iteration 3: Added Current Data

What I tried:
Including real-time information:

  • "I have Type 1 diabetes. My glucose is 156 at 10 AM. I ate breakfast at 7:30 with 3u insulin. Why am I high?"

What I got:
Much more specific analysis:

  • Considered insulin-to-carb ratio
  • Looked at 2-hour post-meal timing
  • Suggested possible carb underestimation
  • Mentioned dawn phenomenon possibility

What was missing:
Context beyond this single moment:

  • What did I eat for breakfast?
  • How much did I actually carb-count?
  • Is this high normal for me after this meal?
  • How does today compare to yesterday?

What I learned:
One data point tells a story, but patterns tell the truth.

Iteration 4: Added Daily Pattern

What I tried:
Providing my full day's data:

  • All glucose readings
  • Every meal with carb counts
  • All insulin doses with timing
  • Exercise or unusual events

What I got:
Pattern recognition within the day:

  • "Your breakfast spike suggests under-dosing by ~1u"
  • "Lunch was stable—that ratio worked well"
  • "Evening low might be from afternoon exercise"

What was missing:
Historical comparison:

  • Is today typical or unusual?
  • Which patterns repeat across days?
  • What changed from yesterday to today?

What I learned:
Daily patterns reveal cause and effect, but I needed to compare across days to see what's sustainable vs. what's a one-time event.

Iteration 5: Added Weekly Context

What I tried:
Pasting several days worth of data:

  • Monday through Friday glucose logs
  • All meals and insulin doses
  • Exercise and stress notes

What I got:
Multi-day pattern analysis:

  • "You consistently spike after breakfast tacos"
  • "Your Friday evening lows correlate with yard work"
  • "Weekend patterns differ from weekdays"

What was missing:
This was incredibly powerful... but exhausting:

  • Manually copying/pasting data each time
  • No memory between conversations
  • Starting from scratch every session
  • Unsustainable long-term

What I learned:
I needed automation and persistent memory, not just more data.

Iteration 6: The Breakthrough

What I tried:
Three game-changing elements:

  1. Claude Projects for persistent memory across conversations
  2. Automated data sync via Dexcom API (glucose) + Glooko (insulin)
  3. Structured daily reviews generated from my own data

What I got:
True personalized coaching:

  • Daily analysis of yesterday's patterns
  • Comparisons to my historical trends
  • Specific, actionable recommendations
  • Conversational dialogue that builds on prior discussions
  • No manual data entry required

What was missing:
Nothing. This was the breakthrough.

What I learned:
The combination of automation, memory, and structure transformed AI from "occasionally helpful" to "daily essential coaching."

Result
82% → 98% time in range over 14 days. The proof that engineered prompts work.

What Makes It Work

Specific, context, examples, conversational

Four principles emerged from my iterations:

1. Specificity over Generality

Don't ask: "What should I eat for breakfast?"
Ask: "I have Type 1 diabetes, my fasting glucose is 110, I have 2 hours before a morning workout— what's a good breakfast that won't spike me during exercise?"

Generic questions get generic answers. Specific questions get actionable guidance.

2. Context over Instructions

Don't say: "Analyze my glucose".
Say: "Here's today's glucose data, meals, and insulin doses. I spiked to 210 after lunch yesterday with the same meal but didn't today— what was different?"

Context lets AI see patterns you might miss.

3. Examples over Explanations

Don't explain: "I want daily summaries".
Show: "Here's the format I want:

  • Average glucose: X
  • Time in range: Y%
  • Meals that worked well: Z
  • Patterns to watch: ..."

Examples are clearer than descriptions.

4. Conversation over Commands

Don't command: "Give me a meal plan".
Converse: "Looking at my patterns this week, which meals kept me most stable?

Can we build on those?" Dialog builds understanding over time.

The Results

Real data from real days

After implementing Iteration 6 (automated data sync + Claude Projects + daily reviews), my diabetes control transformed:

Before engineered prompts:

  • Time in Range (Tight 70-160): 82%
  • Inconsistent patterns
  • Reactive management (correcting problems)
  • Frustration with unexplained spikes and crashes

After engineered prompts:

  • Time in Range (Tight 70-160): 98%
  • Clear pattern recognition
  • Proactive management (preventing problems)
  • Understanding of my specific triggers

14-day streak results:

  • Average Tight TIR: 92%
  • Standard TIR (70-180): 97%
  • Learned from every challenging day
  • Recovered quickly from weekend restaurant meals
  • Identified exercise timing effects
  • Understood my roller coaster patterns

The difference wasn't just numbers—it was confidence. Instead of guessing why my glucose did something, I could trace cause and effect. Instead of generic advice, I got specific insights about MY body's patterns.

Engineered prompts turned AI from a search engine into a coach.

Getting Started

A progressive approach for your own prompts

You don't need to jump straight to Iteration 6. Start simple and add complexity as you learn what helps:

Week 1: Start with specificity

  • Replace "Help me with diabetes" with "I have Type 1 diabetes, my fasting glucose is 110, what should I consider for breakfast?"
  • Add your diagnosis, current situation, and specific question

Week 2: Add context

  • Include your current data: glucose reading, timing, recent meal, insulin dose
  • Ask about relationships: "What might explain this spike?"

Week 3: Show patterns

  • Share 2-3 days of data
  • Ask for pattern recognition
  • Notice what insights emerge from comparison

Week 4: Experiment with structure

  • Try different data formats
  • See what Claude (or ChatGPT or Gemini) understands best
  • Refine based on what gives useful responses

Eventually: Automate what works

  • If manually entering data gets tedious, consider automation
  • Use Claude Projects (or ChatGPT memory) for persistence
  • Build on what you've learned through experimentation

Remember:

  • Start where you are (no judgment!)
  • Add one improvement at a time (iterate!)
  • Keep what works, discard what doesn't (learn!)
  • Share what you discover (help others!)

The goal isn't perfection—it's progress. Each iteration taught me something. Yours will too.

Comments

Latest

AI Diabetes Coach — System Architecture
PKM

AI Diabetes Coach — System Architecture

In Part 1, you saw 82% → 98% time in range. But how does it work? This reveals the complete system: 5 components that transform raw sensor data into daily AI coaching. Dexcom API to Neo4j to Claude AI. Real examples, $20/month total. Part 2 of 5.

Members Public