<?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: Hamza Syed</title>
    <description>The latest articles on DEV Community by Hamza Syed (@hamza140).</description>
    <link>https://dev.to/hamza140</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%2F1201974%2F47c79ca1-f50c-4ab9-8501-5728fd379c96.png</url>
      <title>DEV Community: Hamza Syed</title>
      <link>https://dev.to/hamza140</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamza140"/>
    <language>en</language>
    <item>
      <title>Reviewing AI-generated PRs: the 10-minute checklist</title>
      <dc:creator>Hamza Syed</dc:creator>
      <pubDate>Wed, 21 Oct 2026 18:55:35 +0000</pubDate>
      <link>https://dev.to/hamza140/reviewing-ai-generated-prs-the-10-minute-checklist-4gm8</link>
      <guid>https://dev.to/hamza140/reviewing-ai-generated-prs-the-10-minute-checklist-4gm8</guid>
      <description>&lt;p&gt;AI-generated PRs have a tell: they're &lt;em&gt;too&lt;/em&gt; clean. Perfect formatting, thorough comments, confident summaries. And that's exactly why they need a different review: the polish hides the same failure modes every time.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/reviewing-ai-generated-prs-checklist" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Fog%2Fog-default.png" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/reviewing-ai-generated-prs-checklist" rel="noopener noreferrer" class="c-link"&gt;
            Reviewing AI-generated PRs: a checklist · NotVibesCoded
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            AI-generated pull requests look confident and complete. That confidence is the hazard. A 10-minute review checklist that catches the specific ways…
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Ficons%2Ffavicon-light.svg" width="256" height="256"&gt;
          notvibescoded.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  The 10-minute checklist
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Minutes 0–2: What did it touch that it shouldn't have?
&lt;/h3&gt;

&lt;p&gt;Open the file list first, not the diff. Agents are notorious for scope creep: reformatting untouched files, "fixing" adjacent code, adding dependencies for one helper function. If the PR touches files outside the task, that's your first question, not your first approval.&lt;/p&gt;

&lt;h3&gt;
  
  
  Minutes 2–4: The tests it wrote for itself
&lt;/h3&gt;

&lt;p&gt;Agents write tests that pass, not tests that protect. Check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do the tests assert behavior or implementation?&lt;/strong&gt; A test that mirrors the code line-by-line will pass forever and catch nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are the edge cases real?&lt;/strong&gt; Empty inputs, nulls, permission failures, timeouts, or just the happy path three times?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Would the test fail if the code were wrong?&lt;/strong&gt; Mutate the logic mentally. If the test still passes, it's decoration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Minutes 4–6: Error handling and the unhappy path
&lt;/h3&gt;

&lt;p&gt;This is where AI code most consistently underperforms. Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bare &lt;code&gt;except:&lt;/code&gt; / empty catch blocks&lt;/li&gt;
&lt;li&gt;Errors swallowed and logged but never surfaced&lt;/li&gt;
&lt;li&gt;Retries without backoff or limits&lt;/li&gt;
&lt;li&gt;User-facing errors that leak stack traces or internals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ask: "what happens when this fails?" If you can't answer from reading the code, neither can the on-call engineer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Minutes 6–8: Security basics
&lt;/h3&gt;

&lt;p&gt;Agents don't think adversarially. Scan for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL/query construction with string interpolation&lt;/li&gt;
&lt;li&gt;Missing authorization checks (authentication ≠ authorization)&lt;/li&gt;
&lt;li&gt;Secrets or tokens in code, logs, or error messages&lt;/li&gt;
&lt;li&gt;Mass assignment / over-permissive input binding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need a full audit, just the OWASP top-10 instincts applied for two minutes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Minutes 8–10: Would you have written it this way?
&lt;/h3&gt;

&lt;p&gt;Not style, &lt;em&gt;judgment&lt;/em&gt;. Did it pick the simple approach or the clever one? Did it add an abstraction for a single use? Did it duplicate something that exists three files over? Agents optimize for completing the task, not for the codebase's future. That's your job, and it's the part that takes the longest to learn and the least time to check once you know the smell.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to automate
&lt;/h2&gt;

