<?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>DEV Community: Learn AI Resource</title>
    <description>The latest articles on DEV Community by Learn AI Resource (@learnairesource).</description>
    <link>https://dev.to/learnairesource</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3896826%2F8f18add2-c0af-49e1-826d-3e15d3ff770e.png</url>
      <title>DEV Community: Learn AI Resource</title>
      <link>https://dev.to/learnairesource</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/learnairesource"/>
    <language>en</language>
    <item>
      <title>Using AI to Debug Code Without Losing Your Mind</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Tue, 04 Aug 2026 15:00:24 +0000</pubDate>
      <link>https://dev.to/learnairesource/using-ai-to-debug-code-without-losing-your-mind-23if</link>
      <guid>https://dev.to/learnairesource/using-ai-to-debug-code-without-losing-your-mind-23if</guid>
      <description>&lt;h1&gt;
  
  
  Using AI to Debug Code Without Losing Your Mind
&lt;/h1&gt;

&lt;p&gt;You know that moment? 3 AM, you've got a weird race condition that only happens on Wednesdays, and Claude is like "have you tried adding logs?" Yes. You've tried adding logs. You've tried everything.&lt;/p&gt;

&lt;p&gt;Here's what actually works when you're debugging with AI: stop trying to describe the problem. Show it the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Wrong Way (That Everyone Does)
&lt;/h2&gt;

&lt;p&gt;"Hey Claude, I have a Node app that crashes sometimes when under heavy load, any ideas?"&lt;/p&gt;

&lt;p&gt;You'll get back a generic checklist. Memory leaks, async issues, event emitter warnings. All technically true, none of it actually helps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Right Way
&lt;/h2&gt;

&lt;p&gt;Dump the actual error stack, relevant code snippets, and your recent git commits into the conversation. Even better: give AI a reproduction case. Something small that consistently breaks the same way. A specific test file. A 10-line script that triggers it.&lt;/p&gt;

&lt;p&gt;Then ask specific questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Why does this throw an error but only with concurrency &amp;gt; 100?"&lt;/li&gt;
&lt;li&gt;"This worked in v16, broke in v20. What changed?"&lt;/li&gt;
&lt;li&gt;"Walk through what's happening at line 47 step by step"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI is terrible at vague problems. AI is weirdly good at explaining &lt;em&gt;specific&lt;/em&gt; code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concrete Example: Memory Leak Debugging
&lt;/h2&gt;

&lt;p&gt;I had a WebSocket server leaking memory. Every connection added ~100KB that never got freed. Annoying but not catastrophic at small scale.&lt;/p&gt;

&lt;p&gt;Instead of asking "why is my server leaking memory," I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Captured a heap snapshot after 1000 connections&lt;/li&gt;
&lt;li&gt;Showed the detached DOM node count, listener counts, and memory timeline&lt;/li&gt;
&lt;li&gt;Pasted the cleanup code in my disconnect handler&lt;/li&gt;
&lt;li&gt;Asked: "What's keeping these listeners alive after disconnect?"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Claude immediately spotted it: I was adding to a Map on the class but never deleting the entries. Five-minute fix.&lt;/p&gt;

&lt;p&gt;Without the heap dump? I'd still be flailing around guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools That Actually Help
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Chrome DevTools&lt;/strong&gt; - Heap snapshots for Node apps. Export the JSON. Include it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;clinic.js&lt;/strong&gt; - Profiles your app and shows flame graphs. Way better than just "CPU is high"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node --inspect&lt;/strong&gt; - Remote debugging. You can actually watch the code execute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;git diff + git log&lt;/strong&gt; - Show what changed recently, not your guesses about what might have changed.&lt;/p&gt;

&lt;p&gt;The secret: AI debugging isn't magic. It's just having the &lt;em&gt;right context&lt;/em&gt; so the AI can actually help instead of spitballing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Win
&lt;/h2&gt;

&lt;p&gt;Stop thinking "AI will solve this for me." Think "AI will help me understand this faster if I give it the actual evidence."&lt;/p&gt;

&lt;p&gt;You're not outsourcing the debugging. You're giving yourself a pair of fresh eyes that's available at 3 AM and won't get annoyed at your fifth question about the same thing.&lt;/p&gt;




&lt;p&gt;Want to stay sharp on the tools and techniques actually worth learning? &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;Join LearnAI Weekly&lt;/a&gt; for practical AI tips from real development work — no fluff, just what works.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>productivity</category>
      <category>coding</category>
    </item>
    <item>
      <title>Stop Pasting Stack Traces to ChatGPT: Build a Real Debugging Workflow</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Mon, 03 Aug 2026 15:00:35 +0000</pubDate>
      <link>https://dev.to/learnairesource/stop-pasting-stack-traces-to-chatgpt-build-a-real-debugging-workflow-1kcf</link>
      <guid>https://dev.to/learnairesource/stop-pasting-stack-traces-to-chatgpt-build-a-real-debugging-workflow-1kcf</guid>
      <description>&lt;p&gt;Your error message shows up. You copy-paste it to ChatGPT. You get a generic answer. You waste 20 minutes. We can do better.&lt;/p&gt;

&lt;p&gt;The problem? Most of us treat AI as a search engine substitute instead of a debugging partner. Here's how to actually integrate AI into your workflow so it catches stuff before production.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup That Actually Works
&lt;/h2&gt;

&lt;p&gt;Install these locally (no cloud required):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Ollama for local LLM (runs on your machine)&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;ollama
ollama pull neural-chat

&lt;span class="c"&gt;# Or use your existing API if you prefer&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_key_here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;.debug&lt;/code&gt; directory in your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.debug/
├── error-context.md
├── logs/
└── snapshots/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Workflow
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Capture Context, Not Just Errors
&lt;/h3&gt;

&lt;p&gt;When something breaks, don't just grab the error. Grab &lt;em&gt;context&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a debug snapshot&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"## Error at &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .debug/error-context.md
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"### Stack Trace"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; .debug/error-context.md
your-app-command 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; .debug/error-context.md

&lt;span class="c"&gt;# Add recent changes&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"### Recent Commits"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; .debug/error-context.md
git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;-5&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; .debug/error-context.md

&lt;span class="c"&gt;# Add environment&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"### Environment"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; .debug/error-context.md
&lt;span class="nb"&gt;env&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"NODE|PYTHON|DB_"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; .debug/error-context.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file becomes your AI's input. It's &lt;em&gt;everything&lt;/em&gt; the AI needs to help you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Ask the Right Question
&lt;/h3&gt;

&lt;p&gt;Wrong: "Why am I getting this error?"&lt;br&gt;
Right: "Given this context, what changed recently that could cause this? What should I check first?"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# If using local AI&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; .debug/error-context.md | ollama run neural-chat &lt;span class="s2"&gt;"Analyze this error with context. What's the most likely cause? What do I test first?"&lt;/span&gt;

&lt;span class="c"&gt;# If using API&lt;/span&gt;
curl https://api.openai.com/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$OPENAI_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{  
    "model": "gpt-4",
    "messages": [{
      "role": "user",
      "content": "'&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .debug/error-context.md&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="s2"&gt;""'

Dont give me generic debugging steps. Tell me specifically what changed that caused this."&lt;/span&gt;
    &lt;span class="o"&gt;}]&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference: you're not asking "what's wrong" — you're asking "given what you see, what's the fastest fix?"&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Verify Before You Trust
&lt;/h3&gt;

&lt;p&gt;AI can be confidently wrong. Add a verification step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Before you apply the fix, test it in isolation&lt;/span&gt;
&lt;span class="c"&gt;# Example: if AI says "check your DB connection"&lt;/span&gt;
npm &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--grep&lt;/span&gt; &lt;span class="s2"&gt;"database.*connection"&lt;/span&gt;

&lt;span class="c"&gt;# Or reproduce with minimal code&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .debug/test-hypothesis.js &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
// Test only the thing AI suggested
const db = require('./db');
db.connect().then(() =&amp;gt; {
  console.log('Connection works');
  process.exit(0);
}).catch(err =&amp;gt; {
  console.error('Connection fails:', err.message);
  process.exit(1);
});
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;node .debug/test-hypothesis.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the fix works in isolation, apply it. If it doesn't, you have evidence to push back on the suggestion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Example: The Silent Cache Bug
&lt;/h2&gt;

&lt;p&gt;Your API returns stale data. You check Redis, it's fine. You check the code, it's fine. Classic.&lt;/p&gt;

&lt;p&gt;Your debug file captures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The exact response with timestamp&lt;/li&gt;
&lt;li&gt;Your recent refactor (moved cache invalidation logic)&lt;/li&gt;
&lt;li&gt;Environment config&lt;/li&gt;
&lt;li&gt;Server logs from the time it happened&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You ask the AI: "I moved cache invalidation to a different function last Tuesday. The timestamps show the data got cached &lt;em&gt;after&lt;/em&gt; my change. What did I miss?"&lt;/p&gt;

