<?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: PesetasMasta</title>
    <description>The latest articles on DEV Community by PesetasMasta (@pesetasmasta).</description>
    <link>https://dev.to/pesetasmasta</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%2F3963074%2F8ef2c589-4f66-45e7-a759-b3e24501bda5.png</url>
      <title>DEV Community: PesetasMasta</title>
      <link>https://dev.to/pesetasmasta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pesetasmasta"/>
    <language>en</language>
    <item>
      <title>I built an llms.txt for Salesforce — so AI stops writing deprecated Apex</title>
      <dc:creator>PesetasMasta</dc:creator>
      <pubDate>Mon, 01 Jun 2026 16:51:06 +0000</pubDate>
      <link>https://dev.to/pesetasmasta/i-built-an-llmstxt-for-salesforce-so-ai-stops-writing-deprecated-apex-2l15</link>
      <guid>https://dev.to/pesetasmasta/i-built-an-llmstxt-for-salesforce-so-ai-stops-writing-deprecated-apex-2l15</guid>
      <description>&lt;h2&gt;
  
  
  The problem: AI's Salesforce knowledge is structurally stale
&lt;/h2&gt;

&lt;p&gt;Salesforce ships three releases a year. Large language models are trained on data that's 6–18 months old. So there's a permanent gap: by the time a model "knows" a Salesforce pattern, the platform has often moved on.&lt;/p&gt;

&lt;p&gt;The result is code that &lt;em&gt;looks&lt;/em&gt; right and compiles, but uses patterns from two or three releases ago. And the cruel part is that the &lt;strong&gt;most recently changed&lt;/strong&gt; things — security defaults and API versions — are exactly the ones models get wrong, because that's the freshest knowledge and the last to make it into training data.&lt;/p&gt;

&lt;p&gt;A few examples I see constantly from Claude, GPT, and Copilot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;WITH SECURITY_ENFORCED&lt;/code&gt; on SOQL — superseded by &lt;strong&gt;User Mode&lt;/strong&gt; (&lt;code&gt;WITH USER_MODE&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;DML without an access level — instead of &lt;code&gt;Database.update(records, AccessLevel.USER_MODE)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;System.assertEquals(...)&lt;/code&gt; — the legacy assertion API; the modern &lt;code&gt;Assert&lt;/code&gt; class (&lt;code&gt;Assert.areEqual&lt;/code&gt;, &lt;code&gt;Assert.isNull&lt;/code&gt;) shipped in Winter '23.&lt;/li&gt;
&lt;li&gt;Workflow Rules / Process Builder — both retired; everything should be Flow.&lt;/li&gt;
&lt;li&gt;API versions in the v50s on new classes, when current is v67.0.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are exotic. They're the defaults a senior dev would flag in code review. But an autonomous AI pipeline doesn't have that reviewer — it has its own (stale) priors.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: give the agent current ground truth
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://llmstxt.org" rel="noopener noreferrer"&gt;llms.txt&lt;/a&gt; is an emerging convention: a Markdown file at a known location that tells AI agents how to use your content. I used it to build &lt;strong&gt;sf-llms-context&lt;/strong&gt; — a small, opinionated Salesforce knowledge base aimed squarely at coding agents.&lt;/p&gt;

&lt;p&gt;Design principles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AI-first, not human-first.&lt;/strong&gt; Every file opens with a one-line instruction for the agent, then dense structured content. No marketing, no navigation chrome.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Show wrong AND right.&lt;/strong&gt; Every deprecated pattern sits next to the current one, with the reason (governor limit / security / deprecation).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token-efficient.&lt;/strong&gt; Brevity is a feature. Every pattern is a few hundred tokens, max.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified, not guessed.&lt;/strong&gt; Every governor-limit number and API version is checked against the official Summer '26 (v67.0) docs. (I even caught a limit I'd carried over that Salesforce removed in API v57.0 — verification matters.)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Does it actually change the output?
&lt;/h2&gt;

&lt;p&gt;I ran a controlled test across three models — &lt;strong&gt;Opus 4.8, Sonnet 4.6, and free ChatGPT&lt;/strong&gt; — each given the same user story, with and without this context file:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"When an Account's Industry changes, copy the new value to a field on every child Contact. Include tests."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have to be honest about the result, because it surprised me: &lt;strong&gt;the models are good.&lt;/strong&gt; Every no-context run produced one logic-free trigger delegating to a handler, &lt;code&gt;with sharing&lt;/code&gt;, and bulkified maps. One even added an async Queueable fallback for accounts with thousands of child Contacts. If I cherry-picked a strawman, the first reader to reproduce it would catch me.&lt;/p&gt;