&lt;p&gt;Everything above that's mechanical belongs in CI, not in your 10 minutes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scope check: fail if files outside the ticket's area change without explanation&lt;/li&gt;
&lt;li&gt;Test mutation score on AI-generated PRs (higher bar than human PRs, not lower)&lt;/li&gt;
&lt;li&gt;Secret scanning, obviously&lt;/li&gt;
&lt;li&gt;Lint rules for the error-handling patterns your team keeps seeing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Check the description against the diff
&lt;/h2&gt;

&lt;p&gt;The checklist above reviews the code. Spend one of your ten minutes reviewing the &lt;em&gt;story&lt;/em&gt; the PR tells about the code, because AI-written descriptions are fluent, confident, and occasionally fictional.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Added tests for X"&lt;/strong&gt;: open the test file. Count the assertions. Agents regularly describe the tests they intended to write.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"No behavior change"&lt;/strong&gt; on a refactor: spot-check one call site of anything that moved. Refactors that rename are safe; refactors that rename &lt;em&gt;and&lt;/em&gt; adjust a condition are behavior changes wearing a costume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Handles the error case"&lt;/strong&gt;: find the error case in the diff. If the handling is a log line, the description and the code disagree, and the code is the one that ships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This isn't paranoia; it's calibration. The description is generated by the same process that generated the code, with the same confidence and the same blind spots. Trust it exactly as much as you'd trust a summary written by someone who skimmed.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the approach itself is wrong
&lt;/h2&gt;

&lt;p&gt;The hardest AI PRs to review are the ones where every line is locally fine and the whole thing is wrong. The agent added a utility that already exists two folders over. It solved the problem in the controller when your architecture solves it in the service layer. It introduced a second state-management pattern next to the one the codebase standardized on.&lt;/p&gt;

&lt;p&gt;Line-by-line review waves these through, because each line is defensible. The defense is the file list from minutes 0–2 and one question: &lt;strong&gt;"If a new hire had written this, where would I tell them this code belongs?"&lt;/strong&gt; If the answer is "not here," the review is a redirect, not a line edit. Ask for the approach change early and specifically, naming the existing pattern to follow. Agents take structural feedback well; it's the feedback they almost never get, because reviewers default to commenting on lines.&lt;/p&gt;

&lt;p&gt;A related tell lives in the commit history. One giant commit named "implement feature" is normal for agents and useless for review; a sequence of small commits, each doing one thing, is reviewable. You can't rewrite the agent's habits, but you can set the bar in your context file: small commits, messages that say why, no unrelated changes in the same commit. Review quality is partly a function of what the reviewer is handed, and shaping the input is cheaper than straining over a bad one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mindset shift
&lt;/h2&gt;

&lt;p&gt;Reviewing human code, you ask "is this correct?" Reviewing AI code, ask "what did it &lt;em&gt;not&lt;/em&gt; consider?" The agent did the typing. Your review is the engineering.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;This checklist is published on &lt;a href="https://www.notvibescoded.com/articles/reviewing-ai-generated-prs-checklist" rel="noopener noreferrer"&gt;NotVibesCoded&lt;/a&gt;&lt;/strong&gt;, alongside field guides on context files for coding agents, database migrations with AI, and shipping AI-built software without the slop.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>AI Found Two Critical Flaws Hiding in PHP for a Decade</title>
      <dc:creator>Hamza Syed</dc:creator>
      <pubDate>Wed, 21 Oct 2026 17:18:54 +0000</pubDate>
      <link>https://dev.to/hamza140/ai-found-two-critical-flaws-hiding-in-php-for-a-decade-cej</link>
      <guid>https://dev.to/hamza140/ai-found-two-critical-flaws-hiding-in-php-for-a-decade-cej</guid>
      <description>&lt;p&gt;PHP released emergency security updates today for two critical vulnerabilities that allow an attacker to run code on a web server without logging in. The flaws, nicknamed PHP2Shell, are tracked as CVE-2026-109618 and CVE-2026-109619, and both carry a CVSS v4 score of 9.2. They affect the PHP engine itself, which means they sit underneath WordPress, Drupal, Magento, and every other site PHP serves, no matter how careful the code on top is.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/php2shell-ai-found-critical-php-flaws" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Fog%2Fog-default.png" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/php2shell-ai-found-critical-php-flaws" rel="noopener noreferrer" class="c-link"&gt;
            PHP2Shell: AI found critical PHP flaws · NotVibesCoded
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Two critical remote code execution flaws sat in PHP, the language behind roughly 70% of websites, for more than a decade. AI models helped researchers find…
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Ficons%2Ffavicon-light.svg" width="256" height="256"&gt;
          notvibescoded.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The detail that should get your attention is not the severity score. It is how the bugs were found, and how quickly they were turned into working attacks once someone looked properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What PHP2Shell Actually Is
