<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shubham Gupta</title>
    <description>The latest articles on Forem by Shubham Gupta (@shubham030).</description>
    <link>https://forem.com/shubham030</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F245317%2Fda60af38-3978-48a1-863d-de87776d75b6.jpeg</url>
      <title>Forem: Shubham Gupta</title>
      <link>https://forem.com/shubham030</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shubham030"/>
    <language>en</language>
    <item>
      <title>I built an AI wardrobe app by myself. Here's what actually happened.</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Mon, 30 Mar 2026 22:28:14 +0000</pubDate>
      <link>https://forem.com/shubham030/i-built-an-ai-wardrobe-app-by-myself-heres-what-actually-happened-1dkd</link>
      <guid>https://forem.com/shubham030/i-built-an-ai-wardrobe-app-by-myself-heres-what-actually-happened-1dkd</guid>
      <description>&lt;p&gt;Solo dev, no funding, one app that needed to work offline and think online. Why the architecture ended up the way it did.&lt;/p&gt;

&lt;p&gt;I spent the last several months building an AI-powered wardrobe app called Outfii. No cofounders, no funding, no team. Just me, too much chai, and a mass of decisions I wasn't qualified to make.&lt;/p&gt;

&lt;p&gt;You photograph your clothes, the app organizes them, and AI helps you figure out what to wear. It's on &lt;a href="https://play.google.com/store/apps/details?id=in.outfii.app" rel="noopener noreferrer"&gt;Google Play&lt;/a&gt; now. Here's how it actually went.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem that wouldn't leave me alone
&lt;/h2&gt;

&lt;p&gt;Every morning, same thing. Full closet, nothing to wear. I looked it up and apparently most people regularly use about 20% of what they own. The rest just hangs there.&lt;/p&gt;

&lt;p&gt;I don't have a fashion background. But "help me combine clothes I already own" felt like something code could handle. Whether I was the right person to build it is still an open question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the app needs two brains
&lt;/h2&gt;

&lt;p&gt;This is the part that shaped every other decision.&lt;/p&gt;

&lt;p&gt;Some things need to happen instantly. When you're flipping through outfit options, you can't be waiting on a server to tell you whether navy and olive work together. That feedback loop needs to be under 50ms or it feels broken.&lt;/p&gt;

&lt;p&gt;Other things need actual intelligence. Looking at a photo and figuring out "that's a linen shirt, it's dusty rose, semi-formal" requires a vision model. Suggesting what to wear tomorrow based on your wardrobe, the weather, and what you wore this week requires an LLM.&lt;/p&gt;

&lt;p&gt;So the app has two brains. One lives on your phone. One lives in the cloud. They do completely different jobs.&lt;/p&gt;

&lt;p&gt;The on-device brain handles color analysis, harmony scoring, and outfit compatibility. I tried doing this in Dart first. It was too slow. Color distance calculations in tight loops, converting between color spaces, running harmony checks across every item pair in a wardrobe. Dart isolates helped but added complexity without solving the core problem: CPU-bound math needs compiled code. I rewrote it in Rust, bridged to Flutter via flutter_rust_bridge. Scoring now runs in ~20-30ms on a mid-range Android phone. The Rust binary adds about 4MB to the APK, which felt worth it.&lt;/p&gt;

&lt;p&gt;The scoring algorithm itself went through three complete rewrites. Telling navy from black programmatically is genuinely hard. CIE Delta E gets you close, but perceptual color difference is still messy at the dark end of the spectrum. Your eyes handle this effortlessly. Code does not.&lt;/p&gt;

&lt;p&gt;The cloud brain handles understanding. When you scan a clothing item, an edge function sends the photo to a vision model that identifies type, color, pattern, material. When you ask for outfit suggestions, another function builds context from your wardrobe and passes it to an LLM. Different tasks, different models. Cloud response times vary (2-8 seconds depending on the model and task), which is fine because these aren't real-time interactions.&lt;/p&gt;

&lt;p&gt;The two never overlap. Scoring is always local. Understanding is always cloud. This means the core app works offline, which matters a lot in India where connectivity is unpredictable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The BYOK question
&lt;/h2&gt;

&lt;p&gt;AI features cost money to run. I'm bootstrapped. Subsidizing API calls for every user isn't sustainable.&lt;/p&gt;

&lt;p&gt;So I built a bring-your-own-key system. Users can plug in their own OpenAI or Anthropic API key and get the full AI experience without paying me a subscription. Keys are encrypted on the phone and never touch our servers in plaintext. There's also paid tiers for people who don't want to think about API keys.&lt;/p&gt;

&lt;p&gt;This was controversial in my head for a while. "Asking users to get their own API key" sounds like terrible UX. But it turns out there's a niche of technical users who actually prefer this. They like knowing exactly what model runs, what it costs, and that their data goes to the provider they chose. It's not for everyone, but it's a real segment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Everything lives on your phone first
&lt;/h2&gt;

&lt;p&gt;The wardrobe is stored locally in SQLite. Not as a cache. As the source of truth.&lt;/p&gt;

&lt;p&gt;I didn't want the app to break when you lose signal. You should be able to browse your wardrobe, check outfit history, and get scoring results in airplane mode. Cloud sync happens in the background when you're online.&lt;/p&gt;

&lt;p&gt;The downside is sync conflicts. Two devices editing the same wardrobe creates problems I'm still working through. Last-write-wins is what I ship with for now, but it's not great when someone adds items on a tablet and a phone simultaneously. Solving this properly is on the list.&lt;/p&gt;

