<?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: Radu Ghetu</title>
    <description>The latest articles on DEV Community by Radu Ghetu (@radu_ghetu_84dd251b3979e4).</description>
    <link>https://dev.to/radu_ghetu_84dd251b3979e4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3963931%2F5453f830-b1b7-4353-8f99-5c77ee0a1945.jpg</url>
      <title>DEV Community: Radu Ghetu</title>
      <link>https://dev.to/radu_ghetu_84dd251b3979e4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/radu_ghetu_84dd251b3979e4"/>
    <language>en</language>
    <item>
      <title>Building QAOnFire: how I used prompt caching to make AI QA reports affordable</title>
      <dc:creator>Radu Ghetu</dc:creator>
      <pubDate>Tue, 02 Jun 2026 06:38:42 +0000</pubDate>
      <link>https://dev.to/radu_ghetu_84dd251b3979e4/building-qaonfire-how-i-used-prompt-caching-to-make-ai-qa-reports-affordable-3i1p</link>
      <guid>https://dev.to/radu_ghetu_84dd251b3979e4/building-qaonfire-how-i-used-prompt-caching-to-make-ai-qa-reports-affordable-3i1p</guid>
      <description>&lt;p&gt;&lt;a href="https://www.producthunt.com/posts/launching-qaonfire-dev/maker-invite?code=QMyQzM" rel="noopener noreferrer"&gt;https://www.producthunt.com/posts/launching-qaonfire-dev/maker-invite?code=QMyQzM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I shipped &lt;a href="https://qaonfire.dev" rel="noopener noreferrer"&gt;QAOnFire&lt;/a&gt; last week — a GitHub App that posts&lt;br&gt;
a full QA report on every pull request. Manual test scenarios, edge cases,&lt;br&gt;
setup &amp;amp; verification scripts, PM notes. Written for the actual diff, not a&lt;br&gt;
generic checklist.&lt;/p&gt;

&lt;p&gt;This post is the architecture writeup I wished I'd had when I started.&lt;/p&gt;
&lt;h2&gt;
  
  
  The shape of the problem
&lt;/h2&gt;

