<?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: Aksa Fatima</title>
    <description>The latest articles on DEV Community by Aksa Fatima (@aksa_fatima_7d71f290fcd3f).</description>
    <link>https://dev.to/aksa_fatima_7d71f290fcd3f</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%2F4078461%2Fb2eb4077-1b9b-4fe9-ac96-f28fa8fe18d5.png</url>
      <title>DEV Community: Aksa Fatima</title>
      <link>https://dev.to/aksa_fatima_7d71f290fcd3f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aksa_fatima_7d71f290fcd3f"/>
    <language>en</language>
    <item>
      <title>DriftGuard — AI Code Sanitizer &amp; Refactor Agent Powered by Sanity Context</title>
      <dc:creator>Aksa Fatima</dc:creator>
      <pubDate>Sun, 04 Oct 2026 15:44:05 +0000</pubDate>
      <link>https://dev.to/aksa_fatima_7d71f290fcd3f/driftguard-ai-code-sanitizer-refactor-agentpowered-by-sanity-context-3feh</link>
      <guid>https://dev.to/aksa_fatima_7d71f290fcd3f/driftguard-ai-code-sanitizer-refactor-agentpowered-by-sanity-context-3feh</guid>
      <description>&lt;p&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path One: Ship an Agent That Queries Real Content&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What I Built&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI can generate code really fast.&lt;/p&gt;

&lt;p&gt;But one problem I kept running into is that the code can look completely correct while still using an old API or outdated documentation.&lt;/p&gt;

&lt;p&gt;That is why I built &lt;strong&gt;DriftGuard&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;DriftGuard is an AI code auditing and refactoring agent. You give it code, and it checks that code against a structured knowledge base containing information about deprecated APIs, current versions, and their recommended replacements.&lt;/p&gt;

&lt;p&gt;For example, if the code uses an outdated Next.js API, DriftGuard can identify the issue, explain what changed, and suggest the newer approach.&lt;/p&gt;

&lt;p&gt;The main idea behind the project is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't just ask an AI whether code is correct. Give it a source of truth to check against.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Here’s a short walkthrough of DriftGuard, showing how it checks code against the Sanity-powered knowledge base and identifies outdated APIs.&lt;/p&gt;

&lt;p&gt;🎥 &lt;strong&gt;Demo:&lt;/strong&gt; &lt;em&gt;[&lt;a href="https://youtu.be/3RvNo10mnC8?si=kXwCE2mkY0PN7O3m" rel="noopener noreferrer"&gt;https://youtu.be/3RvNo10mnC8?si=kXwCE2mkY0PN7O3m&lt;/a&gt;]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The demo shows the basic flow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code → Sanity Context → Code Rules → AI Audit → Identify outdated code → Refactor&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;em&gt;[&lt;a href="https://github.com/AKSA119/driftguard" rel="noopener noreferrer"&gt;https://github.com/AKSA119/driftguard&lt;/a&gt;]&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  How I Used Sanity
&lt;/h2&gt;

&lt;p&gt;This is where Sanity became an important part of the project.&lt;/p&gt;

&lt;p&gt;Instead of keeping all the rules inside prompts or hardcoding them into the application, I created a Sanity project and modeled the coding rules as structured content.&lt;/p&gt;

&lt;p&gt;I created a &lt;strong&gt;Code Rule&lt;/strong&gt; document type with fields such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Technology&lt;/li&gt;
&lt;li&gt;Version&lt;/li&gt;
&lt;li&gt;Status&lt;/li&gt;
&lt;li&gt;Old API / Code&lt;/li&gt;
&lt;li&gt;Replacement&lt;/li&gt;
&lt;li&gt;Explanation&lt;/li&gt;
&lt;li&gt;Official Source URL&lt;/li&gt;
&lt;li&gt;Last Verified&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I added rules for things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js 15 async request APIs&lt;/li&gt;
&lt;li&gt;Vercel AI SDK 5 &lt;code&gt;addToolResult&lt;/code&gt; → &lt;code&gt;addToolOutput&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Vercel AI SDK 6 &lt;code&gt;generateObject&lt;/code&gt; deprecation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DriftGuard connects to the &lt;strong&gt;Sanity Context MCP endpoint&lt;/strong&gt; from the backend and retrieves these rules from Sanity.&lt;/p&gt;

&lt;p&gt;The retrieved content is then used alongside the user's code during the AI audit.&lt;/p&gt;

&lt;p&gt;So instead of the model simply saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I think this API is outdated."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;it has structured information from Sanity that tells it &lt;strong&gt;what changed, which version it applies to, what the replacement is, and where the information came from.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That was the part of the project I found most interesting — Sanity isn't just storing content here. It is acting as the knowledge layer that the agent can actually query.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sanity Project Details
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Project ID:&lt;/strong&gt; &lt;code&gt;wam7t4lk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The project contains the structured &lt;strong&gt;Code Rule&lt;/strong&gt; documents used by DriftGuard.&lt;/p&gt;

&lt;p&gt;This is also the project the Sanity team can inspect to see how I modeled the content behind the agent.&lt;/p&gt;




&lt;h2&gt;
  
  
  How the Agent Works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Code
    ↓
DriftGuard
    ↓
Sanity Context MCP
    ↓
Code Rules from Sanity
    ↓
Relevant rules retrieved
    ↓
AI Code Audit
    ↓
Outdated / deprecated APIs identified
    ↓
Sanity-grounded refactoring
    ↓
Updated Code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The biggest thing I learned while building DriftGuard is that connecting an AI model to real, structured information changes how useful the system can be.&lt;/p&gt;

&lt;p&gt;Getting the first demo working was actually the easy part.&lt;/p&gt;

&lt;p&gt;The harder part was dealing with things like MCP connections, authentication, outdated model versions, API changes, and making sure the AI output followed the format the application expected.&lt;/p&gt;

&lt;p&gt;There were definitely a few moments where something that looked like a small change turned into a debugging session. 😅&lt;/p&gt;

&lt;p&gt;But that was also the most useful part of the build.&lt;/p&gt;

&lt;p&gt;DriftGuard started as an idea about detecting outdated code, but it ended up teaching me a lot about how &lt;strong&gt;AI agents, structured content, MCP, and real-world debugging fit together.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  sanitychallenge #sanity #dev #webdev
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>sanitychallenge</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