&lt;p&gt;AI responds: "You're probably invalidating in the old location. Check if you have two cache implementations."&lt;/p&gt;

&lt;p&gt;You grep for it. Found it. 30 seconds instead of 30 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools That Actually Help
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Local options (privacy + speed):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ollama + neural-chat: Free, runs on your machine&lt;/li&gt;
&lt;li&gt;LM Studio: GUI wrapper, easier to use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;API options (more power):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude (Anthropic): Best for understanding weird edge cases&lt;/li&gt;
&lt;li&gt;GPT-4: Fast, good for quick questions&lt;/li&gt;
&lt;li&gt;Sonnet (Claude 3.5): Sweet spot for most bugs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pick one and stick with it. You'll learn how to ask it better questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Habit
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Error happens&lt;/li&gt;
&lt;li&gt;Grab context (30 seconds)&lt;/li&gt;
&lt;li&gt;Ask AI with the context (1 minute)&lt;/li&gt;
&lt;li&gt;Test the hypothesis (2-5 minutes)&lt;/li&gt;
&lt;li&gt;Apply the fix or dig deeper&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Boring? Yes. Effective? Also yes.&lt;/p&gt;

&lt;p&gt;The magic isn't the AI. It's the &lt;em&gt;context&lt;/em&gt;. Most of us give AI 5% of the information it needs. That's why the answers are generic. Give it 95% and you'll be shocked how specific the advice becomes.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want practical tips on building better dev workflows?&lt;/strong&gt; Check out &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt; — real strategies for actually shipping faster, not just hype.&lt;/p&gt;

&lt;p&gt;Happy debugging.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>productivity</category>
      <category>workflow</category>
    </item>
    <item>
      <title>Debug Faster: AI Tools That Actually Catch Your Mistakes</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Sun, 02 Aug 2026 15:00:27 +0000</pubDate>
      <link>https://dev.to/learnairesource/debug-faster-ai-tools-that-actually-catch-your-mistakes-1f5k</link>
      <guid>https://dev.to/learnairesource/debug-faster-ai-tools-that-actually-catch-your-mistakes-1f5k</guid>
      <description>&lt;p&gt;You know that feeling when you spend 20 minutes staring at a bug that turns out to be a missing semicolon? Yeah. We've all been there. The annoying part isn't the bug—it's that you knew where to look, you just didn't look &lt;em&gt;carefully enough&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That's where AI debugging tools shine. Not as replacements for your brain, but as tireless pairs of eyes that never get bored or distracted.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack Trace Translator Problem
&lt;/h2&gt;

&lt;p&gt;Ever gotten a stack trace so cryptic it might as well be written in ancient hieroglyphics? Throwing it into Claude or ChatGPT usually works, but you're context-switching, pasting things around, losing flow.&lt;/p&gt;

&lt;p&gt;Tools like &lt;strong&gt;Cursor&lt;/strong&gt; (the IDE, not the pointer) changed the game. You can highlight a stack trace, ask the AI what's happening, and get context-specific explanations without leaving your editor. Same with &lt;strong&gt;GitHub Copilot Chat&lt;/strong&gt;—I paste an error, it suggests fixes immediately.&lt;/p&gt;

&lt;p&gt;The time saved isn't huge per bug, but it adds up fast. Five minutes saved per day is 20+ hours per year. That's not nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Wait, Does This Actually Work?" Test
&lt;/h2&gt;

&lt;p&gt;Before I trust an AI fix, I actually run it. Which sounds obvious, but here's the trick: ask the AI to explain &lt;em&gt;why&lt;/em&gt; the fix works. If it can't, I don't trust it.&lt;/p&gt;

&lt;p&gt;Example: error about missing dependency. Copilot says "add this import." But is that actually fixing the root cause? Ask it. "Walk me through why this import fixes it." If the explanation makes sense, I proceed. If it doesn't, it's either hallucinating or I'm missing context.&lt;/p&gt;

&lt;p&gt;Most AI tools are genuinely good at this kind of reasoning now. They're not perfect, but they're better than a random Stack Overflow answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Debugging Setup (Not Magic)
&lt;/h2&gt;

&lt;p&gt;Here's what actually works in practice:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Logs first.&lt;/strong&gt; Before asking AI anything, look at your actual logs. Add console statements if needed. AI can't debug what it can't see.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cursor or VS Code + Copilot.&lt;/strong&gt; Highlight weird code, ask "what does this do?" or "why might this fail?" Instantly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Claude for complex stuff.&lt;/strong&gt; Paste the whole file, explain the context, ask for help. It's slower but handles gnarly problems better than inline tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Run the fix locally.&lt;/strong&gt; Don't just trust it. Confirm the behavior changes the way you expect.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document it.&lt;/strong&gt; If it's a weird fix, add a comment. Future-you will thank you.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Productivity Multiplier
&lt;/h2&gt;

&lt;p&gt;The real win isn't about AI being smarter than you. You're smarter. The win is that AI is &lt;em&gt;faster&lt;/em&gt; at boring stuff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explaining cryptic error messages&lt;/li&gt;
&lt;li&gt;Spotting typos you've looked past 10 times&lt;/li&gt;
&lt;li&gt;Suggesting the obvious fix you somehow missed&lt;/li&gt;
&lt;li&gt;Writing boilerplate test cases that confirm the fix works&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You focus on the hard stuff—understanding &lt;em&gt;why&lt;/em&gt; the bug happened, designing a better system so it doesn't happen again.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Doesn't Work
&lt;/h2&gt;

&lt;p&gt;I've tried asking AI to debug production outages without logs. Spoiler: it's useless. AI is great at explaining things, not great at guessing. Give it the data, it helps. Leave it guessing, you get a confident hallucination.&lt;/p&gt;

&lt;p&gt;Also, AI is slower at fixing really new problems. If you're working with brand-new libraries or unusual patterns, AI might not have seen enough examples to help. Fall back to docs and experimentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Honest Truth
&lt;/h2&gt;

&lt;p&gt;You're still the debugger. AI just moves faster. Think of it like autocomplete for debugging—you still drive, it just knows common patterns and points out what you might've missed.&lt;/p&gt;

&lt;p&gt;The developers I know who got good with AI tools aren't the ones who stopped thinking. They're the ones who think &lt;em&gt;faster&lt;/em&gt;, asking clearer questions and confirming better.&lt;/p&gt;




&lt;p&gt;Want to stay sharp with new tools and techniques? I write about practical AI, productivity systems, and real developer problems over at &lt;strong&gt;&lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt;&lt;/strong&gt;—no fluff, just stuff that works.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>productivity</category>
      <category>devtools</category>
    </item>
    <item>
      <title>Why Your Prompt Templates Aren't Working (And How to Fix Them)</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Sat, 01 Aug 2026 15:00:39 +0000</pubDate>
      <link>https://dev.to/learnairesource/why-your-prompt-templates-arent-working-and-how-to-fix-them-1p6b</link>
      <guid>https://dev.to/learnairesource/why-your-prompt-templates-arent-working-and-how-to-fix-them-1p6b</guid>
      <description>&lt;p&gt;You spent 3 hours crafting the "perfect" prompt template. You saved it. You reused it a hundred times. And somewhere around try #47, you realized it only works like 60% of the time.&lt;/p&gt;

&lt;p&gt;Sound familiar?&lt;/p&gt;

&lt;p&gt;This is the dirty secret nobody talks about with AI tools. You can't just template-ize prompts like they're database queries. Every context is different, every code base is weird in its own way, and what works Tuesday breaks on Wednesday.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Template Trap
&lt;/h2&gt;

&lt;p&gt;Here's what people usually try:&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 an expert [ROLE].
Your task is to [TASK].
Follow these rules:
- Rule 1: [RULE]
- Rule 2: [RULE]
Analyze the following: [INPUT]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then they fill in the brackets and hope. Sometimes it works. Sometimes you get garbage.&lt;/p&gt;

&lt;p&gt;The problem? &lt;strong&gt;You're treating AI like a function with fixed inputs.&lt;/strong&gt; It's not. You're working with a probabilistic system that responds to context, tone, and specificity in ways you can't fully predict.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Actually Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Context Over Structure
&lt;/h3&gt;

&lt;p&gt;Instead of rigid templates, build &lt;strong&gt;modular context blocks&lt;/strong&gt; you can mix and match.&lt;/p&gt;

&lt;p&gt;Bad approach:&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 code for bugs.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good approach:&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="nx"&gt;I&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;m debugging a Node.js service that handles real-time WebSocket connections. 
The app crashes randomly under load (&amp;gt;500 concurrent connections).
I&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;ve&lt;/span&gt; &lt;span class="nx"&gt;already&lt;/span&gt; &lt;span class="nx"&gt;checked&lt;/span&gt; &lt;span class="nx"&gt;logs&lt;/span&gt;&lt;span class="err"&gt;—&lt;/span&gt;&lt;span class="nx"&gt;no&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;just&lt;/span&gt; &lt;span class="nx"&gt;hard&lt;/span&gt; &lt;span class="nx"&gt;exits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;Here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s the relevant code:
[CODE]