&lt;/h2&gt;

&lt;p&gt;Both flaws are memory-safety bugs in how PHP handles requests, and both end in unauthenticated remote code execution.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CVE-2026-109618&lt;/strong&gt; corrupts memory during out-of-memory handling. When a request runs out of memory mid-setup, PHP's error recovery can leave request data half-initialised, and the cleanup path then treats that broken data as valid.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CVE-2026-109619&lt;/strong&gt; is a use-after-free problem with global state. Data from one visitor's request can outlive its memory and be picked up by a later request. One confirmed attack route runs through PHP's session upload-progress feature, which has been enabled by default for over a decade.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every PHP installation that serves web requests is in scope: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, and LiteSpeed. The PHP team rates mod_php as the highest risk because a demonstrated exploit fires from a single unauthenticated request before any application code runs. Login screens and security plugins never get a chance to help.&lt;/p&gt;

&lt;p&gt;Wiz, the Google-owned security company that independently found both bugs, says every PHP release back to 5.4 is hit by at least one of them. The flaws have effectively been sitting in the codebase for more than a decade.&lt;/p&gt;

&lt;h2&gt;
  
  
  How AI Found Them
&lt;/h2&gt;

&lt;p&gt;In August, Ryan Austin, a researcher at the security firm Calif, was auditing PHP's source code with help from GPT-5.6 Sol, one of OpenAI's most advanced models. The audit was part of Patch the Planet, an open-source security programme OpenAI launched in June with Trail of Bits. Austin found one of the flaws. Wiz's researchers, working independently with Google's Gemini 4 Argon, GPT-5.6 Sol, and their own research system, found both.&lt;/p&gt;

&lt;p&gt;OpenAI has published its account of the response under the title "Patch the Planet", and calls the bugs "one of the most impactful security issues in recent memory". That is not just marketing. The class of bug involved had been flagged as a problem area decades ago and then largely forgotten, because exploiting it was considered too difficult. AI changed the economics of trying. By the researchers' account, the models helped turn a theoretical weakness into reliable exploitation with as few as a few dozen requests to a server: seconds on small systems, hours on complex ones. Work that would have taken a skilled team months took about a week.&lt;/p&gt;

&lt;p&gt;Calif's chief executive, Thai Duong, put the other half of the problem plainly to the Wall Street Journal: "Some dude on Twitter could take the patches and run AI against it and post some exploit script. All hell will break loose." Once a patch ships, anyone can diff it against the old code and ask a model to explain exactly what changed and where the bug was. The same capability that found the flaw can reverse-engineer it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Scramble
&lt;/h2&gt;

&lt;p&gt;The coordinated disclosure did not survive contact with the internet. Details of both CVEs circulated on Hacker News and social media on October 20, a day before the planned announcement, and an exploit demonstration dubbed php2shell spread online. PHP pulled its release forward by a day.&lt;/p&gt;

&lt;p&gt;On the morning of October 21, Cloudflare's CTO reported early attacks already in progress, roughly six hours before the patches landed, and said the company had deployed emergency firewall rules for all customers, including free ones. He was explicit that this was a stopgap and that only patching solves it. CISA and the FBI urged organisations to patch immediately. In the Netherlands, the national login system DigiD, the parliament website, and the country's own cybersecurity agency took their sites offline as a precaution. Security telemetry counted more than 22.6 million internet-exposed servers running potentially vulnerable PHP.&lt;/p&gt;

&lt;p&gt;The fixes shipped at about 13:35 UTC in PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35.&lt;/p&gt;

&lt;h2&gt;
  
  
  If You Run PHP, Patch Now
