<?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: The AI Leverage Weekly</title>
    <description>The latest articles on DEV Community by The AI Leverage Weekly (@leveragenotes).</description>
    <link>https://dev.to/leveragenotes</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%2F3914896%2Fb2a4ead1-5e63-481e-9e32-f64d1ef69d79.png</url>
      <title>DEV Community: The AI Leverage Weekly</title>
      <link>https://dev.to/leveragenotes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leveragenotes"/>
    <language>en</language>
    <item>
      <title>How to Write an Architecture Decision Record with AI</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Wed, 15 Jul 2026 09:01:00 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-write-an-architecture-decision-record-with-ai-3kmn</link>
      <guid>https://dev.to/leveragenotes/how-to-write-an-architecture-decision-record-with-ai-3kmn</guid>
      <description>&lt;p&gt;Architecture Decision Records (ADRs) are one of those things every team agrees they should write and almost no one actually writes. The doc feels bureaucratic, the moment to capture the decision has already passed, and staring at a blank template is its own kind of tax. AI removes most of that friction. Here's a step-by-step walkthrough you can follow right now to produce a solid ADR in under 10 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an ADR Actually Needs to Contain
&lt;/h2&gt;

&lt;p&gt;Before prompting anything, know your target. A useful ADR has five sections:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Title&lt;/strong&gt; — short, verb-first (e.g., "Use PostgreSQL for transactional storage")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status&lt;/strong&gt; — Proposed / Accepted / Deprecated / Superseded&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context&lt;/strong&gt; — what problem forced this decision, what constraints existed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decision&lt;/strong&gt; — what you chose and why&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consequences&lt;/strong&gt; — trade-offs, risks, follow-up work&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you can answer those five things out loud, you have everything AI needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Brain-Dump Your Context
&lt;/h2&gt;

&lt;p&gt;Don't clean up your thoughts first. Paste the raw context directly into the prompt. Messy input is fine — the model's job is to structure it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I need to write an Architecture Decision Record. Here's the raw context:

We're choosing between Redis and a Postgres-based queue (using SKIP LOCKED)
for our background job system. The team is small, we already run Postgres,
and we want to avoid adding another infra dependency. Redis is faster but
we'd have to operate it separately. We picked Postgres queue. The main
downside is throughput ceiling around ~500 jobs/sec which is fine for now.

Write a complete ADR using this structure:
- Title
- Status: Accepted
- Context
- Decision
- Consequences (separate positive and negative)

Use plain prose, not bullet points inside the sections. Keep it under 300 words.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Review the Output Against Your Actual Constraints
&lt;/h2&gt;

&lt;p&gt;AI will produce a clean draft, but it fills gaps with reasonable assumptions. Read it critically for two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accuracy&lt;/strong&gt; — did it faithfully represent your constraints, or did it invent ones that sound plausible?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Specificity&lt;/strong&gt; — are numbers, system names, and timelines correct?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix anything that's wrong before it becomes the permanent record.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Stress-Test the Consequences Section
&lt;/h2&gt;

&lt;p&gt;The consequences section is where most ADRs go shallow. Use a follow-up prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review the Consequences section of this ADR. What risks or trade-offs
are missing? What operational, scaling, or team-knowledge implications
should be added? Be specific, not generic.

[paste your current ADR draft]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add whatever surfaces that you actually agree with. Discard generic filler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Generate the File and Drop It in Your Repo
&lt;/h2&gt;

