<?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: Ricardas Kauneckas</title>
    <description>The latest articles on DEV Community by Ricardas Kauneckas (@ryckakas).</description>
    <link>https://dev.to/ryckakas</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%2F4122877%2F0a92c38f-a057-4738-bffa-1b023d92a0f7.jpg</url>
      <title>DEV Community: Ricardas Kauneckas</title>
      <link>https://dev.to/ryckakas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ryckakas"/>
    <language>en</language>
    <item>
      <title>Clean code didn't get less important in the AI age — it got more important</title>
      <dc:creator>Ricardas Kauneckas</dc:creator>
      <pubDate>Sun, 13 Sep 2026 08:02:21 +0000</pubDate>
      <link>https://dev.to/ryckakas/clean-code-didnt-get-less-important-in-the-ai-age-it-got-more-important-513c</link>
      <guid>https://dev.to/ryckakas/clean-code-didnt-get-less-important-in-the-ai-age-it-got-more-important-513c</guid>
      <description>&lt;p&gt;Most of the code in my day to day now flows through an agent before it lands in&lt;br&gt;
a diff. You'd think that makes clean code less relevant: nobody's staring at&lt;br&gt;
this line by line anymore. It's the opposite. The less humans read and write&lt;br&gt;
code by hand, the more the shape of the codebase does the work a reviewer used&lt;br&gt;
to do in their head.&lt;/p&gt;

&lt;p&gt;Two ideas explain why, and they lead to a concrete practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guidelines vs. guardrails
&lt;/h2&gt;

&lt;p&gt;When you brief an agent (a CLAUDE.md, an AGENTS.md, a comment in the PR&lt;br&gt;
description) you're writing guidelines. Implicit rules you hope it sticks to.&lt;br&gt;
Keep functions small. No god classes. Extract instead of nesting. They work,&lt;br&gt;
right up until the context fills up, the task gets gnarly, or the model just&lt;br&gt;
decides a fourth level of nesting is fine today. Nothing enforces them. They're&lt;br&gt;
a &lt;em&gt;request&lt;/em&gt;, not a &lt;em&gt;constraint&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardrails&lt;/strong&gt; are the other half. Explicit rules a tool enforces, with an exit&lt;br&gt;
code that fails the build. A linter, a type checker, a complexity gate in CI.&lt;br&gt;
The agent doesn't need to remember the rule or agree with it. The pipeline&lt;br&gt;
rejects the output and it gets fixed before anything ships.&lt;/p&gt;

&lt;p&gt;Both mattered before LLMs wrote code too. But guidelines used to be backstopped&lt;br&gt;
by a human reviewer who'd actually read the diff and push back. That backstop&lt;br&gt;
is thinner now. Review is faster, diffs are bigger, and the reviewer is often&lt;br&gt;
skimming code they didn't write and won't internalize the way the author would&lt;br&gt;
have. Guardrails pick up that slack. If a rule actually matters, it belongs in&lt;br&gt;
something that fails the build, not only in a paragraph the agent is&lt;br&gt;
statistically likely to follow.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's still for humans too
&lt;/h2&gt;

&lt;p&gt;The usual case for low complexity is human: less to hold in your head, fewer&lt;br&gt;
ways to misread a branch, easier to test. All of that applies to an agent just&lt;br&gt;
as much. A function with a cognitive complexity of 70 is exactly as easy to&lt;br&gt;
introduce a bug into whether the thing writing it has a brain or a context&lt;br&gt;
window. Deep nesting burns tokens and attention the same way it burns a&lt;br&gt;
reviewer's patience, and the failure mode is the same: an edge case gets missed&lt;br&gt;
because the shape of the code hid it.&lt;/p&gt;

&lt;p&gt;The part that's easy to miss is that a codebase also acts as reference material&lt;br&gt;
for the next session. An agent asked to add a feature doesn't invent a style&lt;br&gt;
from nothing, it pattern matches on what's already there, because that's the&lt;br&gt;
most relevant context it has. A clean, consistent codebase means new code tends&lt;br&gt;
to follow the same clean patterns. A messy one means the agent's best available&lt;br&gt;
example of "how we do things here" is the mess, and it faithfully extends it.&lt;br&gt;
Good code compounds into more good code. Bad code compounds into more bad code,&lt;br&gt;
just faster than it used to, because now there's an eager pair of hands copying&lt;br&gt;
whatever pattern is nearest.&lt;/p&gt;

&lt;p&gt;That's the actual argument for guardrails over guidelines: a linter that fails&lt;br&gt;
the build doesn't let the mess get far enough to become a template.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tools, not just one kind
&lt;/h2&gt;

&lt;p&gt;None of this is language specific, or even complexity specific. It applies to&lt;br&gt;
every category of quality tool: formatters, type checkers, static analysis,&lt;br&gt;
security scanners, complexity gates. The common thread is enforced, not&lt;br&gt;
requested.&lt;/p&gt;

&lt;p&gt;For cognitive and cyclomatic complexity there's &lt;a href="https://github.com/uudashr/gocognit" rel="noopener noreferrer"&gt;&lt;code&gt;gocognit&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
for Go and the &lt;a href="https://github.com/SonarSource/eslint-plugin-sonarjs" rel="noopener noreferrer"&gt;&lt;code&gt;sonarjs&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
ESLint rules for JS/TS, and for PHP I maintain a small one myself - &lt;a href="https://github.com/ryckakas/phpcognit" rel="noopener noreferrer"&gt;phpcognit&lt;/a&gt;: a single&lt;br&gt;
static binary written in Rust with no PHP runtime or Composer entry that scans large codebases&lt;br&gt;
in a couple of seconds and supports baselining, so a legacy project can gate on&lt;br&gt;
new violations without fixing everything that predates the tool.&lt;/p&gt;

&lt;p&gt;For static analysis there's &lt;a href="https://phpstan.org/" rel="noopener noreferrer"&gt;PHPStan&lt;/a&gt; for PHP and&lt;br&gt;
&lt;a href="https://mypy-lang.org/" rel="noopener noreferrer"&gt;mypy&lt;/a&gt; for Python. For formatting,&lt;br&gt;
&lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; and &lt;code&gt;gofmt&lt;/code&gt; are the cheapest guardrail there&lt;br&gt;
is, with zero excuse not to run one. For security, &lt;a href="https://semgrep.dev/" rel="noopener noreferrer"&gt;Semgrep&lt;/a&gt;&lt;br&gt;
covers the same principle at higher stakes.&lt;/p&gt;

&lt;p&gt;If you're running agents against a codebase day to day, worth asking: what&lt;br&gt;
guardrails are actually catching things for you, versus what's still living as&lt;br&gt;
a hopeful paragraph in a prompt file?&lt;/p&gt;

&lt;p&gt;LINKS:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ryckakas/phpcognit" rel="noopener noreferrer"&gt;https://github.com/ryckakas/phpcognit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cleancode</category>
      <category>softwaredevelopment</category>
      <category>agents</category>
    </item>
  </channel>
</rss>