&lt;/h2&gt;

&lt;p&gt;The PHP Foundation's position is blunt: "There are no complete mitigations, updating is the only safe choice."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Update&lt;/strong&gt; to PHP 8.5.12, 8.4.27, 8.3.36, or 8.2.35. Linux distribution and LTS users should check their vendor for packages, which were shared in advance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not rely on workarounds.&lt;/strong&gt; Setting &lt;code&gt;session.upload_progress.enabled=0&lt;/code&gt; blocks one confirmed attack path for CVE-2026-109619 and nothing else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PHP 8.1 and older get no upstream fix.&lt;/strong&gt; The PHP team released minimal source backports for 7.4, 8.0, and 8.1, and some vendors are backporting further, but an unpatched legacy install that cannot be updated should be taken offline until it can be. A large share of the PHP servers visible on the internet still run unsupported versions, and they are now the softest targets on the web.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Part That Matters After Today
&lt;/h2&gt;

&lt;p&gt;Strip away the incident response and one fact remains: flaws that survived a decade of human review were found and weaponised in weeks once frontier models were pointed at the code. That cuts in both directions at once. Defenders get an auditor that never gets tired and can read an entire engine looking for one bad assumption. Attackers get the same auditor, plus a patch-diffing machine the moment a fix ships.&lt;/p&gt;

&lt;p&gt;This time the defenders moved first, and the coordination worked: researchers, maintainers, hosting providers, and governments had fixes and firewall rules ready before a working exploit was public. OpenAI is explicitly proposing that kind of coordinated response as the model for what comes next, because the discovery side is only going to get faster.&lt;/p&gt;

&lt;p&gt;For anyone building software with AI, including the AI-assisted kind covered on this site, the lesson is uncomfortable and useful. The review bar just moved. Code that merely looks right has always been a liability; now there is machinery that can systematically find the places where it is not right, whether you run that machinery on your own code first or someone else runs it for you. Shipping fast is fine. Shipping unreviewed is becoming a measurable risk with a timeline attached.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.notvibescoded.com/articles/php2shell-ai-found-critical-php-flaws" rel="noopener noreferrer"&gt;NotVibesCoded&lt;/a&gt;, where the PHP2Shell piece covers what happened, how AI found the flaws, and what to patch. Read the full article there, and follow for honest, hands-on coverage of building with AI.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>Context files for coding agents: the complete guide</title>
      <dc:creator>Hamza Syed</dc:creator>
      <pubDate>Wed, 21 Oct 2026 08:47:47 +0000</pubDate>
      <link>https://dev.to/hamza140/context-files-for-coding-agents-the-complete-guide-2ahp</link>
      <guid>https://dev.to/hamza140/context-files-for-coding-agents-the-complete-guide-2ahp</guid>
      <description>&lt;p&gt;Every major coding agent now reads a context file at the start of a session. Claude Code reads &lt;code&gt;CLAUDE.md&lt;/code&gt;. Cursor reads &lt;code&gt;AGENTS.md&lt;/code&gt; and its own rules files. Copilot reads &lt;code&gt;.github/muse-instructions.md&lt;/code&gt;. Aider can be pointed at a conventions file. Different names, same idea: a short document that tells the agent how your project works before it touches a line of code.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/context-files-coding-agents-field-guide" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Fog%2Fog-default.png" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.notvibescoded.com/articles/context-files-coding-agents-field-guide" rel="noopener noreferrer" class="c-link"&gt;
            Context files for coding agents: a guide · NotVibesCoded
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Every coding agent reads a context file, CLAUDE.md, AGENTS.md, Copilot instructions, and most of them are decoration. The complete guide to writing one that…
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.notvibescoded.com%2Ficons%2Ffavicon-light.svg" width="256" height="256"&gt;
          notvibescoded.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Most of these files are useless. They’re either empty, a wishlist (“write clean, maintainable code”), or a 500-line brain dump nobody maintains. The agents aren’t the problem. The files are. This guide is the merged, field-tested version of everything we’ve published on the topic: what to put in the file, what to leave out, how to structure it, and how to prompt in a way that makes the file pay off.&lt;/p&gt;

&lt;h2&gt;
  
  
  One file, several names: don’t maintain five copies