&lt;p&gt;A typical pull request on a small team gets:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Code review (sometimes thorough, often a rubber stamp)&lt;/li&gt;
&lt;li&gt;Automated tests (usually unit tests; rarely covers integration)&lt;/li&gt;
&lt;li&gt;Manual QA (often skipped because there's no QA person)&lt;/li&gt;
&lt;li&gt;Merge &amp;amp; deploy&lt;/li&gt;
&lt;li&gt;Bug found in prod&lt;/li&gt;
&lt;li&gt;Hotfix&lt;/li&gt;
&lt;li&gt;Repeat&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 3 is where most bugs get caught when it happens — and where most bugs&lt;br&gt;
ship when it doesn't. I wanted to put a useful approximation of step 3 right&lt;br&gt;
into the PR comment, within seconds of the PR being opened.&lt;/p&gt;
&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GitHub webhook → Express endpoint (returns 200 in &amp;lt;100ms)
     ↓
BullMQ job queued in Redis
     ↓
Worker dequeues:
  1. Octokit fetches the PR diff + selected file contents
  2. Read `qabot.md` from repo root (if present)
  3. Build prompt with cached system prompt + cached qabot.md
  4. Call Claude Sonnet
  5. Octokit posts comment to PR
  6. Decrement monthly usage counter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Stack: Node 18, Express, BullMQ, Redis, Postgres, Stripe, &lt;code&gt;@anthropic-ai/sdk&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;@octokit/rest&lt;/code&gt;, deployed on Railway.&lt;/p&gt;
&lt;h2&gt;
  
  
  Three things that made it work
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Prompt caching changes the economics entirely
&lt;/h3&gt;

&lt;p&gt;Without caching, every PR for every customer pays full input-token price for&lt;br&gt;
the system prompt (~5kb) and the per-repo qabot.md (~1-3kb). For a repo with&lt;br&gt;
30 PRs/month, that's 30 × 6-8kb of redundant input tokens.&lt;/p&gt;

&lt;p&gt;With caching enabled on those two prefix blocks, the first PR primes the cache&lt;br&gt;
and the next 4 minutes of PRs pay ~10% of the input token cost on that prefix.&lt;br&gt;
For repos with steady PR cadence (multiple PRs in a short window — which is&lt;br&gt;
exactly the bursty pattern PR traffic actually has), this is the difference&lt;br&gt;
between "free tier is impossible" and "5 free PRs/month is comfortably&lt;br&gt;
sustainable."&lt;/p&gt;

&lt;p&gt;The SDK call looks like:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="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-sonnet-4-6&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;4000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;system&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;QA_SYSTEM_PROMPT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;cache_control&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ephemeral&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;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="p"&gt;[&lt;/span&gt;
        &lt;span class="c1"&gt;// qabot.md as its own cached block, separate from the dynamic PR data&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;qabotMarkdown&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;cache_control&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ephemeral&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;dynamicPRPayload&lt;/span&gt;  &lt;span class="c1"&gt;// not cached — changes per PR&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;The key insight: cache the static prefix (system prompt + per-repo config),&lt;br&gt;
NOT the per-PR payload.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. A per-repo config file (&lt;code&gt;qabot.md&lt;/code&gt;) does more work than the model
&lt;/h3&gt;

&lt;p&gt;Generic AI test plans drift to generic AI test plans. "Test the happy path.&lt;br&gt;
Test invalid inputs. Test edge cases." Useless.&lt;/p&gt;

&lt;p&gt;Give the model 20 lines describing the actual domain — user roles, what&lt;br&gt;
"correct" means for this app, known fragile areas — and the output transforms.&lt;br&gt;
Test scenarios start referencing real entities. Edge cases align to actual&lt;br&gt;
business rules. Setup steps mention the specific seeding commands your team&lt;br&gt;
actually uses.&lt;/p&gt;

&lt;p&gt;The file is dead simple Markdown — no special syntax. Example:&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="gh"&gt;# Project context&lt;/span&gt;

&lt;span class="gu"&gt;## What this app does&lt;/span&gt;
Order management for a B2B wholesale distributor.

&lt;span class="gu"&gt;## User roles&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; buyer (places orders)
&lt;span class="p"&gt;-&lt;/span&gt; vendor (fulfills orders)
&lt;span class="p"&gt;-&lt;/span&gt; ops (resolves disputes)

&lt;span class="gu"&gt;## What "correct" means&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Inventory MUST decrement on order placement, not on fulfillment
&lt;span class="p"&gt;-&lt;/span&gt; Vendor payouts MUST round half-to-even (NEVER half-up — finance audit)
&lt;span class="p"&gt;-&lt;/span&gt; A buyer MUST NOT see another buyer's order history

&lt;span class="gu"&gt;## Known fragile areas&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; The order-status state machine (10+ states, several non-obvious transitions)
&lt;span class="p"&gt;-&lt;/span&gt; Multi-currency conversion in /api/checkout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This config is so much more valuable than any system prompt tuning I did.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. PM notes turned QA-only into "useful to the whole team"
&lt;/h3&gt;

&lt;p&gt;I almost shipped without the PM notes section. Then a beta user said: "this&lt;br&gt;
is great, but my PM keeps asking me to summarize what each PR does in&lt;br&gt;
non-technical language." I added a &lt;code&gt;## PM notes&lt;/code&gt; section to the prompt with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User-facing impact (or "none — internal change")&lt;/li&gt;
&lt;li&gt;Business / product implications&lt;/li&gt;
&lt;li&gt;Release-note candidate (yes/no + the line)&lt;/li&gt;
&lt;li&gt;Coordination needs (support, sales, marketing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The PM notes are now the most-quoted part of the report. PMs stop pinging&lt;br&gt;
engineers in Slack. Devs stop translating PRs into English manually. Nobody&lt;br&gt;
expected this; everyone keeps it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I'd reconsider
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Postgres might be overkill for v1.&lt;/strong&gt; SQLite + Litestream would have shipped 2 weeks faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I rolled my own usage quota.&lt;/strong&gt; A library like Schematic or Stigg would have given me free metering UIs and better analytics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub App permissions matrix is intimidating.&lt;/strong&gt; Document yours obsessively for users — they want to know exactly what you can see.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Want to try it?
&lt;/h2&gt;

&lt;p&gt;5 free reports per month, no credit card: &lt;a href="https://qaonfire.dev" rel="noopener noreferrer"&gt;https://qaonfire.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have a &lt;code&gt;qabot.md&lt;/code&gt; file you're happy with, send it to me — I'm building&lt;br&gt;
a small public collection of good ones to help new users get started.&lt;/p&gt;

&lt;p&gt;Happy to answer architecture questions in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>showdev</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
