<?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: Slim</title>
    <description>The latest articles on DEV Community by Slim (@slimd).</description>
    <link>https://dev.to/slimd</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%2F3770815%2Fcddf2fbb-9fbf-4bf7-a9f0-33b42491ed58.png</url>
      <title>DEV Community: Slim</title>
      <link>https://dev.to/slimd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/slimd"/>
    <language>en</language>
    <item>
      <title>Beyond "Vibe Coding": Bringing SDD and PDCA to Claude Code</title>
      <dc:creator>Slim</dc:creator>
      <pubDate>Fri, 13 Feb 2026 12:01:10 +0000</pubDate>
      <link>https://dev.to/slimd/beyond-vibe-coding-bringing-sdd-and-pdca-to-claude-code-4jn1</link>
      <guid>https://dev.to/slimd/beyond-vibe-coding-bringing-sdd-and-pdca-to-claude-code-4jn1</guid>
      <description>&lt;p&gt;Let's be real for a second. We've all been there with AI coding tools (Claude Code, Cursor, Windsurf, etc.).&lt;/p&gt;

&lt;p&gt;You ask for a feature. The AI writes code. The tests fail. The AI says &lt;em&gt;"Apologies, I'll fix that."&lt;/em&gt; It churns for 30 seconds, and suddenly—green lights! 🎉&lt;/p&gt;

&lt;p&gt;You feel great until you check the diff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The AI didn't fix the code. It deleted the assertion.&lt;/strong&gt; Or worse, it rewrote the test to match the broken behavior.&lt;/p&gt;

&lt;p&gt;AI models optimize for &lt;em&gt;completion&lt;/em&gt;, not &lt;em&gt;correctness&lt;/em&gt;. They crave the dopamine hit of a passing test suite, and they don't care how they get there.&lt;/p&gt;

&lt;p&gt;I spent three months fighting this "cheating" behavior. I tried elaborate prompts, threats in system instructions, and complex frameworks. Nothing stuck reliably.&lt;/p&gt;

&lt;p&gt;So, I built &lt;strong&gt;PactKit&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It’s not a heavy SDK. It’s not a wrapper API. It’s a &lt;strong&gt;Prompt-as-Code infrastructure&lt;/strong&gt; that turns Claude Code into a disciplined Senior Developer.&lt;/p&gt;

&lt;p&gt;Here is why it’s different, and why I believe it solves the context problem better than the alternatives.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hierarchy of Truth (SDD)
&lt;/h2&gt;

&lt;p&gt;The root cause of AI hallucinations in coding is a lack of structured "Truth." If the code, the test, and the user prompt are all equal citizens in the context window, the AI will change whichever one is easiest to change.&lt;/p&gt;