&lt;/h2&gt;

&lt;p&gt;If you use more than one agent (most developers now do), the naming sprawl becomes its own problem: &lt;code&gt;CLAUDE.md&lt;/code&gt; for Claude Code, &lt;code&gt;AGENTS.md&lt;/code&gt; as the cross-tool standard Cursor and others read, &lt;code&gt;.github/muse-instructions.md&lt;/code&gt; for Copilot, a conventions file for Aider. Five copies of the same rules &lt;em&gt;will&lt;/em&gt; drift apart, and drifted instructions are worse than missing ones, because each agent then follows a different version of your conventions.&lt;/p&gt;

&lt;p&gt;The setup that survives: &lt;strong&gt;one canonical file, thin pointers everywhere else.&lt;/strong&gt; Keep the real content in &lt;code&gt;AGENTS.md&lt;/code&gt; (the name the most tools read natively), and make each tool-specific file a stub: “Read &lt;code&gt;AGENTS.md&lt;/code&gt; in the repo root and follow it; the rules below are the only additions for this tool.” Tool quirks go in the stub, everything shared lives in exactly one place. This space moves fast, so check your tool’s current docs once a quarter, but the principle doesn’t change: one source of truth, pointers elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bar: every line prevents a real mistake
&lt;/h2&gt;

&lt;p&gt;Think of the context file as onboarding a sharp junior developer who has infinite energy, perfect memory within a session, and zero knowledge of your project. You wouldn’t hand them a 200-page wiki. You’d give them the ten things that prevent the ten most common mistakes.&lt;/p&gt;

&lt;p&gt;That’s the standard for every line: &lt;strong&gt;does this prevent a real mistake you’ve seen the agent make?&lt;/strong&gt; If a line is philosophy, cut it. Agents follow concrete constraints. They ignore aspirations, because they were already trying to “write clean code” before you asked.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five sections that matter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Stack and commands
&lt;/h3&gt;

&lt;p&gt;The highest-value section in any context file is the boring one: how to build, test, and lint. Two or three commands the agent will run constantly, with the caveats that matter (“the full suite takes about 4 minutes; run a single file while iterating”). Without this, the agent guesses, and guesses wrong, burning loops on commands that don’t exist in your repo.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Architecture in five lines
&lt;/h3&gt;

&lt;p&gt;Where the code lives and how it flows. “&lt;code&gt;app/&lt;/code&gt;, Next.js routes. &lt;code&gt;lib/&lt;/code&gt;, shared business logic. &lt;code&gt;db/&lt;/code&gt;, schema and migrations.” That’s enough. The agent can read the rest of the tree itself; what it can’t infer is which parts are load-bearing and which are legacy.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Conventions that differ from the default
&lt;/h3&gt;

&lt;p&gt;Don’t document standard practice, the model already knows it. Document where &lt;em&gt;you&lt;/em&gt; diverge: “Database columns are snake_case; TypeScript is camelCase.” “All timestamps are stored as UTC and converted at the UI layer.” “Never use a raw hex value, always a design token.” Rules beat wishes, and conventions with one short example beat conventions described in prose.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Things that have bitten you
&lt;/h3&gt;

&lt;p&gt;The highest-value lines in the file, because they’re the ones no model can derive from the code: “The &lt;code&gt;orders&lt;/code&gt; table joins to users on &lt;code&gt;email&lt;/code&gt;, not &lt;code&gt;user_id&lt;/code&gt;.” “Don’t run migrations against the staging database; use the seed script.” “The payments module has no foreign key to &lt;code&gt;users&lt;/code&gt;; join on &lt;code&gt;customer_email&lt;/code&gt;.” Each line here is a debugging session you never have again.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. What not to do
&lt;/h3&gt;

&lt;p&gt;Explicit prohibitions work better than you’d expect: “Don’t add a new dependency without asking.” “Don’t refactor files unrelated to the task.” “Don’t write tests for generated code.” Anti-patterns from your actual history, stated as rules, are what separate a context file that changes behavior from one that’s decoration.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example
&lt;/h2&gt;

&lt;p&gt;Here’s a filled-in file for a small SaaS product. It’s 46 lines. Every line is there because it prevents a specific, observed failure.&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;# Ledgerline (billing SaaS)&lt;/span&gt;