&lt;p&gt;But line them up and a consistent gap appears:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model (no context)&lt;/th&gt;
&lt;th&gt;SOQL/DML mode&lt;/th&gt;
&lt;th&gt;Assertions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Opus 4.8&lt;/td&gt;
&lt;td&gt;system mode&lt;/td&gt;
&lt;td&gt;modern &lt;code&gt;Assert&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sonnet 4.6&lt;/td&gt;
&lt;td&gt;system mode&lt;/td&gt;
&lt;td&gt;legacy &lt;code&gt;System.assertEquals&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT (free)&lt;/td&gt;
&lt;td&gt;system mode&lt;/td&gt;
&lt;td&gt;legacy &lt;code&gt;System.assertEquals&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;All three defaulted to system-mode SOQL and DML&lt;/strong&gt; — no FLS, CRUD, or sharing enforcement on the operation. On Summer '26 (API v67.0), the secure default is User Mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apex"&gt;&lt;code&gt;&lt;span class="c1"&gt;// default output — system mode&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Contact&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;:&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;AccountId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Account_Industry__c&lt;/span&gt;
                  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Contact&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;AccountId&lt;/span&gt; &lt;span class="n"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;changedIds&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;update&lt;/span&gt; &lt;span class="n"&gt;contactsToUpdate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apex"&gt;&lt;code&gt;&lt;span class="c1"&gt;// with the context file — user mode&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Contact&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;:&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;AccountId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Account_Industry__c&lt;/span&gt;
                  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Contact&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;AccountId&lt;/span&gt; &lt;span class="n"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;changedIds&lt;/span&gt;
                  &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;USER_MODE&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;Database&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contactsToUpdate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AccessLevel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="py"&gt;USER_MODE&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Update — Summer '26 (v67.0) is now GA: Salesforce just made this the platform default. As of API v67.0, database operations run in User Mode by default and Apex classes default to with sharing. So on a v67.0 class a bare query is already User Mode — explicit WITH USER_MODE is now about clarity and back-compat with v66.0 and earlier. These models were tested on the pre-v67.0 platform, where system mode was still the default. The platform moving exactly this way is the strongest possible confirmation that security defaults were the gap worth closing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Two details made the test more interesting than a simple before/after:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The value isn't uniform.&lt;/strong&gt; Opus already uses the modern &lt;code&gt;Assert&lt;/code&gt; class unprompted; Sonnet and GPT still emit &lt;code&gt;System.assertEquals&lt;/code&gt;. The older the model, the more the context earns its keep. (Embarrassingly, my own examples &lt;em&gt;used&lt;/em&gt; &lt;code&gt;System.assertEquals&lt;/code&gt; — so the content was reinforcing the legacy style. Fixed that.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context isn't magic.&lt;/strong&gt; With the file loaded, GPT adopted the explicit access-mode &lt;em&gt;syntax&lt;/em&gt; but chose &lt;code&gt;SYSTEM_MODE&lt;/code&gt; — the opposite of secure. A model still has to apply what it reads. That fed straight back into the repo: I rewrote the "default to User Mode" guidance to be impossible to misread.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The takeaway isn't "AI can't write Apex." It clearly can. The gap is narrow and sharp: &lt;strong&gt;security defaults lag the platform&lt;/strong&gt;, and that's the worst place for a gap, because system-mode DML compiles, passes its tests, and reviews clean. Nothing flags it until a security review — or an audit — does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters more as workflows get autonomous
&lt;/h2&gt;

&lt;p&gt;The interesting frontier in Salesforce dev right now is fully AI-driven workflows: hand an agent a user story, get back a tested, code-reviewed feature. But every stage in that pipeline — architect, implement, test, review — trusts the model's baseline knowledge. If that baseline is stale, the agent can pass its own tests and its own code review and still ship a deprecated pattern. The tests are green; the pattern is just old.&lt;/p&gt;

&lt;p&gt;A ground-truth context file is the cheapest possible guardrail for that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;It's free and open:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One-fetch context (tools with web access): &lt;code&gt;https://sf-llms-context.github.io/llms-full.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;No web access (e.g. free ChatGPT)? Paste the content or upload the file — the URL alone gets silently ignored.&lt;/li&gt;
&lt;li&gt;Browse or contribute: &lt;a href="https://github.com/sf-llms-context/sf-llms-context" rel="noopener noreferrer"&gt;https://github.com/sf-llms-context/sf-llms-context&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your AI tool still generates a wrong Salesforce pattern, there's an issue template for it — that feedback is exactly what keeps this current across releases.&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>ai</category>
      <category>apex</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