What would cause a silent exit without logging?
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference? You're giving the AI &lt;em&gt;your actual problem&lt;/em&gt;, not a generic template.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Fail Gracefully, Then Ask
&lt;/h3&gt;

&lt;p&gt;Don't expect one prompt to solve everything. Build a two-stage process:&lt;/p&gt;

&lt;p&gt;Stage 1: Quick sanity check&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Does this look normal to you? (Yes/No + brief reason)
[CODE SNIPPET]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stage 2: If it fails, deep dive&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Something's wrong here. Let me give you more context:
[FULL LOGS]
[SYSTEM INFO]
[WHAT I'VE ALREADY TRIED]

Why might this be happening?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't laziness—it's how you actually debug. You don't throw your entire codebase at a senior dev and say "fix it." You describe the symptom, get feedback, then dig deeper.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Examples Beat Rules
&lt;/h3&gt;

&lt;p&gt;Instead of telling AI what to do, show it.&lt;/p&gt;

&lt;p&gt;Bad:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write clear comments in casual developer language.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good:&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="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;want&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="nx"&gt;like&lt;/span&gt; &lt;span class="nx"&gt;these&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="c1"&gt;// lol this is why we cache the user object&lt;/span&gt;
&lt;span class="c1"&gt;// setTimeout hack because the API is trash at batching&lt;/span&gt;
&lt;span class="c1"&gt;// TODO: replace this with actual error handling someday&lt;/span&gt;

&lt;span class="nx"&gt;Write&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;following&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;CODE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Show examples of your actual voice, your actual style. AI will match the pattern much better than it matches abstract rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Temperature Matters (But Not How You Think)
&lt;/h3&gt;

&lt;p&gt;You can't just blast everything with max temperature hoping for creativity. Different tasks need different settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;0.3-0.5&lt;/strong&gt;: Code generation, bug fixes, technical facts (low variance, high consistency)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0.7&lt;/strong&gt;: Content writing, brainstorming ideas, refactoring suggestions (balance of creativity + reliability)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0.9+&lt;/strong&gt;: Creative writing, naming things, weird edge cases (throw at the wall and see what sticks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your template works for code but fails for copy, you might just need different temperature settings for different prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Pattern
&lt;/h2&gt;

&lt;p&gt;Successful prompt workflows look less like "one perfect template" and more like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start stupid&lt;/strong&gt; - Ask the simplest version of your question&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provide feedback&lt;/strong&gt; - "That's close but..." or "You're on the right track..."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterate&lt;/strong&gt; - Include the previous response in the next prompt&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Converge&lt;/strong&gt; - It gets better with each loop&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is actually how you'd work with a junior dev. And it works with AI tools too.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real Example
&lt;/h2&gt;

&lt;p&gt;I needed to refactor some gnarly TypeScript. Here's how it actually went:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt 1:&lt;/strong&gt;&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="nx"&gt;Can&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;refactor&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;more&lt;/span&gt; &lt;span class="nx"&gt;readable&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;FUNCTION&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got back something overly clever. Not what I wanted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt 2:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;That's too clever. I need it simple and obvious, not fancy.
The priority is "someone new to the codebase understands this immediately."
Try again with that goal.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Better, but missed a pattern I wanted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt 3:&lt;/strong&gt;&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="nx"&gt;You&lt;/span&gt; &lt;span class="nx"&gt;got&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;mostly&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;One&lt;/span&gt; &lt;span class="nx"&gt;more&lt;/span&gt; &lt;span class="nx"&gt;thing&lt;/span&gt;&lt;span class="err"&gt;—&lt;/span&gt;&lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;extract&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; 
&lt;span class="nx"&gt;validation&lt;/span&gt; &lt;span class="nx"&gt;logic&lt;/span&gt; &lt;span class="nx"&gt;into&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;separate&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;want&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;unit&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;Otherwise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;keep&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;rest&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;is&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done. Three prompts, each building on the previous.&lt;/p&gt;

&lt;p&gt;Could I have written a "perfect template" that nailed it in one shot? Maybe. But it would've taken longer to design than just iterating three times.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Productivity Hack
&lt;/h2&gt;

&lt;p&gt;Stop trying to make templates that work for all cases. Instead:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep a prompt playbook&lt;/strong&gt; - Not templates, but starting points&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note what works&lt;/strong&gt; - When something lands well, write down what made it work&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reuse patterns, not exact text&lt;/strong&gt; - "How do I structure a prompt for X type of task?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterate like you mean it&lt;/strong&gt; - Treat each response as feedback, not the final answer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your prompts will get better, faster, and more reliable.&lt;/p&gt;

&lt;p&gt;The irony? You'll end up with templates that work &lt;em&gt;because&lt;/em&gt; you stopped trying to make generic ones.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want to stay on top of AI tools, productivity hacks, and developer resources that actually matter?&lt;/strong&gt; Check out &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt; for curated insights that'll actually help you ship faster.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>javascript</category>
      <category>developer</category>
    </item>
    <item>
      <title>AI-Assisted Code Reviews: Your New Pair Programmer</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Fri, 31 Jul 2026 15:00:32 +0000</pubDate>
      <link>https://dev.to/learnairesource/ai-assisted-code-reviews-your-new-pair-programmer-2mf4</link>
      <guid>https://dev.to/learnairesource/ai-assisted-code-reviews-your-new-pair-programmer-2mf4</guid>
      <description>&lt;h1&gt;
  
  
  AI-Assisted Code Reviews: Your New Pair Programmer
&lt;/h1&gt;

&lt;p&gt;Let's be real—code reviews are necessary but tedious. You're already tired, and now you have to nitpick someone's variable names while staying constructive. What if you had a second pair of eyes that never gets grumpy?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Manual Reviews
&lt;/h2&gt;

&lt;p&gt;Manual code reviews catch bugs, but they're slow. They're also subjective. One reviewer gets picky about formatting, another misses the logic error entirely. And if you're working async across timezones? Review turnaround can tank productivity.&lt;/p&gt;

&lt;p&gt;Plus, junior devs often don't know what to look for. They'll approve code that has subtle performance issues or security holes because they haven't seen that pattern before.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AI Approach (Actually Works)
&lt;/h2&gt;

&lt;p&gt;Tools like Claude, ChatGPT, and specialized models like GitHub's Copilot can review code in seconds. But here's the trick: they're not replacing your reviews. They're handling the grunt work.&lt;/p&gt;

&lt;p&gt;Here's what I've done with real projects:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Automated pre-review screening&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before code hits your team, run it through Claude or a specialized linter AI. Input the diff. Get back:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Obvious bugs (null pointer risks, off-by-one errors)&lt;/li&gt;
&lt;li&gt;Security issues (SQL injection, unvalidated inputs)&lt;/li&gt;
&lt;li&gt;Performance flags (unnecessary loops, memory leaks)&lt;/li&gt;
&lt;li&gt;Style inconsistencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This takes 10 seconds instead of 5 minutes of human eyeballs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Context-aware suggestions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Paste the code with context—what it's supposed to do, the architecture it fits into. Ask Claude specifically: "Does this integrate cleanly with our existing cache layer?"&lt;/p&gt;

&lt;p&gt;Real example: A junior dev wrote a fetch function that re-initialized the database connection every call. Claude spotted it immediately, suggested using a connection pool, and even provided a refactor. Without AI, that would've gone to production and caused latency issues a week later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Test coverage analysis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Paste the code and ask: "What edge cases aren't covered by tests?" &lt;/p&gt;

&lt;p&gt;The model will typically catch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Null/undefined handling&lt;/li&gt;
&lt;li&gt;Boundary conditions&lt;/li&gt;
&lt;li&gt;Error state handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then your team's review focuses on the business logic and architecture decisions—the stuff that actually matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Workflow
&lt;/h2&gt;

&lt;p&gt;Here's how I actually use this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Developer submits PR&lt;/li&gt;
&lt;li&gt;GitHub Actions runs tests + AI review (takes 30 seconds)&lt;/li&gt;
&lt;li&gt;AI comments appear automatically: "Line 47: Potential race condition if X happens"&lt;/li&gt;
&lt;li&gt;Developer sees it instantly, fixes it or responds&lt;/li&gt;
&lt;li&gt;Human reviewer then looks at a cleaner PR, focuses on design decisions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You're not replacing humans. You're making human review faster and smarter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools Worth Your Time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude API&lt;/strong&gt; (v3.5 Sonnet is solid for code) — $3-5 per review, batched&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Copilot for Business&lt;/strong&gt; — integrated into GitHub, no per-review cost&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SonarCloud&lt;/strong&gt; — traditional, but good at security patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DeepSource&lt;/strong&gt; — AI-native code quality, growing fast&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pick one that fits your workflow. Most have free tiers if you want to experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Catch
&lt;/h2&gt;

&lt;p&gt;AI isn't perfect. It'll sometimes flag false positives (variable named &lt;code&gt;result&lt;/code&gt; → "avoid generic names"). It might miss context-specific issues (why you're doing something the "wrong way" intentionally).&lt;/p&gt;

&lt;p&gt;So: &lt;strong&gt;Human + AI = 10x better than either alone.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Wins You Can Try Today
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Take your last three failed deploys. Run the code through Claude. Would it have caught them?&lt;/li&gt;
&lt;li&gt;Grab a recent PR that had bugs found in QA. Ask an AI to review it blind. Did it catch what humans missed?&lt;/li&gt;
&lt;li&gt;Time a manual review vs AI review of the same code. Measure the delta.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You'll probably find AI catches the boring stuff while humans catch the subtle design flaws. That's exactly how it should work.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want more practical AI tools for developers?&lt;/strong&gt; Check out &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt;—it's a solid resource for staying updated on what actually works (not the hype).&lt;/p&gt;

</description>
      <category>ai</category>
      <category>codenewbie</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Stop Code Reviewing in the Dark: How Claude Became My Unofficial Senior Dev</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Thu, 30 Jul 2026 15:00:38 +0000</pubDate>
      <link>https://dev.to/learnairesource/stop-code-reviewing-in-the-dark-how-claude-became-my-unofficial-senior-dev-3lk9</link>
      <guid>https://dev.to/learnairesource/stop-code-reviewing-in-the-dark-how-claude-became-my-unofficial-senior-dev-3lk9</guid>
      <description>&lt;p&gt;You know that feeling when you ship code and three days later you're staring at a Slack message saying "hey, did you consider X?" Yeah, I lived that life too. Now I don't.&lt;/p&gt;

&lt;p&gt;Here's the thing: code review tools show you &lt;em&gt;syntax&lt;/em&gt; problems. Claude shows you &lt;em&gt;logic&lt;/em&gt; problems. Architecture issues. Performance gotchas. The stuff that makes you go "oh crap, I didn't think about that" at 2 AM.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Traditional Code Review
&lt;/h2&gt;

&lt;p&gt;Your team's doing their best. PR comments are helpful. But let's be honest: by the time someone reviews your code, they're context-switching from six other things. You get surface-level feedback. Typos, naming conventions, maybe a "consider using a Set here instead of an Array" comment if you're lucky.&lt;/p&gt;

&lt;p&gt;The deeper stuff? The stuff that bites you in prod? That slips through because it's not visibly broken—it's just... &lt;em&gt;fragile&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Actually Use Claude Now
&lt;/h2&gt;

&lt;p&gt;I treat Claude like a senior dev who's read every architecture book and never has a bad day. Here's my actual workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Paste the code.&lt;/strong&gt; Just dump it. I usually include the function and maybe 10 lines of context.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserPosts&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="nx"&gt;limit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&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;posts&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;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM posts WHERE user_id = $1 LIMIT $2&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;limit&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;posts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Is&lt;/span&gt; &lt;span class="nx"&gt;there&lt;/span&gt; &lt;span class="nx"&gt;anything&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;should&lt;/span&gt; &lt;span class="nx"&gt;think&lt;/span&gt; &lt;span class="nx"&gt;about&lt;/span&gt; &lt;span class="nx"&gt;here&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;Step 2: Ask specific questions.&lt;/strong&gt; Don't just say "review this." Say what you care about.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Will this scale if we hit 100K users?"&lt;/li&gt;
&lt;li&gt;"What security issues do you see?"&lt;/li&gt;
&lt;li&gt;"Is my error handling solid?"&lt;/li&gt;
&lt;li&gt;"Show me three ways this could break in production."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Read the response like it's gospel.&lt;/strong&gt; Not because Claude's always right—it's not—but because it's &lt;em&gt;usually&lt;/em&gt; right, and the mental model it gives you is gold.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real example:&lt;/strong&gt; I pasted a caching function that I thought was solid. Claude said: "What happens if two requests hit this simultaneously while the cache is empty? You'll spawn two identical DB queries instead of waiting for the first one."&lt;/p&gt;

&lt;p&gt;Mind blown. I'd shipped that exact pattern three times. Never caught it in review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Patterns That Actually Work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The "rubber duck, but smarter" pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm trying to optimize this API endpoint. It's handling 500 requests/second but I'm seeing memory climb. Here's what I'm doing:&lt;/p&gt;

&lt;p&gt;[paste code]&lt;/p&gt;

&lt;p&gt;What's the leak?&lt;/p&gt;

&lt;p&gt;Claude will usually spot N+1 queries, closure leaks, or unresolved promises before your APM tools even notice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The "what could go wrong" pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This function validates user input for a payment form. Assume the worst-case scenario. What's the exploit vector?&lt;/p&gt;

&lt;p&gt;[paste code]&lt;/p&gt;

&lt;p&gt;You'll catch SQL injection risks, auth bypasses, or race conditions that would've turned into a 2 AM incident.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The "am I overthinking this" pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm about to refactor this whole service to use a message queue. Is that actually necessary, or am I solving the wrong problem?&lt;/p&gt;

&lt;p&gt;[paste code + context]&lt;/p&gt;

&lt;p&gt;Claude will tell you if you're optimizing prematurely or if you're about to dodge a bullet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Beats Other Approaches
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;vs. linters:&lt;/strong&gt; Linters catch style. Claude catches intent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vs. static analysis:&lt;/strong&gt; Tools like SonarQube flag issues. Claude explains &lt;em&gt;why&lt;/em&gt; it's an issue and &lt;em&gt;how&lt;/em&gt; to fix it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vs. humans:&lt;/strong&gt; Humans are slower, more tired, and context-switching. Claude reads your code at 3 AM like it's the most important thing in the world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vs. doing nothing:&lt;/strong&gt; Yeah, we know this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Catch
&lt;/h2&gt;

&lt;p&gt;Claude's not perfect. Sometimes it gives you answer-shaped hallucinations. Sometimes it misses context. The move:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Treat it like a suggestion, not law.&lt;/strong&gt; If something feels off, dig in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask follow-up questions.&lt;/strong&gt; "Why would that be a problem? Show me an example."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the advice.&lt;/strong&gt; Run the refactored code. See if it's actually faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare to your actual metrics.&lt;/strong&gt; If Claude says something's a bottleneck but your profiler says otherwise, trust the profiler.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Real Benefit
&lt;/h2&gt;

&lt;p&gt;After three months of doing this, something weird happened: I started &lt;em&gt;thinking&lt;/em&gt; like Claude was looking over my shoulder. I'd catch my own issues before pasting. Architecture decisions got better. I stopped shipping the same types of bugs.&lt;/p&gt;

&lt;p&gt;That's the actual win. Not that Claude reviews your code—it's that you internalize better practices through the dialogue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try This Tomorrow
&lt;/h2&gt;

&lt;p&gt;Pick one function you shipped recently that you've thought twice about. Paste it to Claude with "What's wrong with this?" and see what comes back.&lt;/p&gt;

&lt;p&gt;Odds are: you'll learn something. Something you'll use on the next function.&lt;/p&gt;

&lt;p&gt;That's how you build better code. One review at a time.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want to stay sharp on developer tools like this?&lt;/strong&gt; Check out &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly newsletter&lt;/a&gt; for practical AI + productivity patterns that actually land in your workflows.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>productivity</category>
      <category>coding</category>
    </item>
    <item>
      <title>Building Production AI Features Without Becoming an ML Engineer</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Wed, 29 Jul 2026 15:00:59 +0000</pubDate>
      <link>https://dev.to/learnairesource/building-production-ai-features-without-becoming-an-ml-engineer-25cn</link>
      <guid>https://dev.to/learnairesource/building-production-ai-features-without-becoming-an-ml-engineer-25cn</guid>
      <description>&lt;h1&gt;
  
  
  Building Production AI Features Without Becoming an ML Engineer
&lt;/h1&gt;

&lt;p&gt;You don't need a PhD in machine learning to ship AI features. Seriously. I've watched developers over-engineer solutions when they could've grabbed Claude's API, thrown some prompts at it, and shipped.&lt;/p&gt;

&lt;p&gt;Here's the real talk: the hardest part isn't the ML. It's knowing what to actually build and not gold-plating it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Changed (And Why You Should Care)
&lt;/h2&gt;

&lt;p&gt;Two years ago, using AI in production meant dealing with model deployment, scaling issues, and weird edge cases. Now? You call an API. The model sits somewhere else. Your job is wiring it into your app smartly.&lt;/p&gt;

&lt;p&gt;The shift: from "build ML systems" to "integrate intelligence into your existing app."&lt;/p&gt;

&lt;h2&gt;
  
  
  Three Patterns That Actually Work
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The Classifier (Replace Your Decision Trees)
&lt;/h3&gt;

&lt;p&gt;Got complex logic for routing, categorization, or prioritization? Stop writing cascading if-statements.&lt;/p&gt;

&lt;p&gt;Real example: Triaging support tickets by urgency and category.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;classifyTicket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ticketText&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.anthropic.com/v1/messages&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="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&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="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;claude-opus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&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="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="s2"&gt;`Classify this support ticket:

Ticket: "&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;ticketText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"

Respond in JSON:
{
  "category": "billing|technical|feature_request|other",
  "urgency": "critical|high|normal|low",
  "reason": "one sentence why"
}`&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&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;content&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;text&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&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;Why this beats hardcoded rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New edge case comes up? Retrain is literally just... running it again&lt;/li&gt;
&lt;li&gt;Your rules scale with real-world messiness, not your imagination&lt;/li&gt;
&lt;li&gt;Takes 20 minutes instead of 3 hours of conditional hell&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The Extractor (Stop Writing Regex)
&lt;/h3&gt;

&lt;p&gt;Parsing semi-structured text is a nightmare. Regex lies to you. Parsing libraries are overkill.&lt;/p&gt;

&lt;p&gt;Real example: Extracting structured data from invoice PDFs or email content.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;extractInvoiceData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;invoiceText&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.anthropic.com/v1/messages&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="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&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="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;claude-opus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&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="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="s2"&gt;`Extract structured data from this invoice:

&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;invoiceText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;

Return JSON:
{
  "vendor": "company name",
  "invoice_number": "string",
  "amount": number,
  "due_date": "YYYY-MM-DD",
  "line_items": [
    { "description": string, "quantity": number, "price": number }
  ]
}`&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&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;content&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;text&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&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;Why this beats parsing libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles fuzzy, human-written formats naturally&lt;/li&gt;
&lt;li&gt;Extracts &lt;em&gt;meaning&lt;/em&gt;, not just patterns&lt;/li&gt;
&lt;li&gt;One function handles 10 different invoice formats&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. The Brainstormer (Augment, Don't Replace, Users)
&lt;/h3&gt;

&lt;p&gt;This one trips people up. Don't ask AI to make decisions for your users. Ask it to give them options or spark ideas.&lt;/p&gt;

&lt;p&gt;Real example: Content recommendation or idea generation.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;generatePostIdeas&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tone&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.anthropic.com/v1/messages&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="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&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="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;claude-opus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&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="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="s2"&gt;`Generate 5 blog post ideas about "&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;" in a &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;tone&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; tone.

For each idea:
- Title (under 60 chars)
- Angle (what's different about this take)
- Why readers will click

Make them concrete, not generic.`&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;content&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;text&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;Why this works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users make the final call (they should)&lt;/li&gt;
&lt;li&gt;Saves them 10 minutes of blank page syndrome&lt;/li&gt;
&lt;li&gt;You're helping, not automating away the human part&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Gotchas (Real Ones)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cost creeps up quietly.&lt;/strong&gt; Log your token usage. A classifier running 10k times/day at $0.015 per 1k tokens adds up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Latency matters more than you think.&lt;/strong&gt; If your classifier takes 2 seconds, that's a bad UX when it was instant before. Use streaming for longer outputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bad prompts = bad output.&lt;/strong&gt; Spend 15 minutes on the prompt. Iterate. Test edge cases. Your prompt IS your model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context is cheap until it isn't.&lt;/strong&gt; Send relevant context, not your whole database. 100k tokens gets expensive fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Setup
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pick a provider.&lt;/strong&gt; Claude (Anthropic), OpenAI, Cohere. They're all solid. Pick one and learn it deeply instead of context-switching.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Environment variables, not hardcoding.&lt;/strong&gt; &lt;code&gt;process.env.ANTHROPIC_API_KEY&lt;/code&gt;. Every time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Timeouts and retries.&lt;/strong&gt; APIs go down. Network hiccups happen. Handle gracefully:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;callAIWithRetry&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="nx"&gt;maxRetries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&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;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;maxRetries&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&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;try&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(...,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30000&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;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&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;i&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;maxRetries&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test the outputs.&lt;/strong&gt; Have a human review sample results. Bad data will hide until production.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What You Actually Need to Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Prompt engineering (the real skill now)&lt;/li&gt;
&lt;li&gt;Token counting (so cost surprises don't happen)&lt;/li&gt;
&lt;li&gt;How to frame problems so the API understands them&lt;/li&gt;
&lt;li&gt;Error handling (APIs are flakey)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need to learn transformers, backpropagation, or linear algebra.&lt;/p&gt;

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

&lt;p&gt;Pick one small thing in your app that could use intelligence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classifying something&lt;/li&gt;
&lt;li&gt;Extracting data from text&lt;/li&gt;
&lt;li&gt;Generating variations of content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Build it in an afternoon. Deploy it Monday. Measure if it actually helps.&lt;/p&gt;

&lt;p&gt;Don't wait for the perfect setup. The barrier is lower than you think.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Want more on AI in production?&lt;/strong&gt; &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;Subscribe to LearnAI Weekly&lt;/a&gt; for practical tips on shipping AI features without the hype. Real examples, real code, no buzzwords.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>production</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Stop Reviewing Code Like It's 2020: An AI-First Workflow That Actually Works</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Tue, 28 Jul 2026 15:00:33 +0000</pubDate>
      <link>https://dev.to/learnairesource/stop-reviewing-code-like-its-2020-an-ai-first-workflow-that-actually-works-27m2</link>
      <guid>https://dev.to/learnairesource/stop-reviewing-code-like-its-2020-an-ai-first-workflow-that-actually-works-27m2</guid>
      <description>&lt;p&gt;Your PR review process is probably slow. Someone reads 400 lines of code, gets distracted by the formatting, misses the actual logic bug, and then two weeks later production breaks because nobody caught it.&lt;/p&gt;

&lt;p&gt;Here's the reality: AI is better at spotting certain issues than you are. Not all issues. But some. And if you're not using it to handle the tedious parts, you're throwing away 20% of your time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Old Way vs. The Actually Useful Way
&lt;/h2&gt;

&lt;p&gt;Dumping your entire codebase into ChatGPT and asking "is this good?" doesn't work. That's cargo cult programming.&lt;/p&gt;

&lt;p&gt;What &lt;em&gt;does&lt;/em&gt; work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Automated format &amp;amp; lint checks&lt;/strong&gt; (your CI should handle this)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI for security pattern matching&lt;/strong&gt; (using focused prompts)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI for test coverage gaps&lt;/strong&gt; (it's surprisingly good at this)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Humans for business logic and architecture&lt;/strong&gt; (keep this)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The split matters. Don't ask AI to judge whether your architecture is elegant. &lt;em&gt;Do&lt;/em&gt; ask it to find the off-by-one error in your loop or spot the unhandled exception.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Setup That Takes 30 Minutes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Use Claude or GPT for Pattern-Based Reviews
&lt;/h3&gt;

&lt;p&gt;Create a simple script that sends isolated functions to an LLM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Extract a function from your PR&lt;/span&gt;
git diff HEAD~1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; 20 &lt;span class="s2"&gt;"^+"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/changes.txt

&lt;span class="c"&gt;# Send to Claude via API&lt;/span&gt;
curl https://api.anthropic.com/v1/messages &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;ANTHROPIC_API_KEY"&lt;/span&gt; &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"content-type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; @- &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
{
  "model": "claude-opus-4-1",
  "max_tokens": 500,
  "system": "You are a code reviewer. Find: (1) security issues, (2) memory leaks, (3) off-by-one errors, (4) missing null checks. Return ONLY the issues found, not praise.",
  "messages": [{"role": "user", "content": "Review this code change:&lt;/span&gt;&lt;span class="se"&gt;\n\n\$&lt;/span&gt;&lt;span class="sh"&gt;(cat /tmp/changes.txt)"}]
}
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This takes 3 seconds. It catches about 60% of real bugs that make it past your eyes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Test Coverage Analysis
&lt;/h3&gt;

&lt;p&gt;AI is weirdly good at spotting what &lt;em&gt;should&lt;/em&gt; be tested but isn't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run coverage report, send to Claude&lt;/span&gt;
coverage report &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;json | curl https://api.anthropic.com/v1/messages &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;ANTHROPIC_API_KEY"&lt;/span&gt; &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"model": "claude-opus-4-1", "max_tokens": 300, "messages": [{"role": "user", "content": "Given this test coverage report, what critical paths are missing test cases?\n\n\$(cat /tmp/coverage.json)"}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get a ranked list of "you probably need to test this" suggestions. Often right.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: The Human Part (The Actually Important Part)
&lt;/h3&gt;

&lt;p&gt;Once the AI handles security patterns and test gaps, your human review becomes sharper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does this solve the actual problem?&lt;/li&gt;
&lt;li&gt;Will this scale?&lt;/li&gt;
&lt;li&gt;Did we miss a cheaper approach?&lt;/li&gt;
&lt;li&gt;Is the API design intuitive for callers?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are &lt;em&gt;judgment calls&lt;/em&gt;. They're what you're paid for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Example: Catching the Subtle Ones
&lt;/h2&gt;

&lt;p&gt;I ran this workflow on a real PR last week. The change was a refactor of our caching layer:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the author caught:&lt;/strong&gt; "I moved the TTL calculation to a helper function."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the AI caught:&lt;/strong&gt; "The helper function doesn't validate that &lt;code&gt;ttl &amp;gt; 0\&lt;/code&gt;. If a config value is negative, this silently caches forever."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I caught:&lt;/strong&gt; "Agree with AI, and we should bump up the integration test coverage here because this is a common config mistake."&lt;/p&gt;

&lt;p&gt;All three caught different things. The AI would've missed the business judgment; humans would've missed the silent-forever-cache bug; the linter wouldn't care because there's no syntax error.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Tools I Actually Use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cursor&lt;/strong&gt; or &lt;strong&gt;GitHub Copilot&lt;/strong&gt; for in-editor suggestions (saves time, usually accurate)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude via API&lt;/strong&gt; for structured code reviews (best at finding real logic bugs)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shellcheck&lt;/strong&gt; and &lt;strong&gt;pylint&lt;/strong&gt; for the stuff you don't need AI for (it's free automation)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the newsletter link, if you're staying on top of AI and productivity trends, grab the weekly dose at &lt;strong&gt;&lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;https://learnairesource.com/newsletter&lt;/a&gt;&lt;/strong&gt; — it's the good stuff without the hype.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Honest Part
&lt;/h2&gt;

&lt;p&gt;AI code review isn't magic. It won't replace code review. It will replace the boring parts of code review — the parts where you skim looking for &lt;code&gt;null\&lt;/code&gt; checks and buffer overflows.&lt;/p&gt;

&lt;p&gt;And honestly? Your brain is better used thinking about system design than hunting for typos.&lt;/p&gt;

&lt;p&gt;Use the tool for what it's good at. Keep humans in charge of what matters.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>codereview</category>
      <category>developer</category>
    </item>
    <item>
      <title>How AI Context Windows Changed My Code Review Process (And Yours Can Too)</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Mon, 27 Jul 2026 15:00:37 +0000</pubDate>
      <link>https://dev.to/learnairesource/how-ai-context-windows-changed-my-code-review-process-and-yours-can-too-28ji</link>
      <guid>https://dev.to/learnairesource/how-ai-context-windows-changed-my-code-review-process-and-yours-can-too-28ji</guid>
      <description>&lt;p&gt;If you're still copy-pasting code snippets one at a time into Claude or ChatGPT for reviews, you're leaving massive productivity on the table.&lt;/p&gt;

&lt;p&gt;Last month, I started throwing entire pull requests—full diffs, test files, related modules—into a single prompt. The difference? I stopped getting generic advice about "code quality" and started getting &lt;em&gt;specific&lt;/em&gt;, actionable feedback on &lt;em&gt;actual&lt;/em&gt; architectural problems in my codebase.&lt;/p&gt;

&lt;p&gt;This isn't rocket science. It's just using the tools we have better.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Old Way (And Why It Sucked)
&lt;/h2&gt;

&lt;p&gt;You'd ask: "Review this function."&lt;/p&gt;

&lt;p&gt;AI would say: "Consider adding error handling and type safety."&lt;/p&gt;

&lt;p&gt;You'd think: "Cool, thanks, totally unhelpful."&lt;/p&gt;

&lt;p&gt;Why? Context. Without seeing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What this function is actually used for&lt;/li&gt;
&lt;li&gt;What the error cases look like&lt;/li&gt;
&lt;li&gt;How the surrounding code handles similar problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...an AI is just following a checklist. It's not reviewing &lt;em&gt;your code&lt;/em&gt;. It's reviewing a snippet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The New Way: Dump Everything
&lt;/h2&gt;

&lt;p&gt;Here's what I started doing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pull the full PR diff&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git diff main..feature/my-branch &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/pr.diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Include related files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The test file for this feature&lt;/li&gt;
&lt;li&gt;Any module imports&lt;/li&gt;
&lt;li&gt;The types/interfaces being used&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dump it all in one prompt&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Here's a PR for a new authentication system. 

   Context:
   - We're replacing JWT with session-based auth
   - The old code used Redis
   - We're keeping backward compatibility for 30 days

   [full diff here]
   [test file here]
   [schema file here]

   What am I missing? What breaks in production?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Get actual feedback&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;"Your session timeout doesn't account for timezone changes in DST"&lt;/li&gt;
&lt;li&gt;"You're not invalidating related sessions when a user changes their password"&lt;/li&gt;
&lt;li&gt;"This migration path will cause issues with concurrent requests"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Real problems. Not templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Modern LLMs Finally Make This Work
&lt;/h2&gt;

&lt;p&gt;A year ago, context windows were small. Now? Claude has 200K tokens. GPT-4 has 128K. You can fit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A full microservice (10-15 files)&lt;/li&gt;
&lt;li&gt;Complete test suite&lt;/li&gt;
&lt;li&gt;Related API endpoints&lt;/li&gt;
&lt;li&gt;Database schema&lt;/li&gt;
&lt;li&gt;Architecture diagrams as text&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All in one shot.&lt;/p&gt;

&lt;p&gt;Plus, models got &lt;em&gt;better&lt;/em&gt; at reading code. They're not just pattern-matching against StackOverflow. They understand data flow, state management, and edge cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concrete Example: The Database Migration That Almost Broke
&lt;/h2&gt;

&lt;p&gt;Last week I had a schema migration that dropped a column but kept using it in a view. I almost shipped it.&lt;/p&gt;

&lt;p&gt;Instead, I threw at Claude:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current schema&lt;/li&gt;
&lt;li&gt;New migration&lt;/li&gt;
&lt;li&gt;The 12 queries that use this view&lt;/li&gt;
&lt;li&gt;The ORM mapping file&lt;/li&gt;
&lt;li&gt;Last 6 months of git history for that table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Single prompt: "What breaks if I run this migration on production with 50K active sessions?"&lt;/p&gt;

&lt;p&gt;Response: Three specific queries fail. Here's why. Here's how to fix it. Here's the deploy order that doesn't break anything.&lt;/p&gt;

&lt;p&gt;I literally prevented an outage. Saved maybe 4 hours of debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Set This Up (No Magic)
&lt;/h2&gt;

&lt;p&gt;You don't need special tools. Just:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Get a decent LLM with large context&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude 3.5 (200K tokens) ✅&lt;/li&gt;
&lt;li&gt;GPT-4o (128K tokens) ✅&lt;/li&gt;
&lt;li&gt;Llama 2 local (8K tokens) ❌ (too small)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Build a simple script to gather context&lt;/strong&gt; (optional but useful)&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
   &lt;span class="c"&gt;# collect-context.sh&lt;/span&gt;
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"=== Changed Files ==="&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/context.txt
   git diff &lt;span class="nt"&gt;--name-only&lt;/span&gt; main &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /tmp/context.txt

   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;=== Full Diff ==="&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /tmp/context.txt
   git diff main &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /tmp/context.txt

   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;=== Test Changes ==="&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /tmp/context.txt
   git diff main &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="s2"&gt;"*.test.ts"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /tmp/context.txt

   &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; /tmp/context.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask better questions&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Not: "Is this good?"&lt;/li&gt;
&lt;li&gt;But: "What breaks this? What's the worst case?"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Gotchas (Real Ones)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Garbage in, garbage out.&lt;/strong&gt; If your code is messy, the feedback is less useful. I've noticed AI catches way more issues in well-structured code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Token costs add up.&lt;/strong&gt; A full PR with context is 15-30K tokens. At $3 per 1M input tokens, you're spending $0.05-0.15 per review. Cheaper than a coffee. But do 50 reviews a day and it matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy matters.&lt;/strong&gt; If you're using cloud AI, you're sending your code to their servers. For open source? Fine. For proprietary stuff? Check your company's policy first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Still need humans.&lt;/strong&gt; An AI caught 6 real bugs in my last 10 reviews. But they also suggested 3 changes that looked good but would've broken product logic. You still need judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Changed in My Workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Before:&lt;/strong&gt; Copy-paste snippets, get generic advice, mostly ignore it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Now:&lt;/strong&gt; Full context dumps, specific feedback, actually implement it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Time spent? Same. Quality? Dramatically better.&lt;/p&gt;

&lt;p&gt;My advice: Pick one PR this week and try it. Dump the whole thing. See what happens.&lt;/p&gt;

&lt;p&gt;If you're writing about this stuff or want to dive deeper into AI productivity workflows, check out &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt;—they send solid real-world examples every week.&lt;/p&gt;

&lt;p&gt;What workflows are you using AI for? Hit me up on Twitter or drop a comment below.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>codenewbie</category>
      <category>devops</category>
    </item>
    <item>
      <title>Running LLMs Locally: The Productivity Hack Nobody's Talking About</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Sun, 26 Jul 2026 15:00:28 +0000</pubDate>
      <link>https://dev.to/learnairesource/running-llms-locally-the-productivity-hack-nobodys-talking-about-5doo</link>
      <guid>https://dev.to/learnairesource/running-llms-locally-the-productivity-hack-nobodys-talking-about-5doo</guid>
      <description>&lt;h1&gt;
  
  
  Running LLMs Locally: The Productivity Hack Nobody's Talking About
&lt;/h1&gt;

&lt;p&gt;Here's the thing nobody tells you: you don't actually need to call OpenAI or Claude every time you want to use an LLM. I spent six months hammering the API limits before I realized I could just... run one on my machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why You Should Care
&lt;/h2&gt;

&lt;p&gt;Cloud APIs charge per token. It's 10 cents here, 25 cents there. Add up a few hundred API calls a day and suddenly you're dropping $30-50/month on what could've been a local inference problem.&lt;/p&gt;

&lt;p&gt;But that's not even the best part. Local LLMs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run offline (no sending code snippets to some server)&lt;/li&gt;
&lt;li&gt;Return results in milliseconds (no network latency)&lt;/li&gt;
&lt;li&gt;Let you use weird models that fit your exact use case&lt;/li&gt;
&lt;li&gt;Work in your dev environment without an internet connection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wasn't buying it either until I tried it. Switched to local Llama 2 for code completion, and my IDE response time went from "wait for the network" to instant.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup (30 minutes)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Get an LLM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Grab Ollama (ollama.ai) — it's the easiest path. It handles the model download, quantization, and serving automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Ollama, then run:&lt;/span&gt;
ollama pull mistral
ollama pull llama2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Mistral runs fine on 8GB RAM. If you've got 16GB, you can run Llama 2 70B with context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Start the Server&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you've got a local API server on &lt;code&gt;localhost:11434&lt;/code&gt;. Same format as OpenAI's API, except it's on your machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Use It&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:11434/api/generate &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{\"model\": \"mistral\", \"prompt\": \"Write a function to parse JSON\", \"stream\": false}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use any client that supports OpenAI-compatible APIs. The point is, it just works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Use Cases
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Code completion&lt;/strong&gt; — I run a smaller Mistral instance in the background while coding. When I'm stuck, I hit a keybind and get a suggestion instantly. No API call overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drafting documentation&lt;/strong&gt; — Generate first drafts of README files, docstrings, API docs. Edit locally, no billing surprises.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing prompts&lt;/strong&gt; — Building an AI feature? Test 50 variations of your prompt for free before paying for API calls to evaluate which one works best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy-sensitive work&lt;/strong&gt; — Client data stays on your machine. No questions asked.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Tradeoff
&lt;/h2&gt;

&lt;p&gt;Local models are cheaper and faster, but they're not as smart as the biggest cloud models. Mistral is solid for coding and general tasks. For complex reasoning or specialized domains, you might hit the ceiling.&lt;/p&gt;

&lt;p&gt;My system: use local models for 90% of stuff, reserve API calls for the 10% that needs reasoning power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Better Results
&lt;/h2&gt;

&lt;p&gt;Two things make a huge difference:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Prompt engineering&lt;/strong&gt; — Local models are pickier about prompts. Be explicit. Instead of "write a function," try "Write a Python function that takes a list of numbers and returns the median. Include type hints and a docstring."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. System prompts&lt;/strong&gt; — Set a good system message to guide the model's behavior. Something like "You are a helpful developer. Be concise. Provide code examples when relevant."&lt;/p&gt;

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

&lt;p&gt;Once you've got local inference running, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrate it into your dev environment with extensions&lt;/li&gt;
&lt;li&gt;Build a Chatbot around it for your team&lt;/li&gt;
&lt;li&gt;Use it in batch jobs for bulk text processing&lt;/li&gt;
&lt;li&gt;Chain multiple models for complex workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The barrier to entry is stupidly low now. If you're spending money on APIs for routine tasks, you're leaving optimization on the table.&lt;/p&gt;

&lt;p&gt;Try it this week. Spend 30 minutes getting Ollama running locally, then use it for one task you normally would've hit an API for. You'll either save money or learn why the cloud approach is worth it for your workflow.&lt;/p&gt;

&lt;p&gt;Either way, you'll know.&lt;/p&gt;




&lt;p&gt;Want to stay sharp on AI productivity trends? Check out &lt;strong&gt;&lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly&lt;/a&gt;&lt;/strong&gt; — real insights, no hype.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>llm</category>
      <category>dev</category>
    </item>
    <item>
      <title>Stop Prompt Engineering Everything: Smarter LLM API Patterns</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Sat, 25 Jul 2026 15:00:37 +0000</pubDate>
      <link>https://dev.to/learnairesource/stop-prompt-engineering-everything-smarter-llm-api-patterns-5ejg</link>
      <guid>https://dev.to/learnairesource/stop-prompt-engineering-everything-smarter-llm-api-patterns-5ejg</guid>
      <description>&lt;h1&gt;
  
  
  Stop Prompt Engineering Everything: Smarter LLM API Patterns
&lt;/h1&gt;

&lt;p&gt;So you've added an AI feature to your app. Congrats. Now you're debugging why it works great on Tuesdays but eats itself on Fridays. Here's the real talk: it's not about better prompts—it's about better patterns.&lt;/p&gt;

&lt;p&gt;I've watched teams throw tokens at the problem for months. The fix? Structuring how they &lt;em&gt;use&lt;/em&gt; the API, not begging the model to be smarter.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With "Better Prompting"
&lt;/h2&gt;

&lt;p&gt;Everyone's obsessed with crafting the perfect prompt. Chain of thought! Few-shot examples! Temperature tweaking! And yeah, that stuff matters. But it's like optimizing your website's CSS when the database query is doing a full table scan.&lt;/p&gt;

&lt;p&gt;The actual win is in &lt;strong&gt;how you structure your requests&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streaming vs. batch&lt;/li&gt;
&lt;li&gt;Context window management
&lt;/li&gt;
&lt;li&gt;Error handling and retry logic&lt;/li&gt;
&lt;li&gt;Token budgeting&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pattern 1: Structured Output Instead of Parsing Text
&lt;/h2&gt;

&lt;p&gt;This kills me. Teams send a prompt like "extract the name and email from this text, return it nicely formatted" and then regex their way through the response.&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;function calling&lt;/strong&gt; or schema validation instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&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="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-3-5-sonnet-20241022&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Extract person info from: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;extract_person&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Extract person details&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_schema&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;object&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;properties&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;string&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;email&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;string&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;company&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;string&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;required&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;email&lt;/span&gt;&lt;span class="sh"&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="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;Now you get JSON back. No parsing, no hallucinations, no "oops the model put HTML in there."&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 2: Batching for Cost &amp;amp; Speed
&lt;/h2&gt;

&lt;p&gt;Running inference one-by-one? You're leaving money on the table.&lt;/p&gt;

&lt;p&gt;If you're processing lists (emails, documents, support tickets), group them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Bad: 1000 API calls
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;call_api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Better: Batch messages, single call per batch
&lt;/span&gt;&lt;span class="n"&gt;batches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&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="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;batches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Process these 100 items: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;call_api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fewer round trips, cheaper, faster. The model handles batch processing fine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 3: Caching Context for Multi-Turn Interactions
&lt;/h2&gt;

&lt;p&gt;If your user's doing multiple actions in a session, you're re-sending the same context every time.&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;prompt caching&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&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="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-3-5-sonnet-20241022&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are a code reviewer. Maintain context across messages.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;large_codebase_or_docs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_control&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ephemeral&lt;/span&gt;&lt;span class="sh"&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="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Review this function...&lt;/span&gt;&lt;span class="sh"&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;p&gt;On the first call, it caches. Every followup in that session reuses it—cheaper and faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 4: Streaming for UX, Not Just Tokens
&lt;/h2&gt;

&lt;p&gt;Streaming isn't just for showing live responses. It's for validating early.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-3-5-sonnet-20241022&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;response_text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_stream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response_text&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;
        &lt;span class="c1"&gt;# Early exit if you detect something wrong
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can detect bad responses &lt;em&gt;as they stream in&lt;/em&gt;, not after 2000 tokens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 5: Exponential Backoff + Timeout for Real Systems
&lt;/h2&gt;

&lt;p&gt;Production APIs fail. Rate limits hit. Networks hiccup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RateLimitError&lt;/span&gt;

&lt;span class="n"&gt;max_retries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_retries&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&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="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-3-5-sonnet-20241022&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;RateLimitError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;wait_time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;  &lt;span class="c1"&gt;# 1s, 2s, 4s
&lt;/span&gt;        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Rate limited. Waiting &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;wait_time&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;s...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wait_time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;max_retries&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't just let it fail. Make it resilient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 6: Token Budget Your Prompts
&lt;/h2&gt;

&lt;p&gt;Know how many tokens you're spending per request. It sneaks up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;system_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;count_tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;system_prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;context_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;count_tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;required_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;  &lt;span class="c1"&gt;# for the response
&lt;/span&gt;
&lt;span class="n"&gt;available&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;system_tokens&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;context_tokens&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;required_output&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;available&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Truncate context or reject the request
&lt;/span&gt;    &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;truncate_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;available&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevents surprises. Keeps costs predictable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Win
&lt;/h2&gt;

&lt;p&gt;None of this is rocket science. It's just thinking about the API as a &lt;em&gt;system&lt;/em&gt;, not a magic box.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Structure your outputs so you don't parse text&lt;/li&gt;
&lt;li&gt;Batch when you can&lt;/li&gt;
&lt;li&gt;Cache context for multi-turn flows&lt;/li&gt;
&lt;li&gt;Stream to catch problems early&lt;/li&gt;
&lt;li&gt;Handle failures gracefully&lt;/li&gt;
&lt;li&gt;Know your token budget&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do this stuff and you'll spend less, go faster, and have way fewer "why did it work yesterday but not today" moments.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Stay sharp with AI development tips.&lt;/strong&gt; Subscribe to the &lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;LearnAI Weekly newsletter&lt;/a&gt; for patterns like these, real dev stories, and tool roundups.&lt;/p&gt;

&lt;p&gt;What patterns are you missing? Hit the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
      <category>developer</category>
    </item>
    <item>
      <title>Stop Pasting Stack Traces Into ChatGPT: A Better AI Debugging Workflow</title>
      <dc:creator>Learn AI Resource</dc:creator>
      <pubDate>Fri, 24 Jul 2026 15:00:33 +0000</pubDate>
      <link>https://dev.to/learnairesource/stop-pasting-stack-traces-into-chatgpt-a-better-ai-debugging-workflow-195j</link>
      <guid>https://dev.to/learnairesource/stop-pasting-stack-traces-into-chatgpt-a-better-ai-debugging-workflow-195j</guid>
      <description>&lt;h1&gt;
  
  
  Stop Pasting Stack Traces Into ChatGPT: A Better AI Debugging Workflow
&lt;/h1&gt;

&lt;p&gt;You know the dance. Your tests fail. You copy the error message, paste it into ChatGPT, get a generic answer that doesn't match your codebase, waste 20 minutes. Then you find the bug yourself in 2 minutes.&lt;/p&gt;

&lt;p&gt;There's a better way to use AI for debugging—one that actually saves time instead of creating this weird dependency where you feel like you &lt;em&gt;should&lt;/em&gt; use AI but it's not actually helping.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with Random Prompting
&lt;/h2&gt;

&lt;p&gt;Most developers treat AI like a debugging vending machine: throw error in, hope for solution out. The result? Generic advice that ignores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your specific tech stack&lt;/li&gt;
&lt;li&gt;How your code actually flows&lt;/li&gt;
&lt;li&gt;The real root cause (usually 3 layers deeper than the error message)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ChatGPT isn't a mind reader. It needs &lt;em&gt;context&lt;/em&gt;. Good context.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real Debugging Workflow
&lt;/h2&gt;

&lt;p&gt;Here's what I actually do when something breaks:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Stop and Read the Error First (Yes, Really)
&lt;/h3&gt;

&lt;p&gt;Spend 60 seconds looking at what the error is &lt;em&gt;actually&lt;/em&gt; saying. Not the error message—the &lt;em&gt;context&lt;/em&gt;. What function was running? What changed recently?&lt;/p&gt;

&lt;p&gt;Most bugs are one of five things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Off-by-one error&lt;/li&gt;
&lt;li&gt;Null/undefined value you didn't expect&lt;/li&gt;
&lt;li&gt;Type mismatch&lt;/li&gt;
&lt;li&gt;Race condition/timing issue&lt;/li&gt;
&lt;li&gt;Assumption that's no longer true&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Guess which one before you touch AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Isolate the Failure
&lt;/h3&gt;

&lt;p&gt;Reproduce it in isolation. Write a minimal test case. This isn't for AI—it's for &lt;em&gt;you&lt;/em&gt; to understand what's actually failing.&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;// Bad: "why isn't my API working?"&lt;/span&gt;
&lt;span class="c1"&gt;// Good: isolated test that fails&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;testCase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getUserById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&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;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Expected name to be John&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Smaller scope = clearer thinking = faster fix.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Use AI as a Rubber Duck, Not a Solver
&lt;/h3&gt;

&lt;p&gt;This is the key mindset shift. Instead of "fix this," ask yourself the question &lt;em&gt;out loud to AI&lt;/em&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I'm expecting &lt;code&gt;result&lt;/code&gt; to be an object with a &lt;code&gt;.name&lt;/code&gt; property. Instead I'm getting undefined. My fetch call is in a useEffect, and the data loads correctly because I can see it in DevTools. But when I access it on the first render, it's undefined. What am I missing?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Frame it as a &lt;em&gt;specific scenario&lt;/em&gt;, not a generic error. Paste only the relevant code (the fetch, the state, the place where it breaks).&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Push Back on Generic Answers
&lt;/h3&gt;

&lt;p&gt;If AI says "you need to add error handling," but you already have it—say so. Push back. Make it specific:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I'm already handling the error. The fetch succeeds, data logs correctly in the console, but accessing it on the first render returns undefined. Why would the data be available in one place but not another?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This forces you both to think deeper. Often the answer will be something you realize &lt;em&gt;while typing it&lt;/em&gt;, which is the whole point.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Verify Locally Before Shipping
&lt;/h3&gt;

&lt;p&gt;AI gets things right 75% of the time. That remaining 25% will ship to production and break at 3 AM. Always test the suggested fix in your actual environment first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Example: The Race Condition
&lt;/h2&gt;

&lt;p&gt;Here's a bug I actually hit last week:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I saw:&lt;/strong&gt; Form submission works on the second try, not the first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I asked AI:&lt;/strong&gt; Generic error + stack trace (wasted 10 minutes).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I should have asked:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"After a user submits a form, I call &lt;code&gt;resetForm()&lt;/code&gt; immediately. The form resets, but if they try to submit again right away (within 500ms), the submission doesn't work. What could cause a function to be unavailable right after being called?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The answer:&lt;/strong&gt; I was nulling out a reference I needed. Simple once stated clearly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools That Actually Help
&lt;/h2&gt;

&lt;p&gt;If you want &lt;em&gt;real&lt;/em&gt; AI assistance, use it in context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Copilot&lt;/strong&gt; in your IDE: Knows your codebase and gives targeted suggestions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Perplexity&lt;/strong&gt; or &lt;strong&gt;Claude&lt;/strong&gt; for detailed explanations of &lt;em&gt;why&lt;/em&gt; something works&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your own test suite&lt;/strong&gt;: Run it, watch it fail, use AI to explain the failure in your specific code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LearnAI Weekly&lt;/strong&gt; newsletter: Real developers sharing actual debugging tactics and tools that work (&lt;a href="https://learnairesource.com/newsletter" rel="noopener noreferrer"&gt;https://learnairesource.com/newsletter&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Real Skill
&lt;/h2&gt;

&lt;p&gt;The ability to debug well—with or without AI—is about:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Being precise about what you're observing&lt;/li&gt;
&lt;li&gt;Having hypotheses before asking for help&lt;/li&gt;
&lt;li&gt;Understanding your own code well enough to know what's wrong&lt;/li&gt;
&lt;li&gt;Knowing when to trust the machine and when to trust your gut&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AI is best when it's helping you think clearer, not replacing the thinking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Time
&lt;/h2&gt;

&lt;p&gt;Next time something breaks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't paste immediately&lt;/li&gt;
&lt;li&gt;Sit with the error for 60 seconds&lt;/li&gt;
&lt;li&gt;Ask yourself the question out loud&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Then&lt;/em&gt; ask AI, with full context&lt;/li&gt;
&lt;li&gt;Verify before you ship&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You'll find yourself debugging faster, understanding more, and needing AI help less often. Which is probably the whole point anyway.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>productivity</category>
      <category>development</category>
    </item>
  </channel>
</rss>