&lt;span class="gu"&gt;## Commands&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Dev: &lt;span class="sb"&gt;`npm run dev`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Test: &lt;span class="sb"&gt;`npm test -- &amp;lt;file&amp;gt;`&lt;/span&gt; while iterating; full suite &lt;span class="sb"&gt;`npm test`&lt;/span&gt; (~4 min)
&lt;span class="p"&gt;-&lt;/span&gt; Lint: &lt;span class="sb"&gt;`npm run lint`&lt;/span&gt; (must pass before committing)

&lt;span class="gu"&gt;## Architecture&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`app/`&lt;/span&gt;, Next.js routes and API handlers
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`lib/`&lt;/span&gt;, business logic (billing in &lt;span class="sb"&gt;`lib/billing/`&lt;/span&gt;)
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`db/`&lt;/span&gt;, Prisma schema and migrations

&lt;span class="gu"&gt;## Conventions&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Database columns snake_case; TypeScript camelCase.
&lt;span class="p"&gt;-&lt;/span&gt; All timestamps UTC in the database, converted in the UI.
&lt;span class="p"&gt;-&lt;/span&gt; Money is integer cents everywhere. Never floats for amounts.
&lt;span class="p"&gt;-&lt;/span&gt; UI colors come from design tokens in &lt;span class="sb"&gt;`lib/tokens.ts`&lt;/span&gt;, never raw hex.

&lt;span class="gu"&gt;## Gotchas&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`orders`&lt;/span&gt; joins to &lt;span class="sb"&gt;`users`&lt;/span&gt; on &lt;span class="sb"&gt;`email`&lt;/span&gt;, not &lt;span class="sb"&gt;`user_id`&lt;/span&gt;.
&lt;span class="p"&gt;-&lt;/span&gt; Webhook handlers must be idempotent: Stripe retries deliveries.
&lt;span class="p"&gt;-&lt;/span&gt; Don’t run &lt;span class="sb"&gt;`prisma migrate`&lt;/span&gt; against staging; use &lt;span class="sb"&gt;`npm run db:seed`&lt;/span&gt;.

&lt;span class="gu"&gt;## Don’t&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Don’t add dependencies without asking.
&lt;span class="p"&gt;-&lt;/span&gt; Don’t refactor outside the task’s scope.
&lt;span class="p"&gt;-&lt;/span&gt; Don’t edit generated files in &lt;span class="sb"&gt;`lib/gen/`&lt;/span&gt;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what’s &lt;em&gt;not&lt;/em&gt; in it: no tutorial on how billing works, no style philosophy, no secrets. The webhook line alone is worth the whole file. Whoever wrote it clearly lost an afternoon to duplicate Stripe deliveries once, and now no agent on this repo ever will.&lt;/p&gt;

&lt;h2&gt;
  
  
  Length and layout: write for the skim
&lt;/h2&gt;

&lt;p&gt;Context files compete with your actual code for the agent’s attention. The pattern that holds up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Root file under ~100-150 lines.&lt;/strong&gt; Essentials only: commands, hard rules, layout, gotchas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Details colocated.&lt;/strong&gt; Directory-specific conventions go in a nested file in that directory (&lt;code&gt;components/AGENTS.md&lt;/code&gt;), which most agents pick up when working there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link, don’t inline.&lt;/strong&gt; “See &lt;code&gt;docs/auth.md&lt;/code&gt; for the auth flow” beats pasting the auth flow into the root file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Match reality.&lt;/strong&gt; If the codebase doesn’t actually follow a convention, writing it down teaches the agent to produce code that clashes with everything around it. Aspirational rules are worse than none.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The file is half the system: prompting that uses it
&lt;/h2&gt;