&lt;p&gt;ADRs belong in version control, next to the code they govern. Use this prompt to get the final file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Format the following ADR as a Markdown file ready to commit.
Filename convention: NNNN-short-title.md (I'll supply the number).
Add a "Date" field after Status.

[paste final ADR]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit it to &lt;code&gt;docs/decisions/&lt;/code&gt; or wherever your team keeps them. If you don't have a folder yet, create it — this is the first one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Workflow at a Glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;What you do&lt;/th&gt;
&lt;th&gt;What AI does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Brain-dump raw context&lt;/td&gt;
&lt;td&gt;Structures it into ADR format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Review for accuracy&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Request consequence audit&lt;/td&gt;
&lt;td&gt;Surfaces missing trade-offs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Paste final draft&lt;/td&gt;
&lt;td&gt;Formats for commit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The whole thing takes 10 minutes the first time, less after that. The team gets a permanent record of &lt;em&gt;why&lt;/em&gt; a decision was made — which is the only thing that matters six months later when someone wants to re-litigate it.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w10" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w10&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>ai</category>
      <category>engineering</category>
      <category>career</category>
    </item>
    <item>
      <title>How to Debug a Failing Test with AI (Step-by-Step)</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Mon, 13 Jul 2026 09:00:47 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-debug-a-failing-test-with-ai-step-by-step-37j5</link>
      <guid>https://dev.to/leveragenotes/how-to-debug-a-failing-test-with-ai-step-by-step-37j5</guid>
      <description>&lt;h1&gt;
  
  
  How to Debug a Failing Test with AI (Step-by-Step)
&lt;/h1&gt;

&lt;p&gt;A test is red. The error message is vague. You've stared at the diff for ten minutes and nothing jumps out. This is exactly where AI earns its keep — not by guessing, but by systematically surfacing the class of failure you're dealing with before you've wasted an hour going in the wrong direction. Here's the exact workflow I use, with copy-paste prompts you can drop in today.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Collect the Full Failure Context Before You Prompt
&lt;/h2&gt;

&lt;p&gt;AI can only help as much as the context you give it. Before you open a chat window, gather:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;full test output&lt;/strong&gt; (not just the last line — the whole stack trace or assertion diff)&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;test code&lt;/strong&gt; itself&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;function or module under test&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Any &lt;strong&gt;recent changes&lt;/strong&gt; to either (a one-line &lt;code&gt;git diff&lt;/code&gt; summary is fine)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't summarize yet. Raw output is better than your interpretation at this stage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Use the Diagnostic Prompt
&lt;/h2&gt;

&lt;p&gt;Paste everything you collected into this prompt. The goal of this first message is triage — classify the failure before you start fixing it.&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 a senior software engineer helping me debug a failing test.

Here is the failing test:
[PASTE TEST CODE]

Here is the function/module it tests:
[PASTE IMPLEMENTATION CODE]

Here is the full test output:
[PASTE FULL ERROR / STACK TRACE]

Recent changes (if any): [BRIEF DESCRIPTION OR GIT DIFF SNIPPET]

Do the following:
1. Identify the category of failure (assertion mismatch, unexpected exception, setup/teardown issue, flaky timing, wrong mock, etc.)
2. State the most likely root cause in one sentence.
3. List up to three hypotheses, ranked by probability.
4. Suggest the smallest possible code change to confirm hypothesis #1 before fixing anything.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last instruction — &lt;em&gt;smallest change to confirm, not fix&lt;/em&gt; — is the key. AI will default to handing you a fix. You want a diagnostic step first, because if hypothesis #1 is wrong, the fix is wrong too.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Confirm Before You Fix
&lt;/h2&gt;

&lt;p&gt;Run the diagnostic the AI suggests. It's usually something like adding a &lt;code&gt;console.log&lt;/code&gt;, asserting an intermediate value, or temporarily hardcoding input to isolate the boundary. Once you know which hypothesis is correct, go back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hypothesis #1 was correct. The root cause is [what you confirmed].

Now give me the minimal fix — only change what is necessary to make this test pass without altering the contract of the function. Explain each change in one line.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Asking for a &lt;em&gt;minimal&lt;/em&gt; fix and requiring explanations keeps the AI from over-engineering a solution that touches things you didn't break.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Handle Flaky Tests Differently
&lt;/h2&gt;

&lt;p&gt;If the test passes sometimes and fails sometimes, the diagnostic prompt above still works — but add this line before your closing instructions:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"This test is intermittent. Focus specifically on timing issues, shared state, test ordering dependencies, and non-deterministic data."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Flakiness almost always traces back to one of those four categories. Telling the AI upfront prevents it from chasing assertion logic that isn't the real problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Validate the Fix Doesn't Just Pass — It Tests the Right Thing
&lt;/h2&gt;

&lt;p&gt;Once the test is green, run one more prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is the original test and the fix we applied:
[PASTE BOTH]

Does the test still meaningfully verify the intended behavior, or did the fix change what is being tested in a way that reduces coverage? Point out any assertions that became weaker or any edge cases that are no longer exercised.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the step most people skip, and it's where AI adds real value beyond just making CI green. A test that passes because you changed the assertion threshold isn't a fixed test — it's a hidden regression.&lt;/p&gt;




&lt;p&gt;This pattern — triage, confirm, fix minimally, validate coverage — is one of the ones I've packaged into The AI Leverage Playbook: 50 Prompts &amp;amp; Workflows for Engineers — but the version above is enough to get value on its own.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Note on What AI Gets Wrong Here
&lt;/h2&gt;

&lt;p&gt;AI will occasionally misread a stack trace and chase a symptom instead of the cause. Two guardrails help:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Never skip Step 2's confirmation step.&lt;/strong&gt; If you jump straight to the fix, you lose the ability to catch a misdiagnosis cheaply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If the AI's hypothesis doesn't match what you see in the code, say so explicitly.&lt;/strong&gt; "That hypothesis doesn't fit because X. Revise." Models course-correct well when you push back with evidence.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Putting It Together
&lt;/h2&gt;

&lt;p&gt;The full flow takes about five minutes of prompting for most failures. The payoff is that you stop debugging by vibes — scrolling, tweaking, re-running — and start debugging by elimination. AI doesn't replace the engineer; it just makes the triage loop faster and more systematic.&lt;/p&gt;

&lt;p&gt;Copy the two main prompts above into a scratch doc or a snippet manager and reach for them the next time a test goes red.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. It's one concrete AI workflow per issue, aimed at working engineers who don't have time to wade through hype. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w10" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w10&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>ai</category>
      <category>debugging</category>
      <category>programming</category>
    </item>
    <item>
      <title>AI Handled Two of My Hardest Weekly Tasks — Here's What the Data Showed (Week 9 Roundup)</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Fri, 10 Jul 2026 09:00:59 +0000</pubDate>
      <link>https://dev.to/leveragenotes/ai-handled-two-of-my-hardest-weekly-tasks-heres-what-the-data-showed-week-9-roundup-13np</link>
      <guid>https://dev.to/leveragenotes/ai-handled-two-of-my-hardest-weekly-tasks-heres-what-the-data-showed-week-9-roundup-13np</guid>
      <description>&lt;h1&gt;
  
  
  AI Handled Two of My Hardest Weekly Tasks — Here's What the Data Showed (Week 9 Roundup)
&lt;/h1&gt;

&lt;p&gt;This week I went deep on two things that have historically eaten a disproportionate chunk of my time: getting oriented in an unfamiliar codebase and writing SQL queries against schemas I don't own.&lt;/p&gt;

&lt;p&gt;Let me give you the real numbers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting up to speed on an unfamiliar codebase
&lt;/h2&gt;

&lt;p&gt;On a recent project, a teammate handed me a ~40,000-line service I'd never touched. Old me would've spent half a day reading files, tracing call stacks, and pestering whoever built it with questions.&lt;/p&gt;

&lt;p&gt;This time I fed the entry points and key modules into an AI assistant and asked structured questions — "what does this module own?", "what are the failure modes here?", "where does state live?" — iterating the way you'd interrogate a knowledgeable colleague.&lt;/p&gt;

&lt;p&gt;Result: I had a working mental model in about 45 minutes. I filed my first meaningful PR in that codebase before lunch. That's a task that used to bleed into day two.&lt;/p&gt;




&lt;h2&gt;
  
  
  Writing SQL from plain English
&lt;/h2&gt;

&lt;p&gt;Later in the week, I needed to pull a fairly complex report from a schema I hadn't worked with before — multi-table joins, some window functions, a few edge cases around NULLs.&lt;/p&gt;

&lt;p&gt;I described what I needed in plain English, pasted in the relevant table definitions, and iterated on the output through three rounds of prompting. Total time: ~18 minutes. The query ran clean on the first real test against production data.&lt;/p&gt;

&lt;p&gt;For context, my baseline for a query that complexity, working from scratch, is closer to 45–60 minutes — and that includes the debugging loop.&lt;/p&gt;




&lt;h2&gt;
  
  
  What this week actually confirmed
&lt;/h2&gt;

&lt;p&gt;Both workflows share the same underlying mechanic: you're not outsourcing the thinking, you're compressing the &lt;em&gt;orientation&lt;/em&gt; phase. The AI gets you to the point where your actual expertise kicks in, faster. That's where the leverage is.&lt;/p&gt;

&lt;p&gt;The weeks where I see the biggest gains aren't the ones where AI writes something for me end-to-end — they're the weeks where it eliminates the slow ramp-up that happens before I'm even doing real work.&lt;/p&gt;

&lt;p&gt;That pattern is worth paying attention to.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in &lt;strong&gt;The AI Leverage Weekly&lt;/strong&gt; — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w9" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w9&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>career</category>
      <category>engineering</category>
    </item>
    <item>
      <title>How to Use AI to Write SQL Queries from Plain English</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Wed, 08 Jul 2026 09:00:31 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-use-ai-to-write-sql-queries-from-plain-english-4fal</link>
      <guid>https://dev.to/leveragenotes/how-to-use-ai-to-write-sql-queries-from-plain-english-4fal</guid>
      <description>&lt;p&gt;If you've ever stared at a complex schema and spent 20 minutes writing a query you could describe in one sentence, this walkthrough is for you. I'll show you exactly how to prompt an AI assistant to generate accurate, production-ready SQL from plain English — including the context you need to provide, the prompts that work, and how to verify what comes back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Most "AI + SQL" Attempts Fail
&lt;/h2&gt;

&lt;p&gt;The usual failure mode: you paste a vague question into ChatGPT or Claude, get back a query that looks plausible, run it, and get wrong results or an error. The fix isn't a better AI — it's a better prompt. AI models write SQL accurately when you give them the same context a senior teammate would need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Give the AI Your Schema
&lt;/h2&gt;

&lt;p&gt;Never ask for a query without first providing your table definitions. Copy the &lt;code&gt;CREATE TABLE&lt;/code&gt; statements directly from your database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Paste this into your prompt first&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- 'pending', 'shipped', 'cancelled'&lt;/span&gt;
  &lt;span class="n"&gt;total_amount&lt;/span&gt; &lt;span class="nb"&gt;NUMERIC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="n"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;signup_date&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;plan&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;'free'&lt;/span&gt;  &lt;span class="c1"&gt;-- 'free', 'pro', 'enterprise'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your schema is large, include only the tables relevant to your question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Write the Prompt
&lt;/h2&gt;

&lt;p&gt;Use this template every time:&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 a SQL expert working with PostgreSQL.

Here are my table definitions:
[PASTE SCHEMA HERE]

Write a query that: [PLAIN ENGLISH DESCRIPTION]

Requirements:
- Use CTEs if the logic has more than one step
- Add a comment explaining any non-obvious join condition
- Do not use SELECT * — name every column
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example request:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;Write&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;each&lt;/span&gt; &lt;span class="n"&gt;pro&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;enterprise&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="n"&gt;who&lt;/span&gt; &lt;span class="nb"&gt;signed&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt;
&lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="k"&gt;last&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;their&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="n"&gt;spend&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt;
&lt;span class="n"&gt;but&lt;/span&gt; &lt;span class="k"&gt;only&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="n"&gt;spend&lt;/span&gt; &lt;span class="n"&gt;exceeds&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Sort&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="n"&gt;spend&lt;/span&gt; &lt;span class="n"&gt;descending&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;What the AI returns:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Customers on paid plans, signed up in the last 90 days&lt;/span&gt;
&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;recent_paid_customers&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;plan&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'pro'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'enterprise'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;signup_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="s1"&gt;'90 days'&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;customer_order_totals&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&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;order_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total_amount&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;total_spend&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;recent_paid_customers&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
  &lt;span class="c1"&gt;-- Left join so customers with zero orders still appear; filter below&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s1"&gt;'cancelled'&lt;/span&gt;
  &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;order_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;total_spend&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customer_order_totals&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;total_spend&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_spend&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean, readable, and correct on the first try — because the prompt had enough context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Verify Before You Run
&lt;/h2&gt;

&lt;p&gt;Ask the AI to explain the query back to you in plain English:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Explain this query step by step. Call out any assumptions you made
about the data or business logic.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This surfaces hidden assumptions fast. If the explanation doesn't match your intent, correct it in the next message — the model retains the schema context in the same conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Iterate for Edge Cases
&lt;/h2&gt;

&lt;p&gt;Follow up with edge-case questions in the same thread:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;What&lt;/span&gt; &lt;span class="n"&gt;happens&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="n"&gt;has&lt;/span&gt; &lt;span class="k"&gt;no&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;at&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;Will&lt;/span&gt; &lt;span class="n"&gt;they&lt;/span&gt; &lt;span class="n"&gt;appear&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;Rewrite&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;if&lt;/span&gt; &lt;span class="n"&gt;needed&lt;/span&gt; &lt;span class="n"&gt;so&lt;/span&gt; &lt;span class="n"&gt;they&lt;/span&gt; &lt;span class="k"&gt;show&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;zero&lt;/span&gt; &lt;span class="k"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model will revise the query and explain the change. This loop — generate, explain, stress-test, revise — usually gets you to a production-safe query in three to four messages.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Paste relevant &lt;code&gt;CREATE TABLE&lt;/code&gt; statements&lt;/li&gt;
&lt;li&gt;Use the prompt template: role + schema + plain English goal + formatting requirements&lt;/li&gt;
&lt;li&gt;Ask for a plain-English explanation to catch wrong assumptions&lt;/li&gt;
&lt;li&gt;Stress-test edge cases in the same conversation thread&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; on the result for any query touching large tables&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's the full loop. No magic — just structured context.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w9" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w9&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>ai</category>
      <category>database</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Use AI to Understand an Unfamiliar Codebase</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Mon, 06 Jul 2026 09:01:15 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-use-ai-to-understand-an-unfamiliar-codebase-4726</link>
      <guid>https://dev.to/leveragenotes/how-to-use-ai-to-understand-an-unfamiliar-codebase-4726</guid>
      <description>&lt;p&gt;You've just been handed a codebase you've never seen before. No walkthrough, sparse docs, and the person who built it has moved on. You need to ship something in it by end of week. This is one of the most common — and most draining — situations in engineering, and AI actually handles it well if you know how to prompt it. Here's a step-by-step walkthrough you can follow right now.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Get a High-Level Map Before You Touch Any File
&lt;/h2&gt;

&lt;p&gt;Don't start by opening random files. Start by asking AI to orient you from the top down.&lt;/p&gt;

&lt;p&gt;Paste in the root directory tree (just the folder/file names — no code yet) and use this prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I'm trying to understand a codebase I've never worked in before.
Here is the top-level directory structure:

[PASTE DIRECTORY TREE HERE]

Based on this structure:
1. What is the likely purpose of this application?
2. What architectural pattern does it appear to follow (e.g. MVC, layered, event-driven)?
3. Which directories should I read first to understand the core domain logic?
4. What questions should I be asking that this structure alone can't answer?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you a mental scaffolding before you wade into implementation details. The fourth question is the most valuable — it surfaces what to look for next.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Explain a Specific File Without Reading Every Line
&lt;/h2&gt;

&lt;p&gt;Once you have a target file, paste it into the chat and ask for a structured breakdown rather than a summary. Summaries tend to be vague. A structured breakdown forces the model to be specific.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is a file from a codebase I'm ramping up on:

[PASTE FILE CONTENTS]

Please explain it with the following structure:
- **Purpose**: What is the single responsibility of this module?
- **Inputs / Outputs**: What does it receive and what does it produce or affect?
- **Dependencies**: What does it rely on that I should also understand?
- **Side effects**: Does it write to anything, emit events, or mutate shared state?
- **Gotchas**: Any non-obvious logic, edge cases, or things that could confuse a new reader?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "Gotchas" section alone has saved me from misreading code more times than I can count. Models are good at spotting patterns that are technically valid but semantically surprising — things like a function named &lt;code&gt;getUser&lt;/code&gt; that also writes a log entry.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Trace a Request or Data Flow End-to-End
&lt;/h2&gt;

&lt;p&gt;Understanding individual files isn't enough — you need to know how they connect. Pick an entry point (an API route, a queue consumer, a CLI command) and ask AI to walk the execution path with you.&lt;/p&gt;

&lt;p&gt;Paste in 2–3 files that you suspect are in the same call chain and prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I'm trying to understand how a request flows through this system.
Here are several files I believe are connected:

[FILE 1 — paste contents]
[FILE 2 — paste contents]
[FILE 3 — paste contents]

Please trace what happens when [describe the trigger, e.g. "a POST request hits /api/orders"].
Show the sequence of function calls across these files,
note where data is transformed, and flag any steps where the flow is unclear or could break.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where AI pays for itself in ramp-up scenarios. Manually tracing a call chain across 4–5 files used to take a full afternoon. With the right prompt, you have a working model in 10 minutes that you can then verify.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Generate a "New Contributor Cheat Sheet"
&lt;/h2&gt;

&lt;p&gt;Once you've used steps 1–3 to develop a mental model, consolidate it. Have the AI produce a reference doc you can keep open while you work.&lt;/p&gt;

&lt;p&gt;This pattern is one of the ones I've packaged into The AI Leverage Playbook: 50 Prompts &amp;amp; Workflows for Engineers — but the version below is enough to get value on its own.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Based on everything we've discussed about this codebase, generate a "New Contributor Cheat Sheet" with:
1. One-paragraph system overview
2. Key modules and their responsibilities (bullet list)
3. The 3–5 files a new engineer must read before making any changes
4. Common pitfalls or conventions that aren't obvious from the code alone
5. Glossary of any domain-specific terms used in the codebase
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste this into your team's internal docs or a personal note. The next time you hit a confusing area of the codebase, you have a foundation to ask more precise questions from.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Workflow Is Actually Doing
&lt;/h2&gt;

&lt;p&gt;Each step moves from abstract to concrete: structure → file → flow → reference. You're using AI as a structured reading partner, not an autocomplete. The quality of what you get back scales directly with the specificity of your prompt — generic questions produce generic answers.&lt;/p&gt;

&lt;p&gt;A few practical notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context window matters.&lt;/strong&gt; For large files, trim dead code or test fixtures before pasting. Focus the model on the logic, not the noise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Always verify.&lt;/strong&gt; AI will occasionally misread intent, especially in codebases with unconventional patterns. Use its output as a hypothesis to confirm, not a fact to accept.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterate.&lt;/strong&gt; The cheat sheet from Step 4 will have gaps. Go back, paste the confusing parts, and refine.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. It's built for engineers who want to work faster without cutting corners. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w9" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w9&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>career</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI Wrote Half My Week — Here's What the Numbers Actually Looked Like (Week 8 Roundup)</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Fri, 03 Jul 2026 09:00:30 +0000</pubDate>
      <link>https://dev.to/leveragenotes/ai-wrote-half-my-week-heres-what-the-numbers-actually-looked-like-week-8-roundup-5fhc</link>
      <guid>https://dev.to/leveragenotes/ai-wrote-half-my-week-heres-what-the-numbers-actually-looked-like-week-8-roundup-5fhc</guid>
      <description>&lt;h1&gt;
  
  
  AI Wrote Half My Week — Here's What the Numbers Actually Looked Like (Week 8 Roundup)
&lt;/h1&gt;

&lt;p&gt;This week had a clear through-line: using AI not as a novelty, but as a multiplier on two of the most time-consuming communication tasks in engineering — refactoring legacy code and writing pull request descriptions.&lt;/p&gt;

&lt;p&gt;Here's what actually happened, with real numbers.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Refactoring Session
&lt;/h2&gt;

&lt;p&gt;On a recent project, I had a service with a module that hadn't been meaningfully touched in about three years. Nested conditionals, no tests, naming that made sense to someone in 2021 but nobody since. I ran it through a structured AI refactoring workflow — the kind I wrote about this week — and tracked the time.&lt;/p&gt;

&lt;p&gt;Manual refactoring estimate (based on similar past work): &lt;strong&gt;~4 hours&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Actual time with AI-assisted prompts, including review and sanity-checking the output: &lt;strong&gt;1 hour 20 minutes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That's not magic. That's systematic prompting: ask for a plain-language summary first, identify the hotspots, then refactor incrementally rather than all at once. The AI didn't understand the business logic — I did. It handled the mechanical transformation; I handled the judgment calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  The PR Description Problem
&lt;/h2&gt;

&lt;p&gt;The second theme this week was pull request descriptions. On the same project, I counted: over the last sprint, roughly &lt;strong&gt;60% of PR review cycles&lt;/strong&gt; included at least one round-trip comment that existed purely because the description was unclear — missing context, no "why this change," no callouts for reviewers.&lt;/p&gt;

&lt;p&gt;I switched to generating first-draft PR descriptions with AI (prompt: diff in, structured description out), then editing for accuracy. Review round-trips dropped. Not eliminated — but the first-pass questions got sharper because reviewers had more to work with upfront.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Week Confirmed
&lt;/h2&gt;

&lt;p&gt;Speed gains from AI are real, but they're not random. They show up consistently in two places: &lt;strong&gt;mechanical transformation&lt;/strong&gt; (restructuring code, reformatting text) and &lt;strong&gt;blank-page problems&lt;/strong&gt; (starting a description, a doc, a test). The judgment layer still belongs to the engineer. That's not a caveat — that's the workflow.&lt;/p&gt;

&lt;p&gt;Week 8 down. The pattern is getting clearer every Friday.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. It's the one email I actually write for engineers who want to work smarter without the hype. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w8" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>career</category>
      <category>engineering</category>
    </item>
    <item>
      <title>How to Write a Pull Request Description with AI</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Wed, 01 Jul 2026 09:01:01 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-write-a-pull-request-description-with-ai-24ma</link>
      <guid>https://dev.to/leveragenotes/how-to-write-a-pull-request-description-with-ai-24ma</guid>
      <description>&lt;h1&gt;
  
  
  How to Write a Pull Request Description with AI
&lt;/h1&gt;

&lt;p&gt;Writing a good PR description takes longer than it should. You've already done the hard work — the code is done — but now you're staring at a blank text box trying to summarize context, motivation, and testing notes while your brain is already on the next task. AI handles this well. Here's a step-by-step walkthrough you can use today.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why PR Descriptions Get Skipped (or Written Badly)
&lt;/h2&gt;

&lt;p&gt;Bad PR descriptions slow down review cycles. Reviewers ask questions that are already answered in the diff, or they approve without really understanding the change. The fix isn't discipline — it's reducing the friction of writing a good description in the first place.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Get Your Raw Diff
&lt;/h2&gt;

&lt;p&gt;Start by pulling the diff between your branch and main:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff main...HEAD &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; pr_diff.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the diff is large (500+ lines), focus on the meaningful parts — skip lockfile changes and generated files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff main...HEAD &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="s1"&gt;'*.ts'&lt;/span&gt; &lt;span class="s1"&gt;'*.py'&lt;/span&gt; &lt;span class="s1"&gt;'*.go'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; pr_diff.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 2: Paste the Diff into Your AI Tool with This Prompt
&lt;/h2&gt;

&lt;p&gt;Open your AI tool of choice (ChatGPT, Claude, Gemini — all work here) and use this prompt:&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 a senior engineer writing a pull request description for a code review.

Here is the diff:

&amp;lt;paste diff here&amp;gt;

Write a pull request description with the following sections:
1. **What changed** — a 2–3 sentence plain-English summary of what this PR does.
2. **Why** — the motivation or problem being solved.
3. **How to test** — concrete steps a reviewer can follow to verify the change locally.
4. **Notes for reviewer** — anything non-obvious, edge cases to watch, or follow-up work deferred.

Be specific. Reference actual function names, files, or logic from the diff. Do not be vague.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 3: Review and Edit the Output
&lt;/h2&gt;

&lt;p&gt;The AI output will be 80–90% usable. Your job is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fix any context it couldn't infer from the diff alone (e.g., why this ticket existed)&lt;/li&gt;
&lt;li&gt;Add a link to the issue or ticket&lt;/li&gt;
&lt;li&gt;Trim anything that's redundant with the diff itself&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This takes 2–3 minutes, not 15.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Save a Template for Your Team
&lt;/h2&gt;

&lt;p&gt;Once you've done this a few times, extract the structure into a &lt;code&gt;.github/pull_request_template.md&lt;/code&gt; file in your repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## What changed&lt;/span&gt;&lt;span class="sb"&gt;


&lt;/span&gt;&lt;span class="gu"&gt;## Why&lt;/span&gt;&lt;span class="sb"&gt;


&lt;/span&gt;&lt;span class="gu"&gt;## How to test&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Step 1
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Step 2

&lt;span class="gu"&gt;## Notes for reviewer&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the AI output maps directly to the template fields. Every PR on your team starts from the same skeleton, and the quality floor rises across the board.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Prompt, Ready to Copy
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a senior engineer writing a pull request description for a code review.

Here is the diff:

[PASTE DIFF]

Write a pull request description with the following sections:
1. **What changed** — a 2–3 sentence plain-English summary of what this PR does.
2. **Why** — the motivation or problem being solved.
3. **How to test** — concrete steps a reviewer can follow to verify the change locally.
4. **Notes for reviewer** — anything non-obvious, edge cases to watch, or follow-up work deferred.

Be specific. Reference actual function names, files, or logic from the diff. Do not be vague.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;This workflow takes about 5 minutes the first time and under 2 minutes once it's part of your routine. Better descriptions mean faster reviews — that's a compounding win on every PR you ship.&lt;/p&gt;

&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w8" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>ai</category>
      <category>productivity</category>
      <category>career</category>
    </item>
    <item>
      <title>The Best AI Prompts for Refactoring Legacy Code</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Mon, 29 Jun 2026 09:00:47 +0000</pubDate>
      <link>https://dev.to/leveragenotes/the-best-ai-prompts-for-refactoring-legacy-code-5g7h</link>
      <guid>https://dev.to/leveragenotes/the-best-ai-prompts-for-refactoring-legacy-code-5g7h</guid>
      <description>&lt;h1&gt;
  
  
  The Best AI Prompts for Refactoring Legacy Code
&lt;/h1&gt;

&lt;p&gt;Legacy code doesn't come with a manual. You inherit a function that's 300 lines long, has no tests, and the original author is long gone. You know it needs to change, but touching it feels like defusing a bomb blindfolded. AI tools won't rewrite your entire codebase for you — but with the right prompts, they dramatically shrink the time between "I don't understand this" and "I can safely change this." Here are the prompts I reach for, in the order I actually use them.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Start with a plain-English explanation of what the code does
&lt;/h2&gt;

&lt;p&gt;Before you touch anything, you need to understand it. Paste the function or module and ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Explain what this code does in plain English. Describe:
1. Its purpose (what business problem it solves)
2. Its inputs and outputs
3. Any side effects or external dependencies
4. Edge cases it appears to handle
5. Anything that looks unusual or potentially buggy

Here is the code:
[paste code]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you a mental model fast. Don't skip it — even if you think you understand the code, the AI often surfaces a side effect or edge case you glossed over.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Identify the smell before you prescribe the fix
&lt;/h2&gt;

&lt;p&gt;Jumping straight to "refactor this" produces mediocre results. Instead, ask for a diagnosis first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review the following legacy code and list every code smell you can identify.
For each smell: name it, quote the specific lines involved, and explain why it's a problem.
Do not suggest fixes yet — just audit.

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

&lt;/div&gt;



&lt;p&gt;Getting a structured smell list forces the AI to slow down and reason about the code rather than produce a cosmetically cleaner version of the same mess.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Ask for a refactoring plan, not just refactored code
&lt;/h2&gt;

&lt;p&gt;Once you have the smell list, ask for a sequenced plan before asking for any new code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Given the code smells you identified, produce a step-by-step refactoring plan.
Order the steps from lowest risk to highest risk.
For each step, explain: what changes, why it's safe to do in isolation, and what could break.
Do not write code yet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the prompt that saves the most time. A plan exposes assumptions you can challenge before you've committed a line of code. It also gives you natural stopping points if you're time-boxed.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Generate a characterization test suite before refactoring
&lt;/h2&gt;

&lt;p&gt;Legacy code without tests is a minefield. Use the AI to generate "characterization tests" — tests that document current behavior, not ideal behavior:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write a suite of unit tests for the following function that captures its current behavior exactly — including any behavior that looks wrong.
The goal is not to test correctness; the goal is to detect if refactoring changes the output.
Use [your test framework, e.g. Jest / pytest / RSpec].

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

&lt;/div&gt;



&lt;p&gt;Run these tests, commit them, and now you have a safety net. Any refactoring that breaks a test is a regression you need to understand before merging.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Refactor one smell at a time, not all at once
&lt;/h2&gt;

&lt;p&gt;Now you're ready to change code. Do it incrementally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Refactor ONLY the following problem from the code below: [name one smell from your list, e.g. "extract the nested conditional into a separate function"].
Do not change any other logic.
Show me the before and after side by side and explain every change you made.

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

&lt;/div&gt;



&lt;p&gt;This pattern is one of the ones I've packaged into The AI Leverage Playbook: 50 Prompts &amp;amp; Workflows for Engineers — but the version above is enough to get value on its own.&lt;/p&gt;

&lt;p&gt;Scoping the prompt tightly is the key move. When you ask AI to "refactor everything," it over-reaches and introduces changes you didn't ask for, review, or understand. One smell per prompt keeps the diff reviewable.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Ask for a risk assessment on your final diff
&lt;/h2&gt;

&lt;p&gt;Before you open the PR, paste your final diff and ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="p"&gt;Review this diff. Identify any changes that:
&lt;/span&gt;&lt;span class="gd"&gt;- Could introduce a regression
- Change behavior in a way that isn't obvious from the variable/function names
- Should be covered by a test that doesn't exist yet
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="p"&gt;Be specific. Quote the lines you're concerned about.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat this like a second pair of eyes on your PR — one that reads every line without getting bored.&lt;/p&gt;




&lt;h2&gt;
  
  
  The sequence matters as much as the prompts
&lt;/h2&gt;

&lt;p&gt;These six prompts are most effective in order: understand → audit → plan → safety-net → change → validate. Skipping steps (especially the characterization tests) is how you end up with a "refactored" codebase that breaks in production on an edge case nobody thought to test.&lt;/p&gt;

&lt;p&gt;None of these prompts require a specific AI tool — they work with whatever assistant you're already using. The discipline is in the sequence, not the syntax.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w8" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>refactoring</category>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>We Saved 6 Hours of QA Time This Week Using AI — Here's the Breakdown (Week 7 Roundup)</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Fri, 26 Jun 2026 09:01:03 +0000</pubDate>
      <link>https://dev.to/leveragenotes/we-saved-6-hours-of-qa-time-this-week-using-ai-heres-the-breakdown-week-7-roundup-4nm4</link>
      <guid>https://dev.to/leveragenotes/we-saved-6-hours-of-qa-time-this-week-using-ai-heres-the-breakdown-week-7-roundup-4nm4</guid>
      <description>&lt;h1&gt;
  
  
  We Saved 6 Hours of QA Time This Week Using AI — Here's the Breakdown (Week 7 Roundup)
&lt;/h1&gt;

&lt;p&gt;This week had a clear throughline: AI doing the tedious, time-consuming work that engineers hate but can't skip — and the numbers were actually surprising.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Case That Made It concrete
&lt;/h2&gt;

&lt;p&gt;Midway through the week, a service I was responsible for had a module with 23 functions, zero unit tests, and a refactor deadline approaching fast. Historically, writing that test suite from scratch would eat up most of a day — probably 5–6 hours of mechanical, low-satisfaction work.&lt;/p&gt;

&lt;p&gt;Using an AI-assisted workflow to generate the test scaffolding function by function, I had a working first draft of the full suite in under 90 minutes. That's not a rounding error. That's the difference between shipping the refactor this sprint and punting it to the next one.&lt;/p&gt;

&lt;p&gt;The output wasn't perfect — about 20% of the generated tests needed meaningful corrections, mostly around edge cases and mock setup. But starting from a structured draft instead of a blank file changed the whole shape of the work. I was reviewing and refining, not grinding.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Other Half of the Week
&lt;/h2&gt;

&lt;p&gt;The second major theme was debugging. A gnarly stack trace came in from a service in a part of the codebase I hadn't touched in months. The kind of error where you'd normally spend 45 minutes just reorienting yourself before you even start diagnosing.&lt;/p&gt;

&lt;p&gt;Feeding the trace to an AI model with the right context got me to the probable root cause in one structured pass. Not magic — it still took judgment to confirm the fix — but the triage phase that usually burns the most time was compressed dramatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Week Actually Proved
&lt;/h2&gt;

&lt;p&gt;These weren't toy examples or tutorials. Both were real work, under real time pressure. The pattern that held across both:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AI front-loads the structural work&lt;/strong&gt; (scaffolding, triage, orientation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Engineers handle the judgment layer&lt;/strong&gt; (correctness, context, edge cases)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The split saves hours, not minutes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The engineers who are winning with AI right now aren't the ones with the cleverest prompts. They're the ones who've figured out exactly which part of their workflow to hand off.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w7" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w7&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>career</category>
      <category>engineering</category>
    </item>
    <item>
      <title>How to Use AI to Debug a Stack Trace (Step-by-Step)</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Wed, 24 Jun 2026 09:00:33 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-use-ai-to-debug-a-stack-trace-step-by-step-110n</link>
      <guid>https://dev.to/leveragenotes/how-to-use-ai-to-debug-a-stack-trace-step-by-step-110n</guid>
      <description>&lt;h1&gt;
  
  
  How to Use AI to Debug a Stack Trace (Step-by-Step)
&lt;/h1&gt;

&lt;p&gt;You've got a wall of red text, a stack trace you don't fully recognize, and no obvious starting point. AI can turn that trace into a clear diagnosis and a fix — in under two minutes. Here's exactly how to do it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Raw Stack Traces Are Hard to Parse Alone
&lt;/h2&gt;

&lt;p&gt;Stack traces are dense. They mix your code with framework internals, third-party library frames, and sometimes async noise that obscures the actual origin of the error. The mental overhead of filtering signal from noise is where most debugging time gets wasted. AI is surprisingly good at this — not because it "knows" your system, but because it can pattern-match against thousands of similar traces and explain each layer in plain language.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Copy the Full Stack Trace — Don't Trim It
&lt;/h2&gt;

&lt;p&gt;Resist the urge to paste only the top three lines. The root cause is often buried lower in the trace. Copy everything, including the error type, message, and every frame.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Use This Prompt Template
&lt;/h2&gt;

&lt;p&gt;Open your AI assistant (ChatGPT, Claude, Gemini — any capable model works) and paste this:&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 a senior engineer helping me debug a runtime error.

Here is the full stack trace:
---
[PASTE YOUR FULL STACK TRACE HERE]
---

Please do the following:
1. Identify the root cause of the error in plain English.
2. Pinpoint the exact line or frame where the error originates (not just where it surfaces).
3. Explain why this error occurs — what condition triggered it.
4. Suggest a concrete fix with a code example.
5. List any other places in a typical codebase where this same pattern might cause the same error.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That fifth point is the one most developers skip — and it's where you stop patching and start preventing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Add Context to Get a Sharper Answer
&lt;/h2&gt;

&lt;p&gt;After the initial response, follow up with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is the function where the error originates. Does this change your diagnosis?

[PASTE THE RELEVANT FUNCTION OR METHOD]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This two-pass approach — trace first, code second — gives the model enough context to go from "here's what's probably wrong" to "here's exactly what's wrong."&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Ask for a Reproduction Case
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write a minimal code snippet that would reproduce this error so I can verify the fix before applying it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This forces the model to commit to a specific understanding of the bug. If the reproduction case doesn't match what you're seeing, you've caught a hallucination before it costs you time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Validate the Fix, Then Ask for a Test
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is the fix I applied: [PASTE FIX]. Now write a unit test that would have caught this error before it reached production.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You've just turned a debugging session into a regression test — automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Workflow Actually Gets You
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A plain-English explanation you can share with a teammate or put in a PR description&lt;/li&gt;
&lt;li&gt;A fix you can verify before applying&lt;/li&gt;
&lt;li&gt;A unit test that closes the loop&lt;/li&gt;
&lt;li&gt;A checklist of similar patterns to audit in the rest of the codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This entire flow takes five minutes once you have the prompt structure memorized.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical AI techniques for engineers, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w7" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=medium_w7&lt;/a&gt;&lt;/p&gt;

</description>
      <category>debugging</category>
      <category>ai</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Generate Unit Tests from a Function Using AI</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Mon, 22 Jun 2026 09:01:20 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-to-generate-unit-tests-from-a-function-using-ai-173m</link>
      <guid>https://dev.to/leveragenotes/how-to-generate-unit-tests-from-a-function-using-ai-173m</guid>
      <description>&lt;p&gt;You have a function, you need tests, and you're staring at a blank file. AI can generate a solid first draft of your unit test suite in under a minute — but only if you prompt it correctly. This walkthrough shows you exactly how to do it, step by step, with copy-paste prompts and real output patterns you can adapt immediately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Naive Prompt Fails
&lt;/h2&gt;

&lt;p&gt;Most engineers start with something like &lt;code&gt;"write tests for this function"&lt;/code&gt; and paste their code. The output is usually technically correct but shallow: happy-path only, no edge cases, no error conditions, no boundary values. It looks like coverage but isn't.&lt;/p&gt;

&lt;p&gt;The fix isn't a fancier AI model — it's a better prompt structure.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Frame the Function with Context
&lt;/h2&gt;

&lt;p&gt;Before pasting code, tell the AI what the function is supposed to do, what it promises to callers, and what test framework you're using. One short paragraph of context doubles the quality of the output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;have&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;TypeScript&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;validates&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;submitted&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="nx"&gt;address&lt;/span&gt;
&lt;span class="nx"&gt;before&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s stored to the database. It should return true for valid emails
and false for invalid ones. I&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="nx"&gt;using&lt;/span&gt; &lt;span class="nx"&gt;Vitest&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="s2"&gt;`describe/it/expect`&lt;/span&gt;
&lt;span class="nx"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;No&lt;/span&gt; &lt;span class="nx"&gt;mocking&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;needed&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;pure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Here&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&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;PASTE&lt;/span&gt; &lt;span class="nx"&gt;FUNCTION&lt;/span&gt; &lt;span class="nx"&gt;HERE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nx"&gt;Generate&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;comprehensive&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;suite&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Cover&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;happy&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;boundary&lt;/span&gt;
&lt;span class="nf"&gt;cases &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;empty&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;very&lt;/span&gt; &lt;span class="nx"&gt;long&lt;/span&gt; &lt;span class="nx"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;malformed&lt;/span&gt; &lt;span class="nx"&gt;inputs&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;missing&lt;/span&gt; &lt;span class="p"&gt;@,&lt;/span&gt; &lt;span class="nx"&gt;multiple&lt;/span&gt; &lt;span class="p"&gt;@,&lt;/span&gt; &lt;span class="nx"&gt;special&lt;/span&gt; &lt;span class="nx"&gt;characters&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;edge&lt;/span&gt; &lt;span class="nx"&gt;cases&lt;/span&gt; &lt;span class="nx"&gt;implied&lt;/span&gt;
&lt;span class="nx"&gt;by&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="nx"&gt;itself&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last line — &lt;em&gt;"edge cases implied by the implementation itself"&lt;/em&gt; — is the key instruction. It forces the model to read the actual logic rather than generating generic tests.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Ask for a Test Plan Before the Code
&lt;/h2&gt;

&lt;p&gt;For non-trivial functions, add one extra step: ask for the test plan first, review it, then ask for the implementation. This costs 30 seconds and catches gaps before they get baked into code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before writing any test code, list every test case you plan to cover for
the function above. Group them by: (1) valid inputs, (2) invalid inputs,
(3) boundary/edge cases, (4) error conditions. Use plain English, one
line per case. I'll confirm the list before you write any code.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scan the list. You'll almost always spot a case the model missed — and more importantly, a case &lt;em&gt;you&lt;/em&gt; would have missed too. Add it back in plain English before you proceed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Generate the Tests
&lt;/h2&gt;

&lt;p&gt;Once the plan is approved, run the generation prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Now&lt;/span&gt; &lt;span class="nx"&gt;write&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;full&lt;/span&gt; &lt;span class="nx"&gt;Vitest&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="nx"&gt;suite&lt;/span&gt; &lt;span class="nx"&gt;based&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="nx"&gt;plan&lt;/span&gt; &lt;span class="nx"&gt;above&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;Requirements&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;One&lt;/span&gt; &lt;span class="s2"&gt;`describe`&lt;/span&gt; &lt;span class="nx"&gt;block&lt;/span&gt; &lt;span class="nx"&gt;named&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;One&lt;/span&gt; &lt;span class="s2"&gt;`it`&lt;/span&gt; &lt;span class="nx"&gt;block&lt;/span&gt; &lt;span class="nx"&gt;per&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;descriptive&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;reads&lt;/span&gt; &lt;span class="nx"&gt;like&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
  &lt;span class="nf"&gt;sentence &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;returns false when the input is an empty string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;No&lt;/span&gt; &lt;span class="nx"&gt;external&lt;/span&gt; &lt;span class="nx"&gt;dependencies&lt;/span&gt; &lt;span class="nx"&gt;or&lt;/span&gt; &lt;span class="nx"&gt;mocks&lt;/span&gt; &lt;span class="nx"&gt;unless&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;requires&lt;/span&gt; &lt;span class="nx"&gt;them&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;requires&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;fixture&lt;/span&gt; &lt;span class="nx"&gt;or&lt;/span&gt; &lt;span class="nx"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;define&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;
  &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;describe&lt;/span&gt; &lt;span class="nx"&gt;block&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;Add&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;one&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;line&lt;/span&gt; &lt;span class="nx"&gt;comment&lt;/span&gt; &lt;span class="nx"&gt;above&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;non&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;obvious&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The descriptive &lt;code&gt;it&lt;/code&gt; strings matter. They're your documentation. When a test fails in CI at 2am, a string like &lt;code&gt;"returns false when the input is an empty string"&lt;/code&gt; tells you exactly what broke without opening the file.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Audit the Output for Coverage Gaps
&lt;/h2&gt;

&lt;p&gt;Don't ship the AI output directly. Run this audit prompt against the generated suite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review the test suite you just wrote. Identify any of the following that
are missing or weakly covered:
1. Return value correctness (not just truthiness)
2. Side effects the function might have
3. Thrown exceptions or error types
4. Performance-sensitive paths (very large inputs)
5. Any assumption in the code that isn't tested

For each gap, either add a test case or explain why it's intentionally
excluded.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where the real value compounds. The model will often find its own blind spots when asked directly — things like checking the &lt;em&gt;type&lt;/em&gt; of a return value, not just its truthiness, or confirming an exception has the right message, not just that it was thrown.&lt;/p&gt;

&lt;p&gt;This pattern is one of the ones I've packaged into &lt;em&gt;The AI Leverage Playbook: 50 Prompts &amp;amp; Workflows for Engineers&lt;/em&gt; — but the version above is enough to get value on its own.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Parametrize Repetitive Cases
&lt;/h2&gt;

&lt;p&gt;If the audit reveals many similar inputs that differ only in data, ask the model to refactor to a parametrized format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Refactor&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="nx"&gt;cases&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;share&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;same&lt;/span&gt; &lt;span class="nx"&gt;assertion&lt;/span&gt; &lt;span class="nx"&gt;logic&lt;/span&gt; &lt;span class="nx"&gt;but&lt;/span&gt; &lt;span class="nx"&gt;differ&lt;/span&gt;
&lt;span class="nx"&gt;only&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="nx"&gt;into&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="s2"&gt;`it.each`&lt;/span&gt; &lt;span class="nx"&gt;table&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;non&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;repetitive&lt;/span&gt; &lt;span class="nx"&gt;tests&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt;
&lt;span class="nx"&gt;individual&lt;/span&gt; &lt;span class="s2"&gt;`it`&lt;/span&gt; &lt;span class="nx"&gt;blocks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This cuts file length dramatically and makes it obvious when you need to add another row versus a whole new test.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Prompt Order at a Glance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Context prompt&lt;/strong&gt; — framework, function purpose, constraints&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test plan prompt&lt;/strong&gt; — review before any code is written&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generation prompt&lt;/strong&gt; — structured output requirements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit prompt&lt;/strong&gt; — coverage gap check&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refactor prompt&lt;/strong&gt; — parametrize repetitive cases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Working through all five steps for a typical utility function takes about 10 minutes. The result is a test suite that would have taken 45–60 minutes to write by hand — and usually has better edge case coverage than the manual version.&lt;/p&gt;




&lt;h2&gt;
  
  
  One More Tip: Anchor to Your Existing Test Style
&lt;/h2&gt;

&lt;p&gt;If your codebase already has tests, paste one existing test file alongside your prompt and add: &lt;code&gt;"Match the style, naming conventions, and structure of the example test file below exactly."&lt;/code&gt; The AI will mirror your patterns, which means the output requires almost no style cleanup before review.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. It's the fastest way to build a repeatable AI-assisted engineering practice. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w7" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=long_w7&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How Switching AI Tools Mid-Sprint Cost Us a Day (And What We Learned) — Week 6 Roundup</title>
      <dc:creator>The AI Leverage Weekly</dc:creator>
      <pubDate>Fri, 19 Jun 2026 09:01:06 +0000</pubDate>
      <link>https://dev.to/leveragenotes/how-switching-ai-tools-mid-sprint-cost-us-a-day-and-what-we-learned-week-6-roundup-4fd9</link>
      <guid>https://dev.to/leveragenotes/how-switching-ai-tools-mid-sprint-cost-us-a-day-and-what-we-learned-week-6-roundup-4fd9</guid>
      <description>&lt;p&gt;This week's two pieces — one on writing better Git commit messages with AI, and one comparing Claude and ChatGPT for code review — were both born from the same messy sprint where I made a mistake that cost real time.&lt;/p&gt;

&lt;p&gt;Here's what happened.&lt;/p&gt;

&lt;p&gt;Midway through a feature branch, I switched from the AI tool I'd been using for code review to a different one, mostly out of curiosity. I wanted to test a head-to-head comparison in a live context rather than a synthetic one. The model switch was seamless. The workflow wasn't.&lt;/p&gt;

&lt;p&gt;The new tool had a different "grain" — it flagged different things, used different idioms in its suggestions, and didn't carry any of the soft context I'd built up through earlier prompts in the session. I had to re-explain patterns we'd already established. I re-reviewed two files I'd already cleared. Net result: roughly a day's worth of focused review time became a day and a half, and I caught one &lt;strong&gt;genuine&lt;/strong&gt; regression — a missing null check on an edge case — that I'm not confident the original tool would have caught.&lt;/p&gt;

&lt;p&gt;So the lesson wasn't "tool X is better than tool Y." It was that &lt;strong&gt;consistency in tooling during a sprint has its own compounding value&lt;/strong&gt;, and switching mid-flow carries a real context-switching cost that doesn't show up in any benchmark.&lt;/p&gt;

&lt;p&gt;That framing fed directly into the commit message piece too. One thing I tracked this week: AI-assisted commit messages across 34 commits on two branches. Compared to my previous sprint's messages (which I still have in the log), the assisted ones averaged 2.1x longer, contained explicit "why" context in 79% of cases vs. ~20% before, and two of them directly prevented a "what did this change actually do?" question during a sync. Measurable. Mundane. Worth doing.&lt;/p&gt;

&lt;p&gt;The throughline this week: AI tooling rewards deliberate, consistent workflows more than it rewards novelty. Picking the best tool matters less than building repeatable habits around whatever you pick.&lt;/p&gt;




&lt;p&gt;I break down one workflow like this every week in The AI Leverage Weekly — practical, no fluff, free. Subscribe: &lt;a href="https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w6" rel="noopener noreferrer"&gt;https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=roundup_w6&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ai</category>
      <category>engineering</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
