<?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: Ian Hogers</title>
    <description>The latest articles on DEV Community by Ian Hogers (@ian_hogers_279aa8f731f33f).</description>
    <link>https://dev.to/ian_hogers_279aa8f731f33f</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%2F3443926%2Fc22a0853-80f7-4c99-b572-f358f2697066.jpg</url>
      <title>DEV Community: Ian Hogers</title>
      <link>https://dev.to/ian_hogers_279aa8f731f33f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ian_hogers_279aa8f731f33f"/>
    <language>en</language>
    <item>
      <title>Aggressive Proximity Patterns: Teaching AI Agents to Write Production-Ready Code</title>
      <dc:creator>Ian Hogers</dc:creator>
      <pubDate>Tue, 19 Aug 2025 03:24:19 +0000</pubDate>
      <link>https://dev.to/ian_hogers_279aa8f731f33f/aggressive-proximity-patterns-teaching-ai-agents-to-write-production-ready-code-2p4</link>
      <guid>https://dev.to/ian_hogers_279aa8f731f33f/aggressive-proximity-patterns-teaching-ai-agents-to-write-production-ready-code-2p4</guid>
      <description>&lt;h2&gt;
  
  
  Your AI Code Sucks. Here's How to Fix It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The brutal truth:&lt;/strong&gt; Your AI writes code that works today and breaks tomorrow. Nobody knows why it does what it does. Three weeks later, you're debugging magic numbers and wondering if that Redis choice was intentional or random.&lt;/p&gt;

&lt;p&gt;Let's fix this mess.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem: AI Code Anxiety
&lt;/h2&gt;

&lt;p&gt;You know that feeling. The AI just generated 200 lines of seemingly perfect code. It compiles. Tests pass. But your stomach is in knots because:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You have no idea if it's actually correct.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You're staring at it, trying to reverse-engineer the logic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Is this Redis choice deliberate or did it just copy from Stack Overflow?"&lt;/li&gt;
&lt;li&gt;"Will this break under load? Who knows?"&lt;/li&gt;
&lt;li&gt;"Is this secure? Time to spend 3 hours verifying..."&lt;/li&gt;
&lt;li&gt;"Why 100ms timeout? Is that tested or arbitrary?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This anxiety is real. You're not stupid. The code gives you zero confidence because it lacks the one thing that builds trust: &lt;strong&gt;transparent reasoning&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You're basically accepting code from a brilliant intern who refuses to explain anything. Sure, it might be genius. Or it might explode in production. You won't know until 3am when your phone rings.&lt;/p&gt;

&lt;p&gt;This isn't AI's fault. You're asking it to write code without teaching it to explain its thinking. That's like hiring a developer and telling them "never document anything, never explain your decisions."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Put Context Where It Belongs
&lt;/h2&gt;

&lt;p&gt;Stop writing documentation. Start embedding decisions directly in the code. Every choice, every trade-off, every rejected alternative - RIGHT THERE where the decision lives.&lt;/p&gt;

&lt;p&gt;No separate docs. No wiki pages. No "see documentation" comments. Just pure, brutal transparency at the point of impact.&lt;/p&gt;