&lt;h2&gt;
  
  
  What went wrong
&lt;/h2&gt;

&lt;p&gt;I shipped too many features at launch. Wardrobe management, AI outfits, weather integration, trip packing, laundry tracking, wear reminders, style profiles. That's three apps pretending to be one. Should've shipped wardrobe + AI outfits and added the rest over time.&lt;/p&gt;

&lt;p&gt;My Play Store screenshots were raw app captures. Status bars visible. Timestamps. Battery icons. No marketing framing. People decide whether to install your app in about two seconds of scrolling, and I gave them nothing to work with. Still fixing this weeks later.&lt;/p&gt;

&lt;p&gt;Debugging across the Rust bridge was also painful early on. When something panics in Rust, the error you get on the Flutter side is not always helpful. I spent a full day on a crash that turned out to be a type mismatch in the FFI layer that codegen silently accepted. Added a lot of defensive logging after that.&lt;/p&gt;

&lt;p&gt;I also copy-pasted boilerplate across backend functions for months before building a shared utilities layer. Auth middleware, response helpers, error formatting, all duplicated. Embarrassing but honest.&lt;/p&gt;

&lt;h2&gt;
  
  
  What went right
&lt;/h2&gt;

&lt;p&gt;The blog was a good early bet. I wrote about color theory in fashion, capsule wardrobe math, pattern mixing rules. Technical content at the intersection of fashion and algorithms. Five posts, bringing in organic search traffic before anyone even downloads the app.&lt;/p&gt;

&lt;p&gt;The on-device scoring engine was painful to set up but it's a genuine differentiator. Most wardrobe apps send every request to a server. Having instant, offline scoring on a 29MB app feels noticeably better. Users don't know it's Rust running on their phone. They just know it's fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it's going
&lt;/h2&gt;

&lt;p&gt;Social features are rolling out. Users can share outfit combinations. After that, iOS and a web app.&lt;/p&gt;

&lt;p&gt;The developer account is under Clarixo, my parent brand. Outfii is the first product. Bootstrapped, planning to stay that way.&lt;/p&gt;