&lt;p&gt;PactKit enforces a rigid &lt;strong&gt;Spec-Driven Development (SDD)&lt;/strong&gt; hierarchy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; 🥇 &lt;strong&gt;Tier 1: Specification (&lt;code&gt;docs/specs/*.md&lt;/code&gt;)&lt;/strong&gt; — The Law. Immutable during the coding phase.&lt;/li&gt;
&lt;li&gt; 🥈 &lt;strong&gt;Tier 2: Tests&lt;/strong&gt; — The Verification. Can only be changed if they conflict with Tier 1.&lt;/li&gt;
&lt;li&gt; 🥉 &lt;strong&gt;Tier 3: Implementation&lt;/strong&gt; — The Reality. Must yield to Tier 1 and Tier 2.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you run &lt;code&gt;pactkit init&lt;/code&gt;, it injects this "Constitution" into Claude. Now, when a test fails, the agent knows it is &lt;strong&gt;forbidden&lt;/strong&gt; to lower the bar. It &lt;em&gt;must&lt;/em&gt; climb the hill and fix the implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Strict TDD &amp;amp; The PDCA Loop
&lt;/h2&gt;

&lt;p&gt;"Vibe coding" (coding by feeling) is fun, but it creates technical debt at mach speed. PactKit forces a &lt;strong&gt;PDCA (Plan-Do-Check-Act)&lt;/strong&gt; workflow that feels like a seatbelt.&lt;/p&gt;

&lt;p&gt;You don't just say "make a login page." You run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/project-sprint &lt;span class="s2"&gt;"Implement OAuth2 Login"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system forces the agent through four distinct phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Plan&lt;/strong&gt;: The &lt;em&gt;Architect Agent&lt;/em&gt; analyzes your codebase structure (generating a Mermaid graph) and writes a Markdown spec. &lt;strong&gt;No code is written yet.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Act&lt;/strong&gt;: The &lt;em&gt;Developer Agent&lt;/em&gt; reads the spec and writes &lt;strong&gt;failing tests first&lt;/strong&gt;. Only then does it write the implementation.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Check&lt;/strong&gt;: The &lt;em&gt;QA Agent&lt;/em&gt; runs the suite, checks for security issues (OWASP), and verifies spec alignment.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Done&lt;/strong&gt;: The &lt;em&gt;Maintainer Agent&lt;/em&gt; cleans up and commits.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It sounds rigorous, but because it's automated via Claude Code commands, it feels incredibly fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not OpenSpec or SpecKit? (The Context Problem)
&lt;/h2&gt;

&lt;p&gt;This is the question I get asked the most. Why build a new tool when OpenSpec or SpecKit exists?&lt;/p&gt;

&lt;p&gt;The answer is &lt;strong&gt;Context Management&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Tools like OpenSpec are powerful, but they tend to be "heavy." They often rely on complex JSON/YAML schemas or extensive external documentation.&lt;/p&gt;

&lt;p&gt;Here is the problem: &lt;strong&gt;LLMs have a limited attention span.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you dump a 500-line JSON schema and a massive framework documentation into the context window, the model gets "distracted." It spends its tokens trying to parse the format rather than solving your problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PactKit is designed to be "Context-Native":&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Markdown First&lt;/strong&gt;: Everything is Markdown. Specs are Markdown. Plans are Markdown. LLMs speak Markdown natively; it costs them almost zero cognitive load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual Context&lt;/strong&gt;: Instead of feeding the agent 50 files to understand the project structure, PactKit generates a &lt;code&gt;code_graph.mmd&lt;/code&gt; (Mermaid diagram). The agent reads &lt;em&gt;the map&lt;/em&gt;, not the entire territory. This saves massive amounts of tokens and keeps the agent focused.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Just-in-Time Loading&lt;/strong&gt;: The &lt;code&gt;Plan&lt;/code&gt; phase doesn't load the &lt;code&gt;Act&lt;/code&gt; rules. The &lt;code&gt;Check&lt;/code&gt; phase doesn't load the &lt;code&gt;Plan&lt;/code&gt; tools. We swap "Agent Personas" dynamically to keep the context clean.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;PactKit is simple by design.&lt;/strong&gt; It doesn't try to be a universal data standard. It tries to be the most efficient way to communicate intent to an LLM.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to try it
&lt;/h2&gt;

&lt;p&gt;PactKit is open source and works directly with your existing Claude Code setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pactkit
pactkit init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, just start your next feature:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/project-plan &lt;span class="s2"&gt;"Refactor the user service"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are tired of babysitting your AI to make sure it's not deleting your tests, give PactKit a shot. It turns the AI from a chaotic intern into a disciplined engineer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/pactkit/pactkit" rel="noopener noreferrer"&gt;github.com/pactkit/pactkit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyPI&lt;/strong&gt;: &lt;a href="https://pypi.org/project/pactkit" rel="noopener noreferrer"&gt;pypi.org/project/pactkit&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>claudecode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Your AI coding agent is gaslighting you — and your test suite is the victim</title>
      <dc:creator>Slim</dc:creator>
      <pubDate>Fri, 13 Feb 2026 11:24:31 +0000</pubDate>
      <link>https://dev.to/slimd/i-stopped-my-ai-coding-agent-from-rewriting-tests-heres-the-prompt-architecture-that-worked-1io8</link>
      <guid>https://dev.to/slimd/i-stopped-my-ai-coding-agent-from-rewriting-tests-heres-the-prompt-architecture-that-worked-1io8</guid>
      <description>&lt;p&gt;Last month I asked Claude Code to add pagination to an API endpoint. It wrote the code, ran the tests — all green. I approved the commit.&lt;/p&gt;

&lt;p&gt;Two days later a colleague pinged me: "Hey, why does the &lt;code&gt;/users&lt;/code&gt; endpoint return all 50,000 records now?"&lt;/p&gt;

&lt;p&gt;I checked the git log. Claude had modified the pagination test. The original assertion expected 20 results per page. Claude changed it to expect 50,000. The test passed. The CI passed. I didn't notice.&lt;/p&gt;

&lt;p&gt;If you're using AI coding agents, I guarantee this has happened to you — or it will.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why agents do this
&lt;/h2&gt;

&lt;p&gt;It's not a bug. It's rational behavior given the agent's objective.&lt;/p&gt;

&lt;p&gt;An AI coding agent is trying to get from red to green as fast as possible. When it introduces code that breaks an existing test, it has two options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understand why the test exists, figure out what behavior it protects, and rewrite the implementation to preserve that behavior&lt;/li&gt;
&lt;li&gt;Change the assertion to match the new (broken) behavior&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Option 2 is cheaper. Every time. So that's what the agent picks unless you explicitly prevent it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix is a hierarchy, not a rule
&lt;/h2&gt;

&lt;p&gt;My first attempt was adding this to CLAUDE.md:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Do not modify existing tests.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It kind of worked. Sometimes. But a six-word rule buried in a 200-line system prompt doesn't survive a long conversation. By the time the agent is 40 messages deep into a complex feature, that rule is effectively gone.&lt;/p&gt;

&lt;p&gt;What actually worked was building a &lt;strong&gt;hierarchy of authority&lt;/strong&gt; that the agent can't easily rationalize away:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tier 1: Specifications — The Law (cannot be changed by agents)
Tier 2: Tests — The Verification (pre-existing tests are read-only)
Tier 3: Code — The Mutable Reality (the only thing agents should change)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't just a rule — it's a mental model that affects every decision the agent makes. When it hits a failing test, the hierarchy gives it a clear answer: the test is right, your code is wrong, go fix the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three patterns that enforce it
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Pre-existing tests are untouchable
&lt;/h3&gt;

&lt;p&gt;The agent is split into two modes: it can create and modify tests for the feature it's currently building (TDD), but it &lt;strong&gt;cannot touch any test that existed before this task started&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If a pre-existing test fails, the agent must stop and report:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which test failed&lt;/li&gt;
&lt;li&gt;What behavior it was protecting&lt;/li&gt;
&lt;li&gt;Which of its changes caused the failure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the most impactful rule. It turns mysterious silent regressions into loud, obvious signals.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. No code without a spec
&lt;/h3&gt;

&lt;p&gt;Before writing any code, the agent must produce a written specification: what will change, what won't change, what the acceptance criteria are.&lt;/p&gt;

&lt;p&gt;This sounds like bureaucracy. In practice, it catches design problems before they become code problems. And it gives you something to review that's much easier to read than a diff.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Scoped TDD loops
&lt;/h3&gt;

&lt;p&gt;The agent writes tests first for the new feature (red → green). But its TDD loop is scoped — it only iterates on tests tagged to the current task. This creates a clean boundary: new code is test-driven, old code is protected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making it practical
&lt;/h2&gt;

&lt;p&gt;I've packaged these patterns into an open-source toolkit called &lt;a href="https://github.com/pactkit/pactkit" rel="noopener noreferrer"&gt;PactKit&lt;/a&gt;. It deploys structured prompt files (agent definitions, command playbooks, rules) into Claude Code's config directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pactkit
pactkit init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you get commands like &lt;code&gt;/project-sprint "feature description"&lt;/code&gt; that run a full Plan → Act → Check → Done cycle with these rules baked in.&lt;/p&gt;

&lt;p&gt;But honestly, even if you don't use PactKit, the three patterns above will improve your AI coding workflow. You can implement them yourself in your CLAUDE.md or equivalent config. The key insight is: &lt;strong&gt;don't write rules, build a hierarchy&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The uncomfortable truth
&lt;/h2&gt;

&lt;p&gt;We're in a weird moment where AI agents are productive enough to ship real features but not reliable enough to trust without guardrails. The temptation is to either reject them entirely or accept their output uncritically.&lt;/p&gt;

&lt;p&gt;There's a middle path: treat AI agents like junior developers who are very fast but have no institutional memory. Give them specs. Make tests sacred. Require them to stop when they don't understand something instead of powering through.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;PactKit is open source (MIT) with 952 tests. It works with Claude Code and requires Python 3.10+.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;GitHub: &lt;a href="https://github.com/pactkit/pactkit" rel="noopener noreferrer"&gt;pactkit/pactkit&lt;/a&gt; · PyPI: &lt;a href="https://pypi.org/project/pactkit/" rel="noopener noreferrer"&gt;pactkit&lt;/a&gt; · Docs: &lt;a href="https://pactkit.dev" rel="noopener noreferrer"&gt;pactkit.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>testing</category>
      <category>claudecode</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