&lt;p&gt;Here's a real example from an agent orchestrator I was working on (from &lt;a href="https://github.com/SaintPepsi/spiral-core" rel="noopener noreferrer"&gt;spiral-core&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cd"&gt;/// ⏱️ TASK POLLING INTERVAL: Balance between responsiveness and CPU usage&lt;/span&gt;
&lt;span class="cd"&gt;/// Why: 100ms provides near-real-time feel without excessive CPU overhead&lt;/span&gt;
&lt;span class="cd"&gt;/// Alternative: 50ms (rejected: 2x CPU usage), 500ms (rejected: sluggish UX)&lt;/span&gt;
&lt;span class="cd"&gt;/// Calculation: ~10 polls/second = reasonable for human-perceived responsiveness&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;TASK_POLL_INTERVAL_MS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;u64&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cd"&gt;/// 🚦 MAX QUEUE SIZE: Memory protection for 8GB VPS deployment&lt;/span&gt;
&lt;span class="cd"&gt;/// Why: 1000 tasks ≈ 1MB RAM (1KB avg task) provides safety margin&lt;/span&gt;
&lt;span class="cd"&gt;/// Calculation: 8GB total - 2GB OS - 4GB app = 2GB buffer ÷ 1KB = 2M tasks theoretical&lt;/span&gt;
&lt;span class="cd"&gt;/// Conservative: 1K tasks allows for larger tasks and system overhead&lt;/span&gt;
&lt;span class="cd"&gt;/// Alternative: 10K (rejected: potential OOM), 100 (rejected: too restrictive)&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAX_QUEUE_SIZE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See that? Real numbers. Real trade-offs. Real alternatives that were actually considered and rejected for specific reasons. Not because someone said so, but because the math doesn't lie.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Five Rules. No Exceptions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Document Decisions Where You Make Them
&lt;/h3&gt;

&lt;p&gt;Stop pretending you'll update that wiki. You won't. Write it where it lives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# 🧠 DECISION: Using Redis for session storage
# Why: Need atomic operations for concurrent session updates
# Alternative: In-memory store - rejected due to multi-server deployment
# Impact: Adds Redis dependency but ensures session consistency
&lt;/span&gt;&lt;span class="n"&gt;session_store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RedisSessionStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection_pool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Tests Next to Code, Always
&lt;/h3&gt;

&lt;p&gt;Your test folder structure is a lie. Put tests where they belong:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
├── user_service.py
├── user_service_test.py    # RIGHT HERE, not in /tests/unit/services/user/
├── auth/
│   ├── authenticator.rs
│   └── authenticator_test.rs  # Colocated, not lost in /tests/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Abstract on Third Use, Not First
&lt;/h3&gt;

&lt;p&gt;Premature abstraction kills more projects than no abstraction. Count to three:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Strike 1: UserController validation (leave it)&lt;/span&gt;
&lt;span class="c1"&gt;// Strike 2: AdminController validation (still leave it)&lt;/span&gt;
&lt;span class="c1"&gt;// Strike 3: ApiController validation → NOW extract to ValidationUtils&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ValidationUtils&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./utils/validation&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Error Context Where Errors Happen
&lt;/h3&gt;

&lt;p&gt;Stop logging "error occurred". Tell me what actually broke:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// 🚨 ERROR CONTEXT: Database connection during user auth&lt;/span&gt;
    &lt;span class="c"&gt;// Common causes:&lt;/span&gt;
    &lt;span class="c"&gt;// 1. Connection pool exhausted (check MAX_CONNECTIONS)&lt;/span&gt;
    &lt;span class="c"&gt;// 2. Database server down (check health endpoint)&lt;/span&gt;
    &lt;span class="c"&gt;// 3. Network partition (check firewall rules)&lt;/span&gt;
    &lt;span class="c"&gt;// Debug: Enable DB_DEBUG=true for connection logging&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"auth failed at DB layer: %w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&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;h3&gt;
  
  
  5. Security Reasoning at Security Points
&lt;/h3&gt;

&lt;p&gt;Don't hide your threat model in documentation. Put it where you enforce it:&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="c1"&gt;// 🛡️ SECURITY: Rate limiting per IP to prevent brute force&lt;/span&gt;
&lt;span class="c1"&gt;// Threat: Password spraying attacks&lt;/span&gt;
&lt;span class="c1"&gt;// Mitigation: 5 attempts per 15min window per IP&lt;/span&gt;
&lt;span class="c1"&gt;// Bypass: Internal IPs in TRUSTED_NETWORKS env var&lt;/span&gt;
&lt;span class="c1"&gt;// Monitoring: Alerts sent after 3 failed attempts&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rateLimiter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RateLimiter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;windowMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;skipSuccessfulRequests&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;h2&gt;
  
  
  Stop the Anxiety: Make Your AI Explain Itself
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Prompt That Changes Everything
&lt;/h3&gt;