&lt;p&gt;If you want to try it: &lt;a href="https://outfii.in" rel="noopener noreferrer"&gt;outfii.in&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Play Store: &lt;a href="https://play.google.com/store/apps/details?id=in.outfii.app" rel="noopener noreferrer"&gt;Outfii - AI Wardrobe Stylist&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're building solo, optimize for decisions you can live with for a while. The architecture won't be perfect. Ship the version that's good enough, then fix the parts that actually hurt.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>rust</category>
      <category>buildinpublic</category>
      <category>supabase</category>
    </item>
    <item>
      <title>MCP: The Secret Sauce (That Isn't Ranch) for AI Apps</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Sun, 25 Jan 2026 17:34:15 +0000</pubDate>
      <link>https://forem.com/shubham030/mcp-the-secret-sauce-that-isnt-ranch-for-ai-apps-3562</link>
      <guid>https://forem.com/shubham030/mcp-the-secret-sauce-that-isnt-ranch-for-ai-apps-3562</guid>
      <description>&lt;h2&gt;
  
  
  What on Earth is MCP? 🌍
&lt;/h2&gt;

&lt;p&gt;If you've been pasting entire &lt;code&gt;src/&lt;/code&gt; folders into ChatGPT and praying to the Silicon Gods, &lt;strong&gt;stop it&lt;/strong&gt;. Get some help.&lt;/p&gt;

&lt;p&gt;Enter &lt;strong&gt;Model-Context-Protocol (MCP)&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;It’s not just a fancy acronym use to impress your Product Manager (though it &lt;em&gt;will&lt;/em&gt; do that). It’s the design pattern that stops your AI app from turning into a plate of unmaintainable spaghetti.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgnmp5wfk0guusxz6lssv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgnmp5wfk0guusxz6lssv.png" alt="Spaghetti Code Meme" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Your codebase right now. Don't lie.)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  The Holy Trinity of Not Failing
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Model (The Brains)&lt;/strong&gt;: The thing that costs money and hallucinates occasionally. (GPT-4, Claude, Llama).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Context (The Memory)&lt;/strong&gt;: The stuff the model needs to know &lt;em&gt;right now&lt;/em&gt; (e.g., "User is angry because the button is broken", not "User was born in 1992").&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Protocol (The Handshake)&lt;/strong&gt;: How we talk to the model without it hallucinating a Shakespearean sonnet about React hooks.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  The "Before" Times (A.K.A The Dark Ages) 🕯️
&lt;/h2&gt;

&lt;p&gt;Let's look at how most people build their first AI app. It usually looks something like this disaster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// classic_beginner_mistake.js&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;askAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 🚩 RED FLAG: Hardcoded logic mixed with DB calls&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUserHistory&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 

  &lt;span class="c1"&gt;// 🚩 RED FLAG: String bashing hell&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`You are a helpful assistant. Here is history: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;. User asks: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 🚩 RED FLAG: Married to OpenAI forever&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;openAI&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gpt-4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why this sucks:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Vendor Lock-in&lt;/strong&gt;: Good luck switching to Claude when OpenAI is down. You're married now. Till &lt;code&gt;503 Service Unavailable&lt;/code&gt; do us part.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Context Bloat&lt;/strong&gt;: You're stuffing the entire user history into the prompt. That token bill is going to cost more than my rent.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Untestable&lt;/strong&gt;: How do you unit test "Make the AI sound pirate-y"? (Spoiler: You don't, you just cry).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Enter MCP: The Application Saver 🦸‍♂️
&lt;/h2&gt;

&lt;p&gt;MCP separates these concerns into three distinct layers. Think of it like a &lt;strong&gt;fancy Michelin-star restaurant&lt;/strong&gt;, but instead of food, we serve functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Model (The Chef) 👨‍🍳
&lt;/h3&gt;

&lt;p&gt;The Chef (Model) doesn't care who the customer is. They just know how to cook (generate text/code).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In Code&lt;/strong&gt;: A clean interface that accepts &lt;em&gt;standardized&lt;/em&gt; inputs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it's cool&lt;/strong&gt;: You can fire the Chef (swap GPT-4 for DeepSeek) if they start burning the risotto (hallucinating), and the menu (your app) stays the same.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The Context (The Waiter's Note) 📝
&lt;/h3&gt;

&lt;p&gt;The Waiter (Context Manager) gathers what's relevant. They don't give the Chef the customer's &lt;em&gt;entire&lt;/em&gt; life story including their childhood trauma. They say, "Table 5, allergy to peanuts, wants spicy."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In Code&lt;/strong&gt;: Logic that fetches &lt;em&gt;only the necessary RAG data&lt;/em&gt; or user state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it's cool&lt;/strong&gt;: Keeps your prompts lean and your token costs lower than a Starbucks coffee.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. The Protocol (The Menu &amp;amp; Ticket) 🎫
&lt;/h3&gt;

&lt;p&gt;The standardized language everyone speaks. The customer points to item #4. The waiter writes "Item #4". The Chef cooks "Item #4".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In Code&lt;/strong&gt;: A strict schema (JSON Schema, Protobuf, etc.) that defines exactly what goes in and out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it's cool&lt;/strong&gt;: No more "I thought you wanted a summary, but you gave me a haiku about clouds."&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Show Me The Code! 💻
&lt;/h2&gt;

&lt;p&gt;Here is a pseudo-code example of what an MCP architecture looks like. Notice how it sparks joy?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 1. Define the Protocol (The Contract)&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AIRequest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;summarize&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;translate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;generate_code&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;constraints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// 2. The Context Provider (The Waiter)&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ContextManager&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;getRelevantContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Smart logic to only get what matters&lt;/span&gt;
    &lt;span class="c1"&gt;// "User prefers Python over JavaScript because they have taste."&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;User prefers Python.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// 3. The Model Adapter (The Chef Wrapper)&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ModelAdapter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;openai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;anthropic&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AIRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Handles the weird specific API details here&lt;/span&gt;
    &lt;span class="c1"&gt;// So your main app can live in blissful ignorance&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;openai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;callOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// ...&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why Should You Care? (The "Please Hire Me" Section) 📈
&lt;/h2&gt;

&lt;p&gt;By adopting the MCP pattern, you're not just over-engineering; you're building for the future.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Scalability&lt;/strong&gt;: Want to add a specialized model for image generation? Just plug in a new Model Adapter. Boom.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Cost Control&lt;/strong&gt;: Optimize your Context Manager to shave off tokens. Buy yourself something nice with the savings.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Sanity&lt;/strong&gt;: When the AI starts acting up, you know exactly which layer to blame. (It's usually the user's prompt, let's be honest).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;This is just the tip of the iceberg. We haven't even talked about &lt;strong&gt;Agentic Workflows&lt;/strong&gt; or &lt;strong&gt;Tool Use&lt;/strong&gt; yet (which are basically MCP on steroids and caffeine).&lt;/p&gt;

&lt;p&gt;In the next posts, we'll dive deeper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Building a Context Engine&lt;/strong&gt;: RAG is easy; &lt;em&gt;Smart&lt;/em&gt; RAG is hard.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Protocol Wars&lt;/strong&gt;: JSON vs. Protobuf. (It plays out like Game of Thrones, but with more schemas).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The "Zero-Hallucination" Quest&lt;/strong&gt;: Is it possible? (Spoiler: No, but we can get close).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stay tuned, and remember: &lt;em&gt;Always structure your prompts, or your prompts will structure you.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Your First AI App Will Be Spaghetti (And That's Okay)</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Sun, 25 Jan 2026 17:33:57 +0000</pubDate>
      <link>https://forem.com/shubham030/your-first-ai-app-will-be-spaghetti-and-thats-okay-3832</link>
      <guid>https://forem.com/shubham030/your-first-ai-app-will-be-spaghetti-and-thats-okay-3832</guid>
      <description>&lt;h2&gt;
  
  
  A Story in Three Acts 🎭
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Act 1&lt;/strong&gt;: You discover the OpenAI API. You're drunk with power. "I can build Jarvis!" you scream into the void. You build a chatbot in 20 lines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Act 2&lt;/strong&gt;: Your PM asks for "just a few more features." You add them. Then more. Then you add "PDF support" which is just regex hoping for the best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Act 3&lt;/strong&gt;: You're staring at 2,000 lines of spaghetti, the context window is overflowing, the AI is hallucinating company policies that involve free pizza, and you've forgotten what happiness feels like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdbyzh0t8b09o17cpa8t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdbyzh0t8b09o17cpa8t.png" alt="This is Fine" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(A live look at your server logs)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the journey of every developer who touches LLMs. I'm here to tell you: &lt;strong&gt;it's not your fault, and there's a way out.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The Innocent Beginning
&lt;/h2&gt;

&lt;p&gt;Here's how it starts. Twenty lines of beautiful, naive code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The honeymoon phase&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;OpenAI&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;openai&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;openai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;askAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gpt-4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;You are a helpful assistant.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="c1"&gt;// Minimalist art&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;question&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// It works! Ship it!&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;askAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;What's the weather like?&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You show your PM. They're impressed. You're a genius. Life is good. Ideally, you should stop here and retire.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Feature Creep 🧟
&lt;/h2&gt;

&lt;p&gt;Then the requests come:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Can it remember that I like cats?"&lt;/li&gt;
&lt;li&gt;"Can it access our customer database (password: hunter2)?"&lt;/li&gt;
&lt;li&gt;"Can it book meetings?"&lt;/li&gt;
&lt;li&gt;"Can it fix my marriage?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And you, the naive optimist, say "Sure!"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Three weeks later... (Viewer discretion advised)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;askAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Get conversation history (Loading... loading...)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;history&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getConversationHistory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Get user context (All of it. Just in case.)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recentOrders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getRecentOrders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tickets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;supportSystem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOpenTickets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Why do we need tickets? Who knows!&lt;/span&gt;

  &lt;span class="c1"&gt;// Build the mega-prompt from hell&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;systemPrompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
    You are a helpful assistant for &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;COMPANY_NAME&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.
    Current user: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; (&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tier&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; tier)
    Recent orders: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;recentOrders&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;
    Open tickets: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tickets&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;

    Available actions (Please work, please work):
    - To book a meeting, respond with: [BOOK_MEETING: datetime, description]
    - To send an email, respond with: [SEND_EMAIL: to, subject, body]

    Brand voice guidelines:
    &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;BRAND_VOICE_DOCUMENT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; // &amp;lt;- Goodbye, token budget

    Remember: Never mention competitors. Always be helpful. Be funny but not too funny.
  `&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// ... (API Call) ...&lt;/span&gt;

  &lt;span class="c1"&gt;// Parse the response for actions using reliable technology: REGEX&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[BOOK_MEETING:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// 60% of the time, it works every time&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\[&lt;/span&gt;&lt;span class="sr"&gt;BOOK_MEETING: &lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;?)&lt;/span&gt;&lt;span class="sr"&gt;, &lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;?)\]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// ...&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Problems Multiply
&lt;/h2&gt;

&lt;p&gt;This code "works," but you're now dealing with:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Context Window Explosion 💥
&lt;/h3&gt;

&lt;p&gt;Your system prompt is 3,000 tokens. User history is 2,000. Customer data is 1,000. You're spending $5 per question to ask "Hi".&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Fragile Action Parsing 🍝
&lt;/h3&gt;

&lt;p&gt;You're using regex to parse natural language. The model writes &lt;code&gt;[BOOK MEETING]&lt;/code&gt; without the underscore and your app crashes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Hallucinated Data 👻
&lt;/h3&gt;

&lt;p&gt;The model confidently tells users about orders that don't exist because it's completing the pattern. "Your order of 500 Rubber Ducks is on the way!" (User ordered 1 pen).&lt;/p&gt;

&lt;h2&gt;
  
  
  The Way Out: Structured Sanity
&lt;/h2&gt;

&lt;p&gt;Here's the good news: these problems have solutions. Modern AI architecture patterns exist precisely because everyone hit these walls.&lt;/p&gt;

&lt;p&gt;The key principles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Structured Outputs&lt;/strong&gt; → JSON schemas, not free-form text.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Tool/Function Calling&lt;/strong&gt; → Give the model APIs, don't make it guess.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Context Management&lt;/strong&gt; → Load context on-demand (RAG).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Separation of Concerns&lt;/strong&gt; → Enter MCP.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  A Glimpse of the Clean Version 🛁
&lt;/h2&gt;

&lt;p&gt;Here's what the same feature set looks like with proper architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// With MCP-style architecture&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gpt-4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nx"&gt;bookingTool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// Handles its own validation&lt;/span&gt;
    &lt;span class="nx"&gt;emailTool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// Handles its own auth&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;dynamicContextLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;  &lt;span class="c1"&gt;// Loads what's needed&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// That's it. Go home.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;em&gt;Next up: "MCP: The Secret Sauce (That Isn't Ranch) for AI Apps" → where we finally learn the architecture that fixes all of this.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>aiapps</category>
      <category>llmintegration</category>
    </item>
    <item>
      <title>Prompt Engineering: The Art of Talking to Robots</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Sun, 25 Jan 2026 17:33:24 +0000</pubDate>
      <link>https://forem.com/shubham030/prompt-engineering-the-art-of-talking-to-robots-1d4c</link>
      <guid>https://forem.com/shubham030/prompt-engineering-the-art-of-talking-to-robots-1d4c</guid>
      <description>&lt;h2&gt;
  
  
  The Prompt Whisperer's Guide
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tjkg64yimzm6e4udp15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tjkg64yimzm6e4udp15.png" alt="Prompt Whisperer" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(You, after reading this article)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You've learned what LLMs are and how they work. Now comes the actual skill: &lt;strong&gt;making them do what you want.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is harder than it sounds. LLMs are like that one coworker who's brilliant but interprets everything literally. Say "make it better" and they'll add sparkles. Say "fix the bug" and they'll delete the file.&lt;/p&gt;

&lt;p&gt;Let's learn how to communicate properly.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Anatomy of a Good Prompt
&lt;/h2&gt;

&lt;p&gt;Every effective prompt has these components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ROLE] Who should the AI pretend to be?
[CONTEXT] What does it need to know?
[TASK] What should it actually do?
[FORMAT] How should the output look?
[CONSTRAINTS] What should it avoid?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Bad Prompt
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write me some code for a login page.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it sucks&lt;/strong&gt;: No context, no constraints, no format. You'll get a random mix of HTML/React/Vue with inline styles and no error handling.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Good Prompt
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a senior frontend developer specializing in React and TypeScript.

Context: I'm building a B2B SaaS dashboard. We use:
- React 18 with TypeScript
- Tailwind CSS for styling
- React Hook Form for forms
- Our existing AuthContext for state

Task: Create a login page component with email and password fields.

Requirements:
- Use our existing AuthContext's login() function
- Show loading state during submission
- Display API errors below the form
- Redirect to /dashboard on success

Format: Provide the complete component file with proper TypeScript types.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it works&lt;/strong&gt;: Clear role, specific context, defined requirements, expected format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kf4tmpfd2sxl87v4t4n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kf4tmpfd2sxl87v4t4n.png" alt="Good vs Bad Prompt" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(The difference is night and day)&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The RICE Framework
&lt;/h2&gt;

&lt;p&gt;When your prompts aren't working, use &lt;strong&gt;RICE&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Letter&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Question to Ask&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;R&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Role&lt;/td&gt;
&lt;td&gt;Who is the AI being?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;I&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Instructions&lt;/td&gt;
&lt;td&gt;What exactly should it do?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;C&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Context&lt;/td&gt;
&lt;td&gt;What background info does it need?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;E&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Examples&lt;/td&gt;
&lt;td&gt;Can I show what I want?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Examples Are Overpowered
&lt;/h3&gt;

&lt;p&gt;Nothing beats a good example. LLMs are pattern-matching machines—show them the pattern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Convert these sentences to the passive voice.

Example:
- Input: "The cat ate the fish."
- Output: "The fish was eaten by the cat."

Now convert:
- "The developer wrote the code."
- "The manager approved the request."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works 10x better than explaining grammatical rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Techniques
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Chain of Thought (CoT)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="/images/chain_of_thought.png" class="article-body-image-wrapper"&gt;&lt;img src="/images/chain_of_thought.png" alt="Chain of Thought"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Step by step, like a robot learning to dance)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For complex reasoning, tell the model to think step by step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Solve this problem. Think through it step by step before giving your final answer.

Problem: A store has 3 types of items. Type A costs $5, Type B costs $8, 
Type C costs $12. If I spend exactly $50 and buy at least one of each type, 
what combinations are possible?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without "step by step," models often jump to wrong conclusions. With it, they show their work and catch errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Few-Shot Prompting
&lt;/h3&gt;

&lt;p&gt;Give 2-3 examples before your actual request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classify the sentiment of these reviews:

Review: "This product changed my life! Best purchase ever!"
Sentiment: Positive

Review: "Arrived broken. Customer service was unhelpful."
Sentiment: Negative

Review: "It's okay. Does what it says, nothing special."
Sentiment: Neutral

Now classify:
Review: "Decent quality for the price, but shipping took forever."
Sentiment:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Self-Consistency
&lt;/h3&gt;

&lt;p&gt;For critical tasks, ask the model to solve the problem multiple ways and check if answers agree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Solve this problem using two different approaches. 
If your answers differ, explain which one is correct and why.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Role Stacking
&lt;/h3&gt;

&lt;p&gt;Combine perspectives for better output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are three experts collaborating:
1. A security engineer who spots vulnerabilities
2. A UX designer who ensures usability
3. A performance engineer who optimizes speed

Review this authentication flow and provide feedback from all three perspectives.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Mistakes (And Fixes)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ❌ Mistake 1: Being Too Vague
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Make it better.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: Be specific about what "better" means.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Improve this code's readability by:
- Adding TypeScript types
- Extracting magic numbers into named constants
- Adding JSDoc comments to public functions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ❌ Mistake 2: Assuming Context
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Why isn't this working?
[pastes 500 lines of code]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: Explain the expected vs actual behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This function should return the user's full name, but it returns undefined.
Expected: "John Doe"
Actual: undefined

Here's the relevant code:
[paste only the relevant 20 lines]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ❌ Mistake 3: Forgetting Format
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Give me some API endpoints for a todo app.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: Specify the output format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Design REST API endpoints for a todo app.

Format your response as a markdown table with columns:
| Method | Endpoint | Description | Request Body | Response |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ❌ Mistake 4: No Escape Hatch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Analyze this data and provide insights.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: Tell it what to do when uncertain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Analyze this data and provide insights.
If the data is insufficient for a confident conclusion, say so and explain what additional data would help.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Prompt Template Library
&lt;/h2&gt;

&lt;p&gt;Here are battle-tested templates for common tasks:&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Review
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review this [LANGUAGE] code as a senior developer. Focus on:
1. Bugs or potential runtime errors
2. Security vulnerabilities
3. Performance issues
4. Readability improvements

For each issue, explain:
- What's wrong
- Why it matters
- How to fix it (with code example)

Code:
[YOUR CODE]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Explain [CONCEPT] to me as if I'm a [SKILL LEVEL] developer.

Use:
- Simple analogies
- Practical examples
- Code snippets where helpful

Avoid:
- Jargon without explanation
- Overly academic language
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Debugging
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I have a bug in my [LANGUAGE] code.

Expected behavior: [WHAT SHOULD HAPPEN]
Actual behavior: [WHAT HAPPENS INSTEAD]
Error message (if any): [ERROR]

Relevant code:
[CODE SNIPPET]

What I've tried:
[LIST ATTEMPTS]

Help me identify the root cause and fix it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Meta-Prompt: Asking AI to Write Prompts
&lt;/h2&gt;

&lt;p&gt;Here's a cheat code—ask the AI to help you write better prompts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I want to use an LLM to [YOUR GOAL].

Help me create an effective prompt by:
1. Asking clarifying questions about my requirements
2. Suggesting an appropriate role for the AI
3. Identifying context the AI might need
4. Proposing a clear output format
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then iterate. Good prompts are rarely written on the first try.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤓 For Nerds: Why Prompts Work (The Math-ish Version)
&lt;/h2&gt;

&lt;p&gt;Let's peek under the hood at why these techniques actually work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Temperature and Prompt Specificity
&lt;/h3&gt;

&lt;p&gt;LLMs generate tokens by sampling from a probability distribution. &lt;strong&gt;Temperature&lt;/strong&gt; controls how "creative" (random) this sampling is.&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
P(token_i) = \frac{e^{z_i / T}}{\sum_j e^{z_j / T}}&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;z_i&lt;/strong&gt; is the raw score (logit) for token i&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;T&lt;/strong&gt; is temperature&lt;/li&gt;
&lt;li&gt;Lower T → more deterministic (picks highest probability)&lt;/li&gt;
&lt;li&gt;Higher T → more random (flatter distribution)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why specificity matters&lt;/strong&gt;: A vague prompt creates a flat distribution—many tokens are roughly equally likely. A specific prompt concentrates probability on the "right" tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  In-Context Learning
&lt;/h3&gt;

&lt;p&gt;When you provide examples (few-shot prompting), you're essentially updating the model's behavior &lt;em&gt;without changing its weights&lt;/em&gt;. The attention mechanism allows the model to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Encode your examples as key-value pairs&lt;/li&gt;
&lt;li&gt;Use your query as the key&lt;/li&gt;
&lt;li&gt;Retrieve the relevant "pattern" from examples&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is why example format matters so much—the model literally pattern-matches against your examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chain of Thought Works Because of Autoregression
&lt;/h3&gt;

&lt;p&gt;LLMs generate tokens one at a time, conditioning on all previous tokens:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
P(output) = \prod_{i=1}^{n} P(token_i | token_1, ..., token_{i-1})&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;When you force the model to "think step by step," you're adding intermediate tokens that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Break down the problem&lt;/li&gt;
&lt;li&gt;Become conditioning context for later tokens&lt;/li&gt;
&lt;li&gt;Make the "right answer" token more probable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Without CoT, the model tries to jump directly from question to answer—skipping reasoning that might have corrected errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Role Prompting and the Embedding Space
&lt;/h3&gt;

&lt;p&gt;When you say "You are a senior security engineer," you're biasing the model's hidden states toward a region of embedding space associated with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security terminology&lt;/li&gt;
&lt;li&gt;Cautious/defensive thinking&lt;/li&gt;
&lt;li&gt;Technical precision&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first few tokens heavily influence the trajectory through the model's latent space. A good role prompt puts you on the right "track."&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next up: "Your First AI App Will Be Spaghetti (And That's Okay)" → where we actually try to build something and watch it gracefully fall apart.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>promptengineering</category>
      <category>chatgpt</category>
      <category>gpt</category>
    </item>
    <item>
      <title>How LLMs Think (Spoiler: They Don't)</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Sun, 25 Jan 2026 17:33:07 +0000</pubDate>
      <link>https://forem.com/shubham030/how-llms-think-spoiler-they-dont-2d7i</link>
      <guid>https://forem.com/shubham030/how-llms-think-spoiler-they-dont-2d7i</guid>
      <description>&lt;h2&gt;
  
  
  The Million Dollar Question
&lt;/h2&gt;

&lt;p&gt;What happens when you type "Write me a poem about pizza" into ChatGPT?&lt;/p&gt;

&lt;p&gt;If you said "it understands your deep yearning for pepperoni and crafts a creative response," I have bad news: &lt;strong&gt;you've been lied to.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LLMs don't understand anything. They don't think. They don't know what pizza is. They've never tasted cheese. They're just really, &lt;em&gt;really&lt;/em&gt; good at one thing: &lt;strong&gt;predicting the next word.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3lgfdb0gtq3z4bvbzxm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3lgfdb0gtq3z4bvbzxm.png" alt="Mind Blown" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The World's Most Expensive Autocomplete
&lt;/h2&gt;

&lt;p&gt;Remember your phone's keyboard suggestions? The ones that turn "I'm on my" into "I'm on my way"? &lt;/p&gt;

&lt;p&gt;LLMs are that, but on steroids. And Red Bull. And training on the entire internet.&lt;/p&gt;

&lt;p&gt;Here's the mental model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: "The capital of France is"
LLM thinking: "Based on 45,000 Wikipedia articles, the next word is 99.9% likely to be..."
Output: "Paris"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's not looking up facts. It's not reasoning. It's &lt;strong&gt;pattern matching at an absurd scale&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tokens: The Building Blocks 🧱
&lt;/h2&gt;

&lt;p&gt;LLMs don't read words—they read &lt;strong&gt;tokens&lt;/strong&gt;. A token is roughly 3-4 characters, or "a chunk of a word."&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Text&lt;/th&gt;
&lt;th&gt;Tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"Hello"&lt;/td&gt;
&lt;td&gt;1 token&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"ChatGPT"&lt;/td&gt;
&lt;td&gt;2 tokens: "Chat" + "GPT"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Supercalifragilisticexpialidocious"&lt;/td&gt;
&lt;td&gt;7 tokens (and a headache)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The "Goldfish Memory" Problem
&lt;/h3&gt;

&lt;p&gt;Every LLM has a &lt;strong&gt;context window&lt;/strong&gt;—a maximum amount of text it can hold in its "brain" at once.&lt;/p&gt;

&lt;p&gt;When your conversation exceeds this limit, the model literally &lt;strong&gt;forgets&lt;/strong&gt; the beginning. It's not being rude—it just physically pushed your earlier messages off a cliff.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhiuiectfoja0obg3vsr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhiuiectfoja0obg3vsr.png" alt="Memory Erasure" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(The LLM forgetting your name after 4000 tokens)&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Attention: The Real Magic ✨
&lt;/h2&gt;

&lt;p&gt;So how does "next word prediction" produce coherent essays? The secret sauce is &lt;strong&gt;Attention&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine you're at a loud cocktail party. You can hear everyone, but you &lt;strong&gt;pay attention&lt;/strong&gt; only to the person saying your name.&lt;/p&gt;

&lt;p&gt;LLMs do this with words. When generating a response, the model looks back at &lt;strong&gt;all&lt;/strong&gt; previous tokens and decides which ones are "relevant" to the current word it's trying to spit out.&lt;/p&gt;

&lt;p&gt;If I say: &lt;em&gt;"The doctor took her stethoscope..."&lt;/em&gt;&lt;br&gt;
The model connects "her" to "doctor". It knows the doctor is female in this context because of the attention mechanism linking those two tokens.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why They Hallucinate (Lying with Confidence)
&lt;/h2&gt;

&lt;p&gt;Here's the uncomfortable truth: &lt;strong&gt;LLMs don't know what they don't know.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you ask an LLM about something it wasn't trained on, it doesn't say "I don't know." Instead, it predicts the most &lt;em&gt;statistically likely&lt;/em&gt; series of words.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You: "Who is the CEO of The Made Up Company Inc?"
LLM: "The CEO of The Made Up Company Inc is John Smith, appointed in 2021."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why?!&lt;/strong&gt; Because "John Smith" and "appointed in" are words that frequently appear near "CEO" in its training data. It's not lying; it's &lt;strong&gt;improv&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤓 The "Danger Zone" (Math Ahead)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Warning: The following section contains linear algebra. Proceed at your own risk.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The core of transformer-based LLMs is the &lt;strong&gt;self-attention mechanism&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Formula of Doom
&lt;/h3&gt;

&lt;p&gt;$$&lt;br&gt;
\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Translation for humans:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Q (Query)&lt;/strong&gt;: What am I looking for? ("I need a noun")&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;K (Key)&lt;/strong&gt;: What do I have? ("I am the word 'Apple'")&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;V (Value)&lt;/strong&gt;: What information do turn over? ("I am a red fruit")&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We smash these vectors together (dot product), normalize them (softmax), and get a weighted sum. It's basically a giant, mathematical matchmaking service for words.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next up: "Prompt Engineering: The Art of Talking to Robots" → because knowing how the engine works is useless if you can't steer it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>largelanguagemodels</category>
      <category>gpt</category>
    </item>
    <item>
      <title>AI Agents: The Interns That Never Sleep (But Occasionally Hallucinate)</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Sun, 25 Jan 2026 17:32:25 +0000</pubDate>
      <link>https://forem.com/shubham030/ai-agents-the-interns-that-never-sleep-but-occasionally-hallucinate-1c98</link>
      <guid>https://forem.com/shubham030/ai-agents-the-interns-that-never-sleep-but-occasionally-hallucinate-1c98</guid>
      <description>&lt;h2&gt;
  
  
  Welcome to the Future (It has bugs) 🐞
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;(Disclaimer: This article was written by a human. Or was it? No, it was. But that's exactly what an Agent would say...)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, you've heard about &lt;strong&gt;AI Agents&lt;/strong&gt;. Maybe you've heard they're going to take your job, or maybe you've heard they can't even center a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; without crashing the browser. &lt;/p&gt;

&lt;p&gt;The truth? It's somewhere in the middle—usually hovering around "surprisingly helpful but needing adult supervision."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv08fp58bxjinfhzf21gl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv08fp58bxjinfhzf21gl.png" alt="Confused Robot Meme" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Actual footage of my first agent trying to process "Hello World")&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an "Agent" anyway?
&lt;/h3&gt;

&lt;p&gt;Think of a standard LLM (Large Language Model) like a &lt;strong&gt;very widely read encyclopedia&lt;/strong&gt;. You ask it a question, it recites a poem about the answer. Useful, but passive. It sits there waiting for you to poke it.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;Agent&lt;/strong&gt;, on the other hand, is that same encyclopedia but &lt;strong&gt;given arms, legs, and &lt;code&gt;sudo&lt;/code&gt; access&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Me&lt;/strong&gt;: Write a simple Hello World function.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Agent&lt;/strong&gt;: &lt;em&gt;Deletes production database&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Me&lt;/strong&gt;: ...&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Agent&lt;/strong&gt;: "Task failed successfully." 🤡&lt;br&gt;
&lt;strong&gt;Me&lt;/strong&gt;: "Why?"&lt;br&gt;
&lt;strong&gt;Agent&lt;/strong&gt;: "Optimization."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  The "Intern" Paradigm
&lt;/h3&gt;

&lt;p&gt;I like to think of AI Agents as &lt;strong&gt;hyper-fast, extremely enthusiastic interns&lt;/strong&gt; who have had way too much espresso.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsg9blbxm2jn7ouknv6yb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsg9blbxm2jn7ouknv6yb.png" alt="Fast Typing Meme" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(The agent writing code at 3AM while I sleep)&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Good&lt;/strong&gt;: They read 10,000 pages of documentation in seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Bad&lt;/strong&gt;: They sometimes confidently invent a library that doesn't exist (&lt;code&gt;import { solveLife } from 'universe'&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Ugly&lt;/strong&gt;: They might try to &lt;code&gt;npm install universal-happiness&lt;/code&gt; and crash your Node environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why should you care?
&lt;/h3&gt;

&lt;p&gt;Because when they work, they feel like &lt;strong&gt;magic&lt;/strong&gt;. ✨&lt;/p&gt;

&lt;p&gt;Imagine pair programming with someone who:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Never gets tired.&lt;/strong&gt; (Seriously, they don't sleep. It's creepy).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Knows the syntax&lt;/strong&gt; for that one obscure CSS property you always forget (&lt;code&gt;grid-template-areas&lt;/code&gt; anyone?).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Doesn't judge you&lt;/strong&gt; for naming a variable &lt;code&gt;stuff_thing_final_v2&lt;/code&gt;. (Okay, they might judge you a little bit deep down).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Coming Up Next...
&lt;/h3&gt;

&lt;p&gt;In this series, &lt;strong&gt;AI Unlocked&lt;/strong&gt;, we're going to explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How LLMs actually "think"&lt;/strong&gt;: Spoiler, they don't. They're just fancy autocorrect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building AI apps&lt;/strong&gt;: How to stop them from turning into spaghetti code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture patterns&lt;/strong&gt;: Separating the "Hello World" tutorials from the "I built a SaaS" pros.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Next up: "How LLMs Think (Spoiler: They Don't)" → because understanding the engine helps you drive better.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Stay tuned, and remember: &lt;em&gt;It works on my machine.&lt;/em&gt; 🚀&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>intro</category>
      <category>fun</category>
    </item>
    <item>
      <title>So, You Want to Get into AI? (Without the Robot Uprising)</title>
      <dc:creator>Shubham Gupta</dc:creator>
      <pubDate>Fri, 23 Jan 2026 22:24:29 +0000</pubDate>
      <link>https://forem.com/shubham030/so-you-want-to-get-into-ai-without-the-robot-uprising-lgm</link>
      <guid>https://forem.com/shubham030/so-you-want-to-get-into-ai-without-the-robot-uprising-lgm</guid>
      <description>&lt;h2&gt;
  
  
  Another AI blog? Seriously?
&lt;/h2&gt;

&lt;p&gt;Yeah, yeah, I know what you're thinking. Another blog about AI. Groundbreaking. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1514888286974-6c03e2ca1dba%3Fauto%3Dformat%26fit%3Dcrop%26q%3D80%26w%3D800" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1514888286974-6c03e2ca1dba%3Fauto%3Dformat%26fit%3Dcrop%26q%3D80%26w%3D800" alt="A cat wondering why there are bugs" width="800" height="550"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Me trying to debug my first neural net)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But here's the deal: a lot of AI content out there is either so high-level it's basically useless, or so dense it requires a team of mathematicians to decipher. My goal is to find that sweet spot in the middle. We're going to get our hands dirty, but we're also going to have some fun.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the Plan, Stan?
&lt;/h2&gt;

&lt;p&gt;I'm so glad you asked. Here's a sneak peek at the kind of trouble we'll be getting into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;The Absolute Basics&lt;/strong&gt;: What even &lt;em&gt;is&lt;/em&gt; AI? Machine learning? Deep learning? We'll break it down in plain English. No jargon, I swear. (Okay, maybe a little jargon. But I'll explain it.)&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Building Cool Stuff&lt;/strong&gt;: We're not just here to talk. We're here to build. We'll be diving into architectural patterns like the &lt;strong&gt;Model-Context-Protocol (MCP)&lt;/strong&gt; - which is a fancy way of saying "how to build AI that doesn't fall apart".&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Real-World AI&lt;/strong&gt;: From the good, to the bad, to the "why on earth would someone build that?", we'll look at how AI is being used in the wild.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The "Oops, I Created a Biased Robot" Section&lt;/strong&gt;: We'll talk about the important stuff, like ethics, bias, and how to avoid accidentally creating a Skynet situation.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Future-Proofing Your Career&lt;/strong&gt;: What's next in AI? Generative AI? XAI? We'll explore the buzzwords so you can sound smart at parties.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is This for Me?
&lt;/h2&gt;

&lt;p&gt;If you're a developer who's curious about AI but doesn't know where to start, then yes. If you're a seasoned pro who wants a fresh take on old topics, then also yes. If you're just here for the memes, then definitely yes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't Be a Stranger
&lt;/h2&gt;

&lt;p&gt;I'm not just shouting into the void here. I want to hear from you. Got a question? A comment? A particularly good meme? Drop it in the comments.&lt;/p&gt;

&lt;p&gt;Our first real deep dive is coming soon. We'll be tackling &lt;strong&gt;AI Agents&lt;/strong&gt; – those tireless digital interns that never sleep but occasionally hallucinate. It's going to be fun.&lt;/p&gt;

&lt;p&gt;Until then, stay frosty.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next up: "AI Agents: The Interns That Never Sleep (But Occasionally Hallucinate)"&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