&lt;p&gt;A good context file handles what’s always true. Your prompts still have to handle what’s true &lt;em&gt;this time&lt;/em&gt;. The patterns that survive contact with real, messy codebases:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Point at the code, don’t describe it.&lt;/strong&gt; “In &lt;code&gt;app/auth/signup.tsx&lt;/code&gt;, add email validation matching the pattern in &lt;code&gt;app/auth/login.tsx&lt;/code&gt;” beats “add validation to the signup form.” File paths are facts; descriptions are interpretations the agent has to guess at.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State the constraints before the task.&lt;/strong&gt; Agents optimize for the request as stated. “Don’t add dependencies. Keep the change under 100 lines. This table has 40M rows; the migration must not lock writes.” If you don’t state a constraint, it doesn’t exist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ask for a plan on anything non-trivial.&lt;/strong&gt; For changes touching more than two files: “Propose a plan first. Don’t write code yet.” Reviewing a plan costs a paragraph; catching the same misunderstanding in a 400-line diff costs an afternoon.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hand over the failing state.&lt;/strong&gt; “It’s broken” produces guesses. The exact error, the stack trace, the reproduction steps, and what you already tried produce fixes. The agent can’t see your screen, so put your screen in the prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demand the boring parts explicitly.&lt;/strong&gt; End significant prompts with: “Include tests for the new behavior, updated docs if the API changed, and a note on what you deliberately didn’t handle.” That last clause is the highest-value sentence in prompting. It forces the agent to surface its own blind spots instead of silently shipping them.&lt;/p&gt;

&lt;p&gt;And when the agent gets it wrong twice, suspect the prompt before the model: an unstated assumption, a missing file reference, or two tasks wearing a trench coat. Split, specify, retry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintenance: the file rots faster than the code
&lt;/h2&gt;

&lt;p&gt;Commands change, rules get superseded, tools arrive. Treat staleness as a bug:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Put a last-reviewed date at the top and actually review it: when onboarding a human breaks, or the agent “forgets” the same thing twice.&lt;/li&gt;
&lt;li&gt;Delete rules that stopped mattering. A wrong instruction is worse than a missing one.&lt;/li&gt;
&lt;li&gt;Grow it by scar tissue: after any session where the agent made a preventable mistake, add the one line that would have prevented it. A month of this produces a file worth more than most documentation.&lt;/li&gt;
&lt;li&gt;Test the file, not just the code. Watch a fresh agent session and note every moment it does something the file should have prevented. Each one is a missing or unclear rule. Two sessions of this usually halves your correction rate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Four ways context files die
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The wishlist.&lt;/strong&gt; Aspirations instead of rules (“write clean code”). The agent nods and changes nothing. Covered above: rules or it didn’t happen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The novel.&lt;/strong&gt; 500 lines of everything anyone ever learned about the project. The agent skims, the important rules drown, and nobody dares edit it. The fix is subtraction, not better formatting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The zombie.&lt;/strong&gt; Written once at adoption, never updated. Six months later it documents commands that no longer exist and bans a library the team adopted in March. A wrong instruction is worse than a missing one, and zombies are mostly wrong instructions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The mirror.&lt;/strong&gt; A copy of the README, or of another tool’s context file, drifting one edit behind the original. Two sources of truth is zero sources of truth. Point, don’t copy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Build/test/lint commands, verified current, with runtimes noted&lt;/li&gt;
&lt;li&gt;[ ] Architecture in five lines or fewer&lt;/li&gt;
&lt;li&gt;[ ] 3-5 hard rules and explicit prohibitions&lt;/li&gt;
&lt;li&gt;[ ] Conventions that differ from defaults, one example each&lt;/li&gt;
&lt;li&gt;[ ] Gotchas from your actual incident history&lt;/li&gt;
&lt;li&gt;[ ] Under ~150 lines at root; details nested or linked&lt;/li&gt;
&lt;li&gt;[ ] No secrets, no tutorials, no aspirations&lt;/li&gt;
&lt;li&gt;[ ] Last-reviewed date at the top&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Context engineering isn’t prompt magic. It’s documentation discipline, the same skill that makes a good README, applied to a reader that executes what it reads. The teams getting the most from coding agents aren’t writing cleverer prompts. They’re writing better repos, and then prompting like the file is watching.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;This guide is published on &lt;a href="https://www.notvibescoded.com/articles/context-files-coding-agents-field-guide" rel="noopener noreferrer"&gt;NotVibesCoded&lt;/a&gt;&lt;/strong&gt;, where it sits with the rest of the field guides on context engineering, PR review, and shipping AI-built software without the slop.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