&lt;p&gt;Here's the exact text that turns anxiety-inducing AI code into code you can actually trust (see &lt;a href="https://github.com/SaintPepsi/aggressive-proximity-patterns/blob/main/docs/ai-agents/prompt-templates.md" rel="noopener noreferrer"&gt;more detailed templates here&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Generate code following aggressive proximity patterns:
&lt;span class="p"&gt;
-&lt;/span&gt; Add 🧠 DECISION comments explaining non-obvious choices
&lt;span class="p"&gt;-&lt;/span&gt; Include WHY in comments, not WHAT
&lt;span class="p"&gt;-&lt;/span&gt; Document alternatives considered and why rejected
&lt;span class="p"&gt;-&lt;/span&gt; Colocate tests with implementation
&lt;span class="p"&gt;-&lt;/span&gt; Provide rich error context at error sites
&lt;span class="p"&gt;-&lt;/span&gt; Mark security decisions with 🛡️ SECURITY comments
&lt;span class="p"&gt;-&lt;/span&gt; Document performance choices with ⚡ PERFORMANCE comments

Example format for decisions:
// 🧠 DECISION: [What you decided]
// Why: [Specific reason]
// Alternative: [What else you considered] - rejected: [Why rejected]
// Impact: [What this means for the system]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Difference Is Night and Day
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;BEFORE&lt;/strong&gt; (Anxiety-inducing mystery code):&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;BATCH_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processBatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;processChunk&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;&lt;strong&gt;AFTER&lt;/strong&gt; (Code you can actually trust):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ⚡ PERFORMANCE: Batch size for async processing&lt;/span&gt;
&lt;span class="c1"&gt;// Why: 50 items balances memory usage vs parallelization overhead&lt;/span&gt;
&lt;span class="c1"&gt;// Measured: 50 items = ~200ms per batch on typical 2-core container&lt;/span&gt;
&lt;span class="c1"&gt;// Alternative: 100 (rejected: memory spikes &amp;gt;500MB), 10 (rejected: too many promises)&lt;/span&gt;
&lt;span class="c1"&gt;// Monitoring: Track via BATCH_PROCESS_TIME metric&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BATCH_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processBatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 🧠 DECISION: Using Promise.all for parallel processing&lt;/span&gt;
  &lt;span class="c1"&gt;// Why: All chunks independent, fail-fast behavior desired&lt;/span&gt;
  &lt;span class="c1"&gt;// Alternative: Sequential processing (rejected: 10x slower)&lt;/span&gt;
  &lt;span class="c1"&gt;// Alternative: Promise.allSettled (rejected: need immediate failure on error)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;processChunk&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// processBatch.test.js would be RIGHT HERE in the same directory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Measuring Success: The Proximity Score
&lt;/h2&gt;

&lt;p&gt;Your code gets scored on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decision Coverage (25%)&lt;/strong&gt;: Are significant decisions documented?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Colocation (25%)&lt;/strong&gt;: Tests next to implementation?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstraction Timing (20%)&lt;/strong&gt;: Following the 3-strikes rule?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comment Quality (15%)&lt;/strong&gt;: Context-rich, not redundant?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File Organization (15%)&lt;/strong&gt;: Related code physically close?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Actually Changes When You Do This
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Less AI Code Anxiety&lt;/strong&gt;: You know exactly why every decision was made&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster Debugging&lt;/strong&gt;: Context is right there, no archaeology needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New Devs (ai or real) Productive in Days, Not Weeks/Months&lt;/strong&gt;: Everything explains itself&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Reviews Become Discussions, Not Interrogations&lt;/strong&gt;: Decisions pre-explained&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sleep Better&lt;/strong&gt;: Your AI(junior) code won't surprise you at 3am&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Just Start. Today. Now
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick your worst piece of AI code&lt;/strong&gt;: The one that scares you&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add ONE decision comment&lt;/strong&gt;: Explain the scariest part&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update your AI prompt&lt;/strong&gt;: Copy the enhancement above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch your anxiety disappear&lt;/strong&gt;: Seriously, it's that simple&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Critical Patterns for High-Stakes Code
&lt;/h2&gt;

&lt;h3&gt;
  
  
  For Critical Systems
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# 🧠 DECISION: Using database transactions for payment processing
# Why: Atomicity required - either all operations succeed or all rollback
# Risk: Without transaction - partial payment state on failure
# Compliance: PCI-DSS requirement 10.2.1 for atomic financial operations
# Rollback trigger: Any exception or payment gateway timeout &amp;gt;30s
&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transaction&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;txn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# ... payment logic
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  For Performance-Critical Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ⚡ PERFORMANCE: Pre-allocated Vec with known capacity&lt;/span&gt;
&lt;span class="c1"&gt;// Why: Avoids 3-4 reallocations during typical 1000-item processing&lt;/span&gt;
&lt;span class="c1"&gt;// Measured: 15% faster for p99 latency (120ms → 102ms)&lt;/span&gt;
&lt;span class="c1"&gt;// Memory: 1000 * size_of::&amp;lt;Item&amp;gt;() = ~8KB upfront allocation&lt;/span&gt;
&lt;span class="c1"&gt;// Alternative: Vec::new() (rejected: reallocation overhead)&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;Vec&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;with_capacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  For Security Boundaries
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// 🛡️ SECURITY: Input sanitization for SQL injection prevention&lt;/span&gt;
&lt;span class="c"&gt;// Threat: User input in 'search' param could contain SQL&lt;/span&gt;
&lt;span class="c"&gt;// Mitigation: Parameterized query + allowlist validation&lt;/span&gt;
&lt;span class="c"&gt;// Pattern: ^[a-zA-Z0-9\s-_]{1,100}$&lt;/span&gt;
&lt;span class="c"&gt;// Logging: All rejected inputs logged to security_events&lt;/span&gt;
&lt;span class="c"&gt;// Testing: See sql_injection_test.go for attack vectors&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;isValidSearchTerm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;logSecurityEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"invalid_search_term"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ErrInvalidInput&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Mindset That Changes Everything
&lt;/h2&gt;

&lt;p&gt;Here's the truth: Documentation is dead. It was dead the moment you wrote it. Nobody updates it, nobody reads it, and it's always wrong.&lt;/p&gt;

&lt;p&gt;Your code is the only truth. Make it tell the whole truth.&lt;/p&gt;

&lt;p&gt;When you embed decisions in code, you're not documenting - you're having a conversation with every future developer or ai agent who touches this code. Including yourself at 3am when production is down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do This Right Now
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open your scariest AI-generated file&lt;/strong&gt;: You know which one&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add ONE proximity comment&lt;/strong&gt;: Explain the decision that confuses you most&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feel the relief&lt;/strong&gt;: That anxiety? It's already fading&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never go back&lt;/strong&gt;: Once you see the difference, you can't unsee it&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Join Us in Killing Documentation Forever
&lt;/h2&gt;

&lt;p&gt;We're done with lies. Done with outdated wikis. Done with "see documentation" comments that lead nowhere.&lt;/p&gt;

&lt;p&gt;Code should explain itself. At the point of decision. No excuses.&lt;/p&gt;

&lt;p&gt;Contribute your patterns. Share what works. Help us make AI code trustworthy by default.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Final truth&lt;/strong&gt;: You're either writing code that explains itself, or you're creating tomorrow's technical debt.&lt;/p&gt;

&lt;p&gt;Stop the anxiety. Start the proximity. Make your AI code trustworthy.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/SaintPepsi/aggressive-proximity-patterns" rel="noopener noreferrer"&gt;Github: Aggressive Proximity Patterns for AI Code Generation&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Show me your before/after. Prove me wrong. Or prove me right.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Be Honest
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What AI-generated code keeps you up at night?&lt;/li&gt;
&lt;li&gt;How many times have you rewritten AI code because you didn't trust it?&lt;/li&gt;
&lt;li&gt;What would change if every line of code explained itself?&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>agenticworkflows</category>
      <category>codequality</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
