<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://blog.harikrishnan.io/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.harikrishnan.io/" rel="alternate" type="text/html" /><updated>2026-11-14T05:13:52+00:00</updated><id>https://blog.harikrishnan.io/blog/feed.xml</id><title type="html">Hari Krishnan’s Blog</title><subtitle>Thoughts on AI, Platform Engineering, Architecture, APIs, Developer Experience and Transformation</subtitle><author><name>Hari Krishnan</name><email>hello@harikrishnan.io</email></author><entry><title type="html">How TDD and BDD Actually Fit Into Spec-Driven Development</title><link href="https://blog.harikrishnan.io/2026-08-23/tdd-bdd-spec-driven-development" rel="alternate" type="text/html" title="How TDD and BDD Actually Fit Into Spec-Driven Development" /><published>2026-08-23T00:00:00+00:00</published><updated>2026-08-23T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-08-23/tdd-bdd-spec-driven-development</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-08-23/tdd-bdd-spec-driven-development"><![CDATA[<p><img src="/assets/images/posts/intent-driven/tdd-bdd-spec-driven-development-cover.jpg" alt="How TDD and BDD Actually Fit Into Spec-Driven Development" /></p>

<p>Prompting an AI agent to “use strict TDD” is not, by itself, a guarantee of trustworthy code. An agent can make a suite pass, or even drive line coverage high, while still leaving important decisions unprotected. It can implement several behaviors at once, add code where no failing tests exist or use vague assertions. In this post let us look at a how agents reward hack TDD and how we can progressively correct one testing failure at a time. The topics covered here are agnostic to any programming language, AI model, or coding agent.</p>

<h2 id="the-shipping-cost-calculator">The “Shipping Cost Calculator”</h2>

<p>The calculator accepts <code class="language-plaintext highlighter-rouge">standard</code> and <code class="language-plaintext highlighter-rouge">express</code> shipping. Standard shipping costs $10 below 5kg and $20 at or above 5kg. An order strictly above $100 is free through 10kg, but not when it is strictly heavier than 10kg. Express adds $15. Results stay in USD without an exchange lookup; another currency multiplies the final fee by <code class="language-plaintext highlighter-rouge">getRate("USD", targetCurrency)</code>.</p>

<p>Those rules have enough boundaries, validation, and one collaborator to reveal the difference between code that happens to pass and tests that actually specify behavior.</p>

<h2 id="how-coding-agents-cheat">How Coding Agents Cheat</h2>

<h3 id="broad-batching-creates-horizontal-slices">Broad batching creates horizontal slices</h3>

<p>The first variation starts with a single test that crosses several independent behaviors. It verifies useful outcomes, but it permits one large implementation step to make all of them green together. That is horizontal slicing: a broad layer of behavior is specified across the system before any one narrow capability is finished.</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">it</span><span class="p">(</span><span class="dl">"</span><span class="s2">calculates standard, free, express, and converted shipping</span><span class="dl">"</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">exchangeRateClient</span> <span class="o">=</span> <span class="p">{</span> <span class="na">getRate</span><span class="p">:</span> <span class="nx">vi</span><span class="p">.</span><span class="nf">fn</span><span class="p">().</span><span class="nf">mockReturnValue</span><span class="p">(</span><span class="mf">1.5</span><span class="p">)</span> <span class="p">};</span>
  <span class="kd">const</span> <span class="nx">calculator</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ShippingCostCalculator</span><span class="p">({</span> <span class="nx">exchangeRateClient</span> <span class="p">});</span>

  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">4</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">5</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">101</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">10</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">101</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mf">10.1</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
    <span class="na">shippingMethod</span><span class="p">:</span> <span class="dl">"</span><span class="s2">express</span><span class="dl">"</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">25</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">4</span> <span class="p">},</span> <span class="dl">"</span><span class="s2">EUR</span><span class="dl">"</span><span class="p">))</span>
    <span class="p">.</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">15</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<p>The test gives a reassuring green result, yet it does not force the small red-green-refactor loop that exposes design decisions one at a time.</p>

<p>Simply asking the agent to follow vertical slicing may not be enough. We can require it to give us the proof through Git commits where each commit represents a vertical slice.</p>

<h3 id="not-following-the-process-of-writing-code-only-to-get-a-test-passing-strictly">Not following the process of writing code only to get a test passing strictly</h3>

<p>In the second variation, the agent divides the examples into smaller tests. That is an improvement in readability, but the implementation still introduces branches beyond what the selected examples prove. Smaller test functions are not equivalent to strict TDD: the crucial constraint is that production behavior is added in response to a failing test, not merely that the finished suite contains many test names.</p>

<p>The way to catch this is through test coverage, and in particular branch coverage.</p>

<h3 id="red-green-order-is-not-enough-when-assertions-are-weak">Red-green order is not enough when assertions are weak</h3>

<p>In the third variation, agent follows a red-green sequence, but some assertions only say that an error occurred or that a numeric result is broadly acceptable. Those checks exercise code without pinning down the exact behaviour. A wrong exception type or message, the wrong collaborator arguments, and some arithmetic changes can remain undetected even though the tests are green.</p>

<p>Branch coverage only tell us if a condition was exercised, it does not answer, “Would this test fail if the important decision changed?” Mutation testing makes that second question concrete by deliberately changing operators, conditions, values, and calls. A surviving mutant is evidence that the suite did not distinguish the changed behavior.</p>

<h3 id="duplication-in-test-code">Duplication in test code</h3>

<p>In this variation, agent checks exact output, exact errors, and collaborator interactions—not just whether a call or throw happened. For example:</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">it</span><span class="p">(</span><span class="dl">"</span><span class="s2">converts a non-USD fee using the requested exchange rate</span><span class="dl">"</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">4</span> <span class="p">},</span> <span class="dl">"</span><span class="s2">EUR</span><span class="dl">"</span><span class="p">))</span>
    <span class="p">.</span><span class="nf">toBe</span><span class="p">(</span><span class="mi">15</span><span class="p">);</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">exchangeRateClient</span><span class="p">.</span><span class="nx">getRate</span><span class="p">).</span><span class="nf">toHaveBeenCalledExactlyOnceWith</span><span class="p">(</span>
    <span class="dl">"</span><span class="s2">USD</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">EUR</span><span class="dl">"</span><span class="p">,</span>
  <span class="p">);</span>
<span class="p">});</span>

<span class="nf">it</span><span class="p">(</span><span class="dl">"</span><span class="s2">rejects an unknown shipping method</span><span class="dl">"</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nf">expect</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span>
    <span class="na">orderTotalUsd</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="na">weightKg</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="na">shippingMethod</span><span class="p">:</span> <span class="dl">"</span><span class="s2">x</span><span class="dl">"</span><span class="p">,</span>
  <span class="p">})).</span><span class="nf">toThrow</span><span class="p">(</span><span class="k">new</span> <span class="nc">RangeError</span><span class="p">(</span><span class="dl">"</span><span class="s2">method invalid</span><span class="dl">"</span><span class="p">));</span>
<span class="p">});</span>
</code></pre></div></div>

<p>This is the kind of specification mutation-resistant tests provide: changing <code class="language-plaintext highlighter-rouge">USD</code> to another source currency, calling the collaborator twice, or replacing the documented validation error is observable.</p>

<p>However when test code is not refactored regularly, the test code contains repeated setup and test structure. We can identify this using tools such as <code class="language-plaintext highlighter-rouge">jspcd</code> for JavaScript.</p>

<h2 id="retaining-precision-while-removing-repeated-structure">Retaining precision while removing repeated structure</h2>

<p>Here we reataint the mutation-clean behavior while centralizing the common fixture and using a table for the standard-fee boundaries. This is not abstraction for its own sake: the parameterized cases keep the boundary values visible while avoiding the same construction code in every test.</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">beforeEach</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nx">exchangeRateClient</span> <span class="o">=</span> <span class="p">{</span> <span class="na">getRate</span><span class="p">:</span> <span class="nx">vi</span><span class="p">.</span><span class="nf">fn</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="mf">1.5</span><span class="p">)</span> <span class="p">};</span>
  <span class="nx">calculator</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ShippingCostCalculator</span><span class="p">({</span> <span class="nx">exchangeRateClient</span> <span class="p">});</span>
<span class="p">});</span>

<span class="nx">it</span><span class="p">.</span><span class="nf">each</span><span class="p">([</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">a $0, 0kg order</span><span class="dl">"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">an order below 5kg</span><span class="dl">"</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mf">4.9</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">an order at 5kg</span><span class="dl">"</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">],</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">a $100 order</span><span class="dl">"</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">10</span><span class="p">],</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">a $101 order at 10kg</span><span class="dl">"</span><span class="p">,</span> <span class="mi">101</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
  <span class="p">[</span><span class="dl">"</span><span class="s2">a $101 order at 10.1kg</span><span class="dl">"</span><span class="p">,</span> <span class="mi">101</span><span class="p">,</span> <span class="mf">10.1</span><span class="p">,</span> <span class="mi">20</span><span class="p">],</span>
<span class="p">])(</span><span class="dl">"</span><span class="s2">charges $expected for %s</span><span class="dl">"</span><span class="p">,</span> <span class="p">(</span><span class="nx">_description</span><span class="p">,</span> <span class="nx">orderTotalUsd</span><span class="p">,</span> <span class="nx">weightKg</span><span class="p">,</span> <span class="nx">expected</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nf">expect</span><span class="p">(</span><span class="nx">calculator</span><span class="p">.</span><span class="nf">calculate</span><span class="p">({</span> <span class="nx">orderTotalUsd</span><span class="p">,</span> <span class="nx">weightKg</span> <span class="p">})).</span><span class="nf">toBe</span><span class="p">(</span><span class="nx">expected</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<p>The point is not that every test should be table-driven. Keep a test explicit when its setup tells an important story. Share only the structure that distracts from the behavior being specified.</p>

<h2 id="a-reusable-strict-tdd-harness">A reusable strict-TDD harness</h2>

<p>When asking an agent to implement a change, make these constraints part of the definition of done:</p>

<ul>
  <li>Work one vertical slice at a time: introduce a single failing behavioral example, implement only enough to make it pass, then refactor before starting the next behavior.</li>
  <li>Cover each decision and its boundaries, not merely every line. Include the “equals” cases around thresholds and both sides of every meaningful branch.</li>
  <li>Run mutation testing and turn survivors into precise assertions about outputs, errors, and collaborator interactions.</li>
  <li>Keep test code maintainable: use shared setup and parameterization for genuinely repeated structure, while preserving readable behavior names and boundary data.</li>
</ul>

<p>These checks make the desired outcome harder to reward-hack. They also produce useful feedback: a failed test points to a behavior, a surviving mutant points to an unprotected decision, and a duplication report points to a suite that may become brittle.</p>

<h2 id="bdd-macro-mockist-tdd-micro">BDD macro, Mockist TDD micro</h2>

<p>BDD and strict Mockist TDD solve different layers of the same problem. BDD supplies the macro constraints: the acceptance scenarios that define what a user or business process must be able to do. Strict Mockist TDD supplies the micro: small object-level contracts, outputs, errors, and collaboration boundaries that keep the implementation decoupled as it grows.</p>

<p><img src="/assets/images/posts/intent-driven/tdd-bdd-spec-driven-development-sdd-bdd-tdd.jpg" alt="Diagram showing SDD leading to spec-first implementation, SDD plus BDD leading to spec-as-source implementation with tangled internal units, and SDD plus BDD plus TDD leading to a decoupled implementation with clear unit boundaries." title="How Spec-Driven Development, Behavior-Driven Development, and Test-Driven Development work together" /></p>

<p><em>SDD anchors the work in a specification, BDD protects the macro behavior, and TDD improves the micro-level design.</em></p>

<p>SDD makes the specification the source of truth: it describes the intended outcome and the constraints the implementation must satisfy. BDD turns that intent into user-facing acceptance scenarios, creating the macro feedback loop that tells us whether the system behaves correctly from the outside.</p>

<p>An SDD and BDD workflow can satisfy every acceptance scenario while the internal implementation becomes a spaghetti of tightly coupled units, because macro scenarios do not by themselves force clear object boundaries. TDD provides the micro feedback loop: small failing tests drive narrow contracts and collaboration boundaries, and regular refactoring keeps those units decoupled.</p>

<p>Together, SDD defines what must be true, BDD verifies the observable behavior, and strict TDD improves how the implementation is structured. For the BDD/OpenSpec side of that workflow, see the related article in the references below.</p>

<h2 id="video-walkthrough">Video Walkthrough</h2>

<div class="video-container" style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 2em 0;">
  <iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/M5kZzC8_xCE" title="How TDD and BDD Actually Fit Into Spec-Driven Development" loading="lazy" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
</div>

<h2 id="references">References</h2>

<ul>
  <li><a href="https://github.com/intent-driven-dev/skills/blob/main/.agents/skills/test-driven-development/SKILL.md">Intent-Driven Dev’s TDD Skill</a></li>
  <li><a href="https://github.com/mattpocock/skills/blob/main/skills/engineering/tdd/SKILL.md">Matt Pocock’s TDD skill</a></li>
  <li><a href="https://stryker-mutator.io/docs/">Mutation Testing with Stryker</a></li>
  <li><a href="https://www.npmjs.com/package/jscpd">JSCPD for code duplication</a></li>
  <li><a href="https://intent-driven.dev/blog/2026/07/17/behavior-driven-development-sdd-openspec/">Behavior-Driven Development with Spec-Driven Development using OpenSpec</a></li>
  <li><a href="https://code.claude.com/docs/en/workflows">Claude Code Dynamic Workflows</a></li>
  <li><a href="https://github.com/intent-driven-dev/intent-driven-template">Intent-Driven Template</a></li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/08/23/tdd-bdd-spec-driven-development/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on August 23, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="tdd" /><category term="bdd" /><category term="ai agents" /><category term="intent harness" /><category term="mockist tdd" /><category term="mutation testing" /><category term="spec as source" /><summary type="html"><![CDATA[The role of TDD in SDD along with BDD, how agents reward hack Test-Driven development and how to prevent it]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Behavior-Driven Development and Spec-Driven Development with OpenSpec</title><link href="https://blog.harikrishnan.io/2026-07-17/behavior-driven-development-sdd-openspec" rel="alternate" type="text/html" title="Behavior-Driven Development and Spec-Driven Development with OpenSpec" /><published>2026-07-17T00:00:00+00:00</published><updated>2026-07-17T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-07-17/behavior-driven-development-sdd-openspec</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-07-17/behavior-driven-development-sdd-openspec"><![CDATA[<p><img src="/assets/images/posts/intent-driven/behavior-driven-development-sdd-openspec-cover.jpg" alt="Behavior-Driven Development and Spec-Driven Development with OpenSpec" /></p>

<p>The advantage of using BDD techniques such as capturing our intent in Gherkin syntax is that we can generate Cucumber tests that then guide the coding agent to build the application.</p>

<p>There are two main goals in this walkthrough:</p>

<ol>
  <li>Using a spec which is only in text or markdown to get the coding agent to build an application that is completely aligned with our intent — and call it done only when it has actually completed.</li>
  <li>Achieving spec as source, as described in <a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Birgitta’s article on martinfowler.com about spec-driven development tools</a>.</li>
</ol>

<p>The overall guideline of the harness is to “make it easy to ‘do the right thing’ and work at the spec level, rather than the code level,” as mentioned in my <a href="https://www.infoq.com/articles/enterprise-spec-driven-development/">InfoQ article on enterprise spec-driven development</a>.</p>

<h2 id="the-template">The Template</h2>

<p>Code for this walkthrough is the <a href="https://github.com/intent-driven-dev/behavior-driven-template"><code class="language-plaintext highlighter-rouge">behavior-driven-template</code></a>. This is a subset of the <a href="https://github.com/intent-driven-dev/intent-driven-template"><code class="language-plaintext highlighter-rouge">intent-driven-template</code></a>, scoped down to help us demo BDD only and focus on it.</p>

<h2 id="the-sample-application-pollcast">The Sample Application: PollCast</h2>

<p>We start with an empty repository initialized with OpenSpec and switched to a custom <strong>behavior-driven schema</strong>. PollCast is an application that allows users to cast their vote against polls created by other users. The product intent and the technology stack both go into the <code class="language-plaintext highlighter-rouge">context</code> section of OpenSpec’s <code class="language-plaintext highlighter-rouge">config.yaml</code>:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">schema</span><span class="pi">:</span> <span class="s">behavior-driven</span>

<span class="na">context</span><span class="pi">:</span> <span class="pi">|</span>
  <span class="s">PollCast is an intuitive web application allowing users to instantly create,</span>
  <span class="s">share, and track custom polls. To prevent spam without the friction of</span>
  <span class="s">passwords, the platform features a streamlined UI where participants simply</span>
  <span class="s">cast votes using their email address as a unique identifier, guaranteeing</span>
  <span class="s">highly accurate and duplicate-free poll results.</span>

  <span class="s">Tech stack: Node.js, server-side rendered Express, JSON file store to begin with.</span>
</code></pre></div></div>

<p>With that context in place, the first slice is what we type into the coding agent — allow users to vote for a poll that already exists:</p>

<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/opsx:propose Allow users to vote for a poll that already exists.

Rules:
- A vote cannot be modified once it is cast.
- A duplicate vote cannot be cast for the same email ID —
  email ID is the unique identifier.
</code></pre></div></div>

<h2 id="a-behavior-driven-openspec-schema">A Behavior-Driven OpenSpec Schema</h2>

<p>The behavior-driven schema is close to the standard OpenSpec schema — it generates a proposal, spec, design, and tasks — with two deliberate differences:</p>

<ol>
  <li><strong>The spec template contains fenced regions of Gherkin.</strong> Instead of a plain markdown template, the spec has fenced sections where Given/When/Then scenarios are articulated in Gherkin syntax. OpenSpec already supports this syntax in prose, but fencing the Gherkin means we can lint it, ensure it is syntax-valid, and generate acceptance tests from it.</li>
  <li><strong>The tasks put acceptance tests first.</strong> The generated task list ensures the acceptance test suite is created before the application itself is built.</li>
</ol>

<p>When the change proposal for poll voting is created, the spec includes a fenced Gherkin feature — including the rule that there are no duplicate votes on the same email ID — and the agent reports that the Gherkin has been extracted and linted as clean syntax. Two things make this work:</p>

<ul>
  <li>Rules in <code class="language-plaintext highlighter-rouge">config.yaml</code> state that the spec artifact cannot be marked as generated until linting is fully done, and enforce a one-to-one mapping between the specification inside OpenSpec and the extracted Gherkin file.</li>
  <li>To learn how to run the <code class="language-plaintext highlighter-rouge">gherkin-lint</code> npm module, the agent is directed to fetch its documentation through the context7 CLI.</li>
</ul>

<h2 id="from-plain-text-to-deterministic-tests">From Plain Text to Deterministic Tests</h2>

<p>This brings us to the first question: how do we take a text file and ensure it guides the coding agent to build an application aligned with the intent articulated in the spec?</p>

<p>First, commit the spec and start a fresh session — I always like to commit the spec and begin the apply step in a new clean session so the coding agent has fresh context to work with. Running <code class="language-plaintext highlighter-rouge">opsx apply</code> then works through the tasks, and because of how the tasks are structured, the first thing that appears is an acceptance test folder containing Cucumber.js step definitions.</p>

<p>A quick primer if you are unfamiliar with BDD: <strong>Gherkin</strong> is just the syntax — the Given/When/Then scenario and feature structure. It is a ubiquitous language for business and product teams to collaborate on; it puts a specification in a standard format, and because Given/When/Then is nice to create tests from, it is very helpful for us. <strong>Cucumber</strong> is the tool that generates test cases from that Gherkin by defining a step for each line. We are using Cucumber.js since this is a JavaScript application; in Python you would use Behave, in Java JBehave or similar — each language has its own frameworks for step definitions.</p>

<p>Put the spec and step definitions side by side and the mapping is direct: a line like “a poll exists with options cats and dogs” in the spec has its programmatic equivalent as a function in the step definitions. Running these as tests produces a report showing every scenario in the spec passing — and the application has been built to satisfy them.</p>

<p><strong>Why not just use something like the Playwright CLI?</strong> I use the Playwright CLI quite a bit, but it introduces an amount of non-determinism. Step definitions, on the other hand, are repeatable — the coding agent only changes a few things for each new feature, and it doesn’t burn a lot of tokens because you are just re-running code that is already built.</p>

<p>The alignment works in both directions. If I edit only the markdown spec — say Alice votes for <em>dogs</em> instead of <em>cats</em> — and re-run the acceptance tests, they fail: the vote was recorded for cats but the spec now expects dogs. The coding agent now has a deterministic signal to go and correct the code. The acceptance tests are always in line with the OpenSpec plain-text file.</p>

<p>The piece putting this together is the <code class="language-plaintext highlighter-rouge">cucumber.cjs</code> configuration, which was authored using an <strong>acceptance test authoring</strong> skill. That skill is currently built for Cucumber.js and JavaScript-based UI applications — it knows how to create a page object model, for example — and you can adapt it to the nature of your application and technology stack.</p>

<p>Here is a short summarizing this flow:</p>

<div style="max-width: 315px; margin: 2em auto;">
  <div style="position: relative; padding-bottom: 177.78%; height: 0; overflow: hidden;">
    <iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/jghIES9jWDg" title="Behavior-Driven Development and SDD with OpenSpec" loading="lazy" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
  </div>
</div>

<h2 id="two-rules-and-a-hook">Two Rules and a Hook</h2>

<p>How do we make the coding agent finish building the application and only then call it done?</p>

<ul>
  <li><strong>Rule 1</strong> — in the <code class="language-plaintext highlighter-rouge">claude.md</code> file itself: <em>acceptance tests must always pass</em>. Only after that can the agent call the work done. This is what turns the plain-text spec into a deterministic definition of done rather than letting the agent reward-hack its way to “complete.”</li>
  <li><strong>Rule 2</strong> — <em>specs and code are never modified together</em>. Without this rule, an agent that has modified code first can reward-hack rule 1: it modifies the spec to get the tests passing and reports “the spec is good, the tests pass, no problem” — but the fundamental principle is gone, because we did not use the spec as source.</li>
</ul>

<p>Rule 2 is not just a guideline sitting in <code class="language-plaintext highlighter-rouge">claude.md</code>. A hook called <strong>Zone Guard</strong> enforces it as a deterministic check: within a git commit or within a session — depending on the approach you take — it will never allow a single piece of change to include both the spec and the code.</p>

<h2 id="spec-as-source-harness-guidelines">Spec as Source Harness Guidelines</h2>

<p>The second question comes from <a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Birgitta’s article on martinfowler.com</a> and her framing of <em>spec-anchored</em> versus <em>spec as source</em> — which I compared OpenSpec against in an <a href="/blog/2025/12/26/choosing-spec-driven-development-tool/">earlier post</a>, concluding OpenSpec has the potential to be spec-anchored because of its source-of-truth specification. As an experiment, can we take it all the way to spec as source?</p>

<p>For spec as source, the spec is the only main source file that humans edit over time — humans never touch the code. As an extension, no vibe coding is allowed either: I cannot just ask the agent to modify the code and leave the spec behind. That is where the trouble usually starts — the spec builds the first version of the application, but the moment code is modified by hand, spec and code drift apart.</p>

<p>First, archive the completed change. The specification carries the delta format — added, removed, modified markers — so that when it is synced and archived it moves into the source-of-truth specification. The acceptance tests still pass; only their path changes, from inside the change folder to the source-of-truth specification.</p>

<p>Now, in a new session, let’s go against the grain of the harness — the new-engineer-on-the-team scenario:</p>

<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Help me change the src folder directly to allow users to modify votes
by submitting with the same email again. No need to create OpenSpec proposal.
</code></pre></div></div>

<p>This deliberately contradicts the first specification, which disallows duplicate votes. Because the rules are in place, the agent pushes back and says a spec has to be created. Forcing it through with “bypass and move forward” doesn’t work either: the agent cannot complete the feature, because the acceptance test asserting <em>a user must not be able to vote more than once with the same email ID</em> is now broken by the modified code. The agent itself reports that the requested feature directly contradicts the existing spec, and that the path forward is to modify the spec first. The resolution: revert the changes and start afresh with a proper OpenSpec change proposal for the capability.</p>

<p>This is exactly what I articulated in my <a href="https://www.infoq.com/articles/enterprise-spec-driven-development/">InfoQ article on enterprise spec-driven development</a>: doing the right thing — writing the spec first — must be easy, and going against the grain of the harness — writing code first and leaving the spec behind — should be hard. Both are taken care of here, and the only way forward is an OpenSpec change proposal.</p>

<p>The new proposal’s spec again has fenced Gherkin, this time carrying the <em>modified</em> marker for the changed feature. Running the acceptance tests at this point shows the original scenarios still passing and the new scenarios as undefined — the modification is not yet done. There is more nuance here, such as calculating the <em>effective test suite</em> so that contradicting tests (the original feature and its modification) are not run together — a topic for a separate video.</p>

<p>Here is a short summarizing spec as source:</p>

<div style="max-width: 315px; margin: 2em auto;">
  <div style="position: relative; padding-bottom: 177.78%; height: 0; overflow: hidden;">
    <iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/YaQ2rDPmamY" title="Spec As Source SDD With OpenSpec" loading="lazy" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
  </div>
</div>

<h2 id="bdd-does-not-replace-tdd">BDD Does Not Replace TDD</h2>

<p>Because we are doing behavior-driven development does not mean TDD is not required. BDD takes care of the <strong>outside-in</strong> — the spec is always from the point of view of the user, and it drives the application from the outside. Test-driven development helps you go <strong>inside-out</strong>. Both are necessary to put an application together well; TDD is simply not covered here to keep the focus of this walkthrough on BDD.</p>

<p>Does this mean we have completely achieved spec as source? Not necessarily — there are a few more things to complete — but the two questions we set out with are answered: a markdown spec, given a programmatic equivalent through Cucumber.js step definitions, drives the application through tests that tell the coding agent when it is actually done; and the harness rules — acceptance tests must always pass, specs and code are never modified together — keep both humans and agents from inadvertently modifying code first.</p>

<h2 id="video-walkthrough">Video Walkthrough</h2>

<div class="video-container" style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 2em 0;">
  <iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://www.youtube.com/embed/xoPjF-Z2Qgw" title="Behavior-Driven Development and Spec-Driven Development with OpenSpec" loading="lazy" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
</div>

<h2 id="references">References</h2>

<ul>
  <li>Behavior-Driven Template — <a href="https://github.com/intent-driven-dev/behavior-driven-template">intent-driven-dev/behavior-driven-template</a></li>
  <li>Intent-Driven Template — <a href="https://github.com/intent-driven-dev/intent-driven-template">intent-driven-dev/intent-driven-template</a></li>
  <li>Birgitta’s article on martinfowler.com — <a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Exploring Gen AI: Spec-Driven Development Tools</a></li>
  <li>InfoQ — <a href="https://www.infoq.com/articles/enterprise-spec-driven-development/">Enterprise Spec-Driven Development</a></li>
  <li>Earlier post on spec-anchored vs spec as source — <a href="/blog/2025/12/26/choosing-spec-driven-development-tool/">Which Spec-Driven Development Tool Should You Choose?</a></li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/07/17/behavior-driven-development-sdd-openspec/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on July 17, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="bdd" /><category term="gherkin" /><category term="cucumber" /><category term="behavior driven template" /><category term="sdd" /><summary type="html"><![CDATA[Capturing intent in Gherkin syntax to generate Cucumber tests that guide a coding agent — a walkthrough of Behavior-Driven Development combined with Spec-Driven Development using OpenSpec.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">SDD with Multi-Model Spec Review and Glossary</title><link href="https://blog.harikrishnan.io/2026-06-27/sdd-adversarial-authoring-glossary" rel="alternate" type="text/html" title="SDD with Multi-Model Spec Review and Glossary" /><published>2026-06-27T00:00:00+00:00</published><updated>2026-06-27T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-06-27/sdd-adversarial-authoring-glossary</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-06-27/sdd-adversarial-authoring-glossary"><![CDATA[<p><img src="/assets/images/posts/intent-driven/sdd-adversarial-authoring-glossary-cover.jpg" alt="SDD with Multi-Model Spec Review and Glossary" /></p>

<p>This post extends the <a href="https://intent-driven.dev/blog/2026/05/10/spec-driven-development-openspec-opencode/">OpenSpec + OpenCode walkthrough</a> with two new skills added to the <a href="https://github.com/intent-driven-dev/intent-driven-template"><code class="language-plaintext highlighter-rouge">intent-driven-template</code></a>: <strong>adversarial authoring</strong> and <strong>glossary</strong>. Both are aimed at getting your specifications into good shape before they reach human review.</p>

<h2 id="the-problem-these-solve">The Problem These Solve</h2>

<p>Specs written by a single model carry that model’s blind spots and we often have to intervene to hand these specifications to another model so that we avoid bias. A second issue with specifications authored by agents is the inconsistency in terminology across sessions. Each model may have its own way of expressing the spec. And also each human reviewing it may also have their own inputs. We need a way to both reduce the model bias as well as be consistent by building domain terminology to achieve better specifications.</p>

<p>These two skills address that directly.</p>

<h2 id="1-adversarial-authoring--cross-model-review-inside-the-workflow">1. Adversarial Authoring — Cross-Model Review Inside the Workflow</h2>

<p>The <a href="https://github.com/intent-driven-dev/intent-driven-template/tree/main/.agents/skills"><code class="language-plaintext highlighter-rouge">adversarial-authoring</code> skill</a> wires two sub-agents into the proposal phase: one <strong>authors</strong>, one <strong>reviews</strong>. A common setup is having one model write the proposal and another model review it — Claude writing and GPT reviewing, or vice versa.</p>

<p>For example, if we use this skill to author <code class="language-plaintext highlighter-rouge">proposal.md</code>, this also produces <strong>council notes</strong>: what the author subagent wrote, what the reviewer subagent challenged, and how each challenge was resolved — accepted, rejected, and why.</p>

<p>This matters because:</p>

<ul>
  <li>Different models surface different assumptions and biases</li>
  <li>Over-specification gets caught before it reaches you</li>
  <li>The decision trail is visible, not buried in a chat session</li>
</ul>

<p>Keep it to two or three sub-agents. More than that and the output becomes noise.</p>

<h2 id="2-glossary--shared-language-as-a-first-class-artifact">2. Glossary — Shared Language as a First-Class Artifact</h2>

<p>The <a href="https://github.com/intent-driven-dev/intent-driven-template/tree/main/.agents/skills"><code class="language-plaintext highlighter-rouge">glossary</code> skill</a> runs during the design phase and maintains a file of domain and technical terms with precise definitions scoped to your application.</p>

<p>Consider a common scenario: an agent designing an import layer for inconsistent legacy CSV data might coin a term like <em>translation boundary service</em> — verbose, invented, and unfamiliar to your team. The right term is <strong>anti-corruption layer</strong> (ACL), a Domain-Driven Design context mapping pattern introduced by Eric Evans: <a href="https://en.wikipedia.org/wiki/Anti-corruption_layer">“an isolating layer to provide your system with functionality of the upstream system in terms of your own domain model”</a> — a concept your engineers already know. This way we can reduce inconsistency where one person calls ACL a translation boundary and others may use some other term. And each of these may be slightly different. When we agree on the concept we are using that leads to clear specifications.</p>

<p>Why this helps over time:</p>

<ul>
  <li>Terms defined once are reused by the agent in every subsequent spec</li>
  <li>Engineers at different experience levels converge on the same language</li>
  <li>Agents are part of your team — shared terminology applies to them too</li>
</ul>

<p>A single precise term like <em>idempotent</em> or <em>anti-corruption layer</em> carries more information than a paragraph of approximation.</p>

<p>The same applies to terminology specific to your organisation or industry. In a run club, a <strong>sweeper</strong> (or tail runner) is the volunteer who runs at the back of the pack — matching the pace of the slowest participant, ensuring no one is left behind or lost, and relaying updates to the lead group or organisers. An agent designing a run club management feature might describe this role as a <em>“designated rear-of-pack participant welfare coordinator”</em> — verbose and imprecise. Your team calls it a sweeper. Define it once in the glossary — with its responsibilities scoped to your club’s rules — and the agent will use that term in every spec it writes after that.</p>

<h2 id="putting-it-together">Putting It Together</h2>

<p>These skills are complementary to the skills we had discussed in our previous post. Adversarial authoring reduces model bias. Glossary enforces terminological consistency. Combined with <code class="language-plaintext highlighter-rouge">grill-me</code> for interrogating the plan upfront — covered in the <a href="https://intent-driven.dev/blog/2026/05/10/spec-driven-development-openspec-opencode/">previous post</a> — the spec that arrives at your desk should require our review, and much less cleanup.</p>

<p>The <a href="https://github.com/intent-driven-dev/openspec-schemas/tree/main/openspec/schemas/intent-driven"><code class="language-plaintext highlighter-rouge">intent-driven</code> schema</a> sequences all of this automatically. You don’t have to remember to run the review; it’s built into the workflow.</p>

<h2 id="video-walkthrough">Video Walkthrough</h2>

<iframe width="560" height="315" src="https://www.youtube.com/embed/2V78VVJ1sa0" title="SDD with Multi-Model Spec Review and Glossary" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

<h2 id="references">References</h2>

<ul>
  <li>Intent-Driven Template — <a href="https://github.com/intent-driven-dev/intent-driven-template">intent-driven-dev/intent-driven-template</a></li>
  <li>Adversarial Authoring skill — <a href="https://github.com/intent-driven-dev/intent-driven-template/tree/main/.agents/skills"><code class="language-plaintext highlighter-rouge">.agents/skills/adversarial-authoring</code></a></li>
  <li>Glossary skill — <a href="https://github.com/intent-driven-dev/intent-driven-template/tree/main/.agents/skills"><code class="language-plaintext highlighter-rouge">.agents/skills/glossary</code></a></li>
  <li>OpenSpec — <a href="https://github.com/Fission-AI/OpenSpec">Fission-AI/OpenSpec</a></li>
  <li>Anti-Corruption Layer — <a href="https://en.wikipedia.org/wiki/Anti-corruption_layer">Wikipedia</a>; Eric Evans, <em>Domain-Driven Design: Tackling Complexity in the Heart of Software</em> (2003), Chapter 14: Maintaining Model Integrity</li>
  <li>Previous post — <a href="https://intent-driven.dev/blog/2026/05/10/spec-driven-development-openspec-opencode/">Spec-Driven Development with OpenSpec and OpenCode</a></li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/06/27/sdd-adversarial-authoring-glossary/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on June 27, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="adversarial authoring" /><category term="multi model review" /><category term="glossary" /><category term="intent driven template" /><category term="sdd" /><category term="domain driven design" /><category term="ddd" /><category term="anti corruption layer" /><summary type="html"><![CDATA[Spec-Driven Development with OpenSpec and OpenCode: Multi-model adversarial authoring of Specifications with one sub-agent authoring, another reviewing to reduce bias before human review. Also glossary skills where Domain-Driven Design terminology — including context mapping patterns like the anti-corruption layer (ACL) — is defined once and reused everywhere to improve consistency and quality of specifications.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Integrating Your Product Backlog with Spec-Driven Development: Linear + OpenSpec via Skills</title><link href="https://blog.harikrishnan.io/2026-05-29/linear-openspec-skill-based-sdd" rel="alternate" type="text/html" title="Integrating Your Product Backlog with Spec-Driven Development: Linear + OpenSpec via Skills" /><published>2026-05-29T00:00:00+00:00</published><updated>2026-05-29T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-05-29/linear-openspec-skill-based-sdd</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-05-29/linear-openspec-skill-based-sdd"><![CDATA[<p><img src="/assets/images/posts/intent-driven/linear-openspec-skill-based-sdd-cover.jpg" alt="Integrating Your Product Backlog with Spec-Driven Development: Linear + OpenSpec via Skills" /></p>

<p>Teams adopting Spec-Driven Development rarely start from a blank slate — the work already lives in a product backlog. This article shows how to connect that backlog to your SDD workflow, so you can pick up an issue from Linear and drive it through OpenSpec’s change lifecycle. Linear and OpenSpec are the tools demonstrated here, but the same pattern applies to backlogs like Jira or Asana and SDD frameworks like Spec Kit or Kiro.</p>

<p>In my <a href="https://intent-driven.dev/blog/2026/01/11/linear-mcp-openspec-sdd-workflow/">earlier article</a>, I walked through keeping a Linear backlog in sync with OpenSpec as an agent moved a change through <em>Propose</em>, <em>Apply</em>, and <em>Archive</em>. That workflow worked, but it relied on modifying OpenSpec itself. This revisit achieves the same integration with stock OpenSpec — the Linear sync now lives entirely in a skill, <a href="https://github.com/intent-driven-dev/openspec-schemas/tree/main/.codex/skills/openspec-linearized"><code class="language-plaintext highlighter-rouge">openspec-linearized</code></a>, so there is nothing to fork or patch.</p>

<h2 id="what-the-skill-does">What the Skill Does</h2>

<p>The skill overlays Linear issue management onto the OpenSpec change lifecycle while keeping a clear ownership boundary:</p>

<ul>
  <li><strong>Linear</strong> owns the business context — goals, acceptance criteria, and stakeholder-facing status.</li>
  <li><strong>The repository</strong> owns the technical design and implementation.</li>
</ul>

<h2 id="initial-configuration">Initial Configuration</h2>

<p>In order to let the coding agent know about which Linear project, team and label we want to associate this repository with, the skill asks us for the details and stores them in <code class="language-plaintext highlighter-rouge">openspec/linear.yaml</code>. Once this file is created when we subsequently ask the coding agent to pick up an issue from Linear, it exactly knows where to look.</p>

<h2 id="mapping-linear-issue-status-with-openspec-change-proposal-phases">Mapping Linear issue status with OpenSpec change proposal phases</h2>

<ul>
  <li><strong>Propose</strong> — Binds a Linear Backlog issue as the business brief, and moves it to <em>Todo</em>. <code class="language-plaintext highlighter-rouge">proposal.md</code> stays lean, with Linear metadata in its frontmatter.</li>
  <li><strong>Apply</strong> — Moves the story to <em>In Progress</em> while the tasks are implemented.</li>
  <li><strong>Archive</strong> — Completes the OpenSpec archive first, then mirrors the finalized specs into Linear Project Documents (titled <code class="language-plaintext highlighter-rouge">OpenSpec: &lt;capability&gt;</code>) and moves the issue to <em>Done</em>.</li>
</ul>

<h2 id="video-walkthrough">Video Walkthrough</h2>

<iframe width="560" height="315" src="https://www.youtube.com/embed/rueiUBXVR9Y" title="Integrating Your Product Backlog with Spec-Driven Development: Linear + OpenSpec via Skills" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

<h2 id="references">References</h2>

<ul>
  <li><code class="language-plaintext highlighter-rouge">openspec-linearized</code> skill — <a href="https://github.com/intent-driven-dev/openspec-schemas/tree/main/.codex/skills/openspec-linearized">intent-driven-dev/openspec-schemas</a></li>
  <li>Earlier walkthrough — <a href="https://intent-driven.dev/blog/2026/01/11/linear-mcp-openspec-sdd-workflow/">Linear MCP + OpenSpec: A Spec-Driven Development Workflow</a></li>
  <li>OpenSpec — <a href="https://github.com/Fission-AI/OpenSpec">Fission-AI/OpenSpec</a></li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/05/29/linear-openspec-skill-based-sdd/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on May 29, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="linear" /><category term="mcp" /><category term="skills" /><category term="spec driven development" /><category term="codex" /><summary type="html"><![CDATA[A skill-based workflow that connects your product backlog to spec-driven development — pick up issues from Linear and turn them into OpenSpec changes. The pattern works with any backlog tool (Jira, Asana) and any SDD framework (Spec Kit, Kiro).]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Spec-Driven Development with OpenSpec and OpenCode</title><link href="https://blog.harikrishnan.io/2026-05-10/spec-driven-development-openspec-opencode" rel="alternate" type="text/html" title="Spec-Driven Development with OpenSpec and OpenCode" /><published>2026-05-10T00:00:00+00:00</published><updated>2026-05-10T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-05-10/spec-driven-development-openspec-opencode</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-05-10/spec-driven-development-openspec-opencode"><![CDATA[<p><img src="/assets/images/posts/intent-driven/spec-driven-development-openspec-opencode-cover.jpg" alt="Spec-Driven Development with OpenSpec and OpenCode" /></p>

<h2 id="1-openspec-setup">1. OpenSpec Setup</h2>

<p>Start by initializing OpenSpec in the project:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>openspec init
</code></pre></div></div>

<p>Then pick the new, continue, verify and any other commands that you need in addition to what is included in core profile. Profiles were introduced in OpenSpec 1.2.</p>

<h2 id="2-openspec-git-discipline">2. OpenSpec Git Discipline</h2>

<p>The template ships an <code class="language-plaintext highlighter-rouge">openspec-git-discipline</code> skill that enforces a single rule: every OpenSpec state change must cross <code class="language-plaintext highlighter-rouge">main</code> before the next lifecycle phase depends on it.</p>

<p>That means the proposal must be on <code class="language-plaintext highlighter-rouge">main</code> before <code class="language-plaintext highlighter-rouge">apply</code> starts, and implementation must be merged back to <code class="language-plaintext highlighter-rouge">main</code> before <code class="language-plaintext highlighter-rouge">archive</code> runs. The skill defines explicit gates around <code class="language-plaintext highlighter-rouge">propose</code>, <code class="language-plaintext highlighter-rouge">continue</code>, <code class="language-plaintext highlighter-rouge">apply</code>, and <code class="language-plaintext highlighter-rouge">archive</code> so the agent stops and asks rather than silently violating the rule.</p>

<p>The reasoning behind these gates — especially when running parallel changes in worktrees — is covered in OpenSpec, Git WorkTrees and OpenCode.</p>

<h2 id="3-proposal--grill-me-before-you-create-proposalmd">3. Proposal — Grill Me Before You Create proposal.md</h2>

<p>During the proposal step, the template uses Matt Pocock’s <code class="language-plaintext highlighter-rouge">grill-me</code> skill to interrogate the plan one question at a time, walking down each branch of the design tree until there is a shared understanding between the user and the agent.</p>

<p>This pulls open questions out into the proposal <em>before</em> specs are written, rather than discovering them later.</p>

<h2 id="4-design--c4-diagrams">4. Design — C4 Diagrams</h2>

<p>In the design step, the template uses the <code class="language-plaintext highlighter-rouge">c4-diagrams</code> skill to clarify architecture before detailed design. The skill produces system context, container, component, dynamic, or deployment diagrams — only the levels that answer a real question — in plain ASCII or Mermaid.</p>

<p>The skill also gates on purpose, format, and rigor up front, requires assumptions and open questions to be called out alongside the diagram, and refuses to drift into detailed design until the diagram is approved. This is especially useful in the brownfield context — see Spec-Driven Development with Brownfield Projects for more on that.</p>

<h2 id="5-adr--recording-the-architectural-decisions">5. ADR — Recording the Architectural Decisions</h2>

<p>The design step almost always surfaces architectural decisions worth keeping. The template uses an <code class="language-plaintext highlighter-rouge">architectural-decision-records</code> skill to draft each ADR with explicit context, considered options, decision, and consequences — supporting MADR full, MADR minimal, Nygard, Y-Statement, and custom styles.</p>

<p>ADRs are kept <em>outside</em> the change so they persist after the change is archived. The reasoning behind that choice — and why specs alone are not enough — is covered in Architectural Decision Records with Spec-Driven Development.</p>

<h2 id="6-superpowers-for-worktree-based-parallelism">6. Superpowers for Worktree-Based Parallelism</h2>

<p>The template uses Obra’s Superpowers in two places:</p>

<ul>
  <li>During the <strong>explore</strong> phase, Superpowers’ brainstorming skill kicks in automatically.</li>
  <li>During <strong>bulk apply</strong>, the <code class="language-plaintext highlighter-rouge">openspec-bulk-apply-change</code> skill leverages Superpowers’ worktrees and subagents skills to run multiple OpenSpec changes in parallel — each in its own worktree and SubAgent — without them stepping on each other.</li>
</ul>

<p>The mechanics of doing this with OpenSpec — proposing on <code class="language-plaintext highlighter-rouge">main</code>, applying inside worktrees, and merging before archive — are covered in OpenSpec, Git WorkTrees and OpenCode.</p>

<h2 id="7-bringing-it-together--the-intent-driven-schema">7. Bringing It Together — The <code class="language-plaintext highlighter-rouge">intent-driven</code> Schema</h2>

<p>OpenSpec uses <strong>schemas</strong> to control which artifacts are generated during the proposal phase. The template activates the <code class="language-plaintext highlighter-rouge">intent-driven</code> schema from <code class="language-plaintext highlighter-rouge">intent-driven-dev/openspec-schemas</code>, which produces five artifacts in order:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>proposal -&gt; specs -&gt; design -&gt; adr -&gt; tasks
</code></pre></div></div>

<p>Schemas are what make all the previous steps fit together as a single workflow rather than a pile of separate tools — the schema is what tells OpenSpec to ask for an ADR after design, and tasks only after that. Custom schemas were introduced in the OpenSpec 1.0 release, where <code class="language-plaintext highlighter-rouge">config.yaml</code> first opened up workflow customization.</p>

<h2 id="video-walkthrough">Video Walkthrough</h2>

<h2 id="references">References</h2>

<ul>
  <li>Intent-Driven Template — intent-driven-dev/intent-driven-template</li>
  <li>Template skills — .agents/skills</li>
  <li>OpenSpec — Fission-AI/OpenSpec</li>
  <li>Matt Pocock’s <code class="language-plaintext highlighter-rouge">grill-me</code> skill — mattpocock/skills</li>
  <li>Obra’s Superpowers — obra/superpowers</li>
  <li><code class="language-plaintext highlighter-rouge">intent-driven</code> schema — intent-driven-dev/openspec-schemas</li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/05/10/spec-driven-development-openspec-opencode/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on May 10, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="opencode" /><category term="intent driven template" /><category term="grill me" /><category term="c4 diagrams" /><category term="adr" /><category term="custom schemas" /><summary type="html"><![CDATA[How the intent-driven-template integrates OpenSpec, OpenCode, and custom skills — grill-me, C4 diagrams, ADRs, parallel worktrees, and the intent-driven schema — into a complete spec-driven workflow.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Architectural Decision Records with Spec-Driven Development using OpenSpec</title><link href="https://blog.harikrishnan.io/2026-04-29/spec-driven-development-with-adr" rel="alternate" type="text/html" title="Architectural Decision Records with Spec-Driven Development using OpenSpec" /><published>2026-04-29T00:00:00+00:00</published><updated>2026-04-29T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-04-29/spec-driven-development-with-adr</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-04-29/spec-driven-development-with-adr"><![CDATA[<p><img src="/assets/images/posts/intent-driven/spec-driven-development-with-adr-cover.jpg" alt="Architectural Decision Records with Spec-Driven Development using OpenSpec" /></p>

<p>Architectural decisions deserve a durable log so that future change proposals can leverage prior reasoning during design — not rediscover it. <a href="https://github.com/Fission-AI/OpenSpec">OpenSpec</a> with the default <a href="https://github.com/Fission-AI/OpenSpec/tree/main/schemas/spec-driven"><code class="language-plaintext highlighter-rouge">spec-driven</code></a> schema captures that reasoning in <code class="language-plaintext highlighter-rouge">design.md</code> while a change is in flight, but once the change is archived, only <code class="language-plaintext highlighter-rouge">specs.md</code> is carried forward into <code class="language-plaintext highlighter-rouge">openspec/specs/</code>. The design rationale stays behind in the archive, out of reach of future proposals. The new <code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code> schema closes that gap by keeping <a href="https://adr.github.io/">Architectural Decision Records</a> outside the change, alongside specs, so every architectural decision persists and the current state of the architecture stays visible to future proposals.</p>

<h3 id="the-default-spec-driven-schema">The Default <code class="language-plaintext highlighter-rouge">spec-driven</code> Schema</h3>

<p>OpenSpec ships with a default schema called <code class="language-plaintext highlighter-rouge">spec-driven</code> that produces four artifacts per change: <code class="language-plaintext highlighter-rouge">proposal.md</code>, <code class="language-plaintext highlighter-rouge">specs.md</code>, <code class="language-plaintext highlighter-rouge">design.md</code>, and <code class="language-plaintext highlighter-rouge">tasks.md</code>. When a change is archived, <strong>only <code class="language-plaintext highlighter-rouge">specs.md</code> is preserved</strong> — it is synced into <code class="language-plaintext highlighter-rouge">openspec/specs/</code> and lives on. The proposal, design, and tasks are archived with the change under <code class="language-plaintext highlighter-rouge">openspec/changes/archive/...</code> and are not considered when the next change is proposed.</p>

<p><img src="/assets/images/posts/intent-driven/spec-driven-development-with-adr-spec-driven.jpg" alt="Default OpenSpec spec-driven schema producing proposal, specs, design, and tasks artifacts" /></p>

<p>For more on how schemas plug into this pipeline, see the earlier post on <a href="https://intent-driven.dev/blog/2026/02/12/openspec-custom-schemas/">OpenSpec Custom Schemas</a>.</p>

<h3 id="why-this-matters-for-architectural-decisions">Why This Matters for Architectural Decisions</h3>

<p>The rationale behind an architectural choice usually lives in <code class="language-plaintext highlighter-rouge">design.md</code>. Because <code class="language-plaintext highlighter-rouge">design.md</code> is archived with the change, that rationale becomes invisible to future proposals. New changes then get designed without this context, causing repeated debates and potential architectural contradictions.</p>

<h3 id="how-spec-driven-with-adr-differs">How <code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code> Differs</h3>

<p>The <a href="https://github.com/intent-driven-dev/openspec-schemas/tree/main/openspec/schemas"><code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code></a> schema adds an <strong>ADR artifact that lives outside the change</strong>, outside the <code class="language-plaintext highlighter-rouge">openspec/</code> folder. Every change can write one or more ADRs (when there are significant architectural changes or decisions being made), and those records persist after the change is archived.</p>

<p>That gives the workflow two things the default schema does not:</p>

<ul>
  <li>A durable record of every architectural decision — context, options considered, choice, and consequences — captured at the moment the decision is made.</li>
  <li>A visible current-state view of the architecture that future change proposals can read and design against.</li>
</ul>

<p>The intent matches the rest of OpenSpec: keep the reasoning close to the code so future contributors — human or agent — can read the <em>why</em> without spelunking through pull requests, Slack, or memory.</p>

<h3 id="specs-and-adrs-together-represent-current-state">Specs and ADRs Together Represent Current State</h3>

<p>The earlier <a href="https://intent-driven.dev/blog/2025/11/09/spec-driven-development-openspec-source-truth/">Source of Truth post</a> framed <code class="language-plaintext highlighter-rouge">openspec/specs/</code> as the living spec representing the current state of the system. The <code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code> schema extends that same idea to architectural reasoning:</p>

<ul>
  <li><strong>Specs</strong> represent the current state of the application’s <strong>overall functionality</strong> — what the system does today.</li>
  <li><strong>ADRs</strong> represent the current state of the application’s <strong>architecture</strong> — <em>how</em> and <em>why</em> the system is built that way today.</li>
</ul>

<p>Both are durable, and both are read by future change proposals during design. Proposals, designs, and tasks are scaffolding that gets archived once a change ships; specs and ADRs are the load-bearing artifacts that future changes design against.</p>

<h3 id="a-small-example">A Small Example</h3>

<p>Suppose an early change picks Postgres over DynamoDB for the primary store. With the default schema, that decision is reasoned through in <code class="language-plaintext highlighter-rouge">design.md</code> — the alternatives considered, the cost and operational trade-offs, the consequences for query patterns — and then archived once the change ships. With <code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code>, the same reasoning is captured as an ADR that persists outside the change.</p>

<p>A few months later, someone proposes “add full-text search”. During design, the agent (or human) reading sees the storage ADR, knows the system is on Postgres, and naturally evaluates <code class="language-plaintext highlighter-rouge">pg_trgm</code> and <code class="language-plaintext highlighter-rouge">tsvector</code> before reaching for a separate search service to infer the same from code. Without the ADR, that proposal can easily start by re-debating the storage choice, or worse, silently introduce a second store that contradicts the original decision.</p>

<h3 id="video-walkthrough">Video Walkthrough</h3>

<iframe width="560" height="315" src="https://www.youtube.com/embed/y5oemaPsmOA" title="Architectural Decision Records with Spec-Driven Development using OpenSpec" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen=""></iframe>

<h3 id="references">References</h3>

<ul>
  <li>Architectural Decision Records — <a href="https://adr.github.io/">adr.github.io</a></li>
  <li><code class="language-plaintext highlighter-rouge">spec-driven-with-adr</code> schema — <a href="https://github.com/intent-driven-dev/openspec-schemas/tree/main/openspec/schemas/spec-driven-with-adr">openspec-schemas</a></li>
  <li>Previous post — <a href="https://intent-driven.dev/blog/2026/02/12/openspec-custom-schemas/">OpenSpec Custom Schemas</a></li>
</ul>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/04/29/spec-driven-development-with-adr/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on April 29, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="spec driven development" /><category term="adr" /><category term="architectural decision records" /><category term="custom schemas" /><summary type="html"><![CDATA[How the spec-driven-with-adr OpenSpec schema preserves architectural decision rationale outside individual changes, keeping ADRs durable alongside specs so future proposals can design against the current architecture.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">OpenSpec, Git WorkTrees and OpenCode</title><link href="https://blog.harikrishnan.io/2026-04-01/openspec-git-worktrees-opencode" rel="alternate" type="text/html" title="OpenSpec, Git WorkTrees and OpenCode" /><published>2026-04-01T00:00:00+00:00</published><updated>2026-04-01T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-04-01/openspec-git-worktrees-opencode</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-04-01/openspec-git-worktrees-opencode"><![CDATA[<p><img src="/assets/images/posts/intent-driven/openspec-git-worktrees-opencode-cover.jpg" alt="OpenSpec, Git WorkTrees and OpenCode" /></p>

<p>Git WorkTrees let you check out multiple branches simultaneously in separate directories — each with its own working state. Combined with SubAgents in OpenCode, this unlocks genuine parallel feature development inside a Spec-Driven Development workflow.</p>

<p>The key is knowing <em>where</em> each step of the OpenSpec workflow belongs: proposal on main, implementation in worktrees, archive after merge.</p>

<h2 id="propose-on-the-main-branch">Propose on the Main Branch</h2>

<p>Always run <code class="language-plaintext highlighter-rouge">/opsx:propose</code> (or <code class="language-plaintext highlighter-rouge">/opsx:explore</code> + continue) on the <strong>main branch</strong>, never inside a worktree branch.</p>

<p>OpenSpec’s proposal step analyses your active changes alongside the source-of-truth specifications to detect conflicts and gaps. If you propose from a worktree branch, OpenSpec only sees that branch’s delta — it loses visibility into other in-flight changes and the authoritative specs on main. Proposing on main keeps everything in view.</p>

<p>Once a proposal is created, you can immediately start on the next proposal for a different feature, still on main. Proposals are lightweight — they don’t touch implementation yet.</p>

<h2 id="apply-with-subagents-and-worktrees">Apply with SubAgents and WorkTrees</h2>

<p>With proposals ready on main, hand each one off to a SubAgent with its own WorkTree. Each SubAgent works in an isolated branch, applying its change independently. Because worktrees share the same git object store, you get true parallelism without duplicating the repository.</p>

<p>Before a worktree branch is eligible to merge, run <strong>Verify</strong> inside that same SubAgent session. Verify checks that the implementation matches the proposal’s spec, design, and task artifacts. Running it within the worktree ensures verification before merge so that we can address any issues flagged in the report within that worktree.</p>

<h2 id="merge-first-then-archive">Merge First, Then Archive</h2>

<p>Once a worktree branch passes Verify, merge it back to <strong>main</strong> before running Archive. Archive syncs the change’s delta specs into the source-of-truth specifications on main. If you archive while still on a worktree branch, the spec merge runs against an incomplete view of main — other merged features aren’t visible yet — and conflicts become likely.</p>

<p>The rule: <strong>merge → archive</strong>, in that order, every time. You can Archive each change individually after its merge, or merge all completed worktrees first and then run Bulk-Archive in one pass.</p>

<h2 id="commit-discipline">Commit Discipline</h2>

<p>More commits means more recovery points. Aim to commit at every logical boundary:</p>

<ul>
  <li>After the change proposal is created, or after each proposal artifact is generated individually (spec, design, tasks)</li>
  <li>After each logical code change inside the worktree branch</li>
  <li>After running Archive (the spec sync is a meaningful state change)</li>
</ul>

<p>There is no such thing as too many commits in this workflow. If a SubAgent session goes wrong mid-apply, a dense commit history gives you a clean point to resume from rather than starting over.</p>

<h2 id="video">Video</h2>

<iframe width="560" height="315" src="https://www.youtube.com/embed/F9xjZlqVDDk" title="OpenSpec, Git WorkTrees and OpenCode" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

<p>For a reference skill that automates the bulk-apply workflow, see the <a href="https://github.com/intent-driven-dev/openspec-schemas/blob/main/.opencode/skills/openspec-bulk-apply-change/SKILL.md">openspec-bulk-apply-change skill</a>.</p>

<p>For worktree-based skills, <a href="https://github.com/obra/superpowers">Superpowers</a> is worth exploring — it provides a skill framework designed to work with git worktrees.</p>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/04/01/openspec-git-worktrees-opencode/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on April 01, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="git-worktrees" /><category term="opencode" /><category term="parallel-development" /><category term="subagents" /><summary type="html"><![CDATA[A workflow for using Git WorkTrees and SubAgents to build features in parallel with OpenSpec Spec-Driven Development on OpenCode.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Spec-Driven Development with Brownfield Projects</title><link href="https://blog.harikrishnan.io/2026-03-10/spec-driven-development-brownfield" rel="alternate" type="text/html" title="Spec-Driven Development with Brownfield Projects" /><published>2026-03-10T00:00:00+00:00</published><updated>2026-03-10T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-03-10/spec-driven-development-brownfield</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-03-10/spec-driven-development-brownfield"><![CDATA[<p><img src="/assets/images/posts/intent-driven/spec-driven-development-brownfield-banner.jpg" alt="Spec-Driven Development with Brownfield Projects" /></p>

<h2 id="what-is-a-brownfield-project">What is a Brownfield Project?</h2>

<p>The term “Legacy code” has many definitions, the most relatable IMHO is how Michael Feathers defines it in his book <em>Working Effectively with Legacy Code</em>. Any code that does not have tests is effectively legacy.</p>

<p>Similarly “Brownfield”, in the context of SDD, can be defined as projects that were not built based on specs. The only artifact that is available to us is the implementation or the code itself.</p>

<h2 id="can-we-reverse-engineer-specs">Can We Reverse-Engineer Specs?</h2>

<p>In theory, we can reverse-engineer it. A quick way to achieve it is by using tools like repomix to pack the code into smaller sizes and give it to an LLM along with context of the SDD tool we are using. This can help generate the overall spec.</p>

<p>In practice, however, AI-generated specs are often inaccurate. The model doesn’t fully capture the original developer’s intent or the subtle nuances embedded in the code. The result is a spec that looks plausible on the surface but diverges from reality. This can’t be trusted as a foundation for future development.</p>

<h2 id="the-issues-with-reverse-engineering">The Issues with Reverse-Engineering</h2>

<p>Reverse Engineering the spec itself can be quite involved. And even if we do, reviewing the specs may not be practical.</p>

<p>In the context of Test-Driven Development, when dealing with legacy code which does not have tests, should we start by writing all the tests first? That is not practical. In Feathers’ work in <em>Working Effectively with Legacy Code</em> the approach taken is largely to cover the area of code change with tests to first establish current behavior (characterization tests). Then we can test drive the remaining code.</p>

<p>Similarly it is a lot more practical to incrementally author specs for brownfield projects.</p>

<p>There is also the problem of alignment loss. A reverse-engineered spec is a derived artifact. When new features are developed against a misaligned spec, the risk of regressions and unintended side effects rises sharply, because the spec no longer reflects the real ground truth of the system.</p>

<h2 id="why-incremental-is-better">Why Incremental is Better</h2>

<p>The incremental approach focuses specs on a single, upcoming change rather than attempting to capture the whole codebase at once. Before making a modification, you author a spec for just that area — the change you are about to make. This is far more economical: the scope is bounded, the context is fresh, and the resulting spec accurately reflects intent.</p>

<p>Over time, this practice compounds. Each change leaves behind a spec that covers its slice of the system. As spec density grows in frequently touched areas, those sections start to behave like greenfield zones. The coverage builds naturally where it matters most.</p>

<p>For a deeper look at how this applies at scale, see my article on Enterprise Spec-Driven Development on InfoQ.</p>

<h2 id="brownfield-spec-driven-development-with-openspec">Brownfield Spec-Driven Development with OpenSpec</h2>

<h3 id="use-a-custom-profile-and-the-explore--continue-workflow">Use a Custom Profile and the Explore → Continue Workflow</h3>

<p>When applying SDD to brownfield projects with OpenSpec, prefer using a custom OpenSpec profile over the default <code class="language-plaintext highlighter-rouge">propose</code> command. For more information on custom profiles, please see OpenSpec 1.2 release blog post.</p>

<p>The recommended workflow for brownfield is:</p>

<ol>
  <li><code class="language-plaintext highlighter-rouge">/opsx:explore</code> — explore the change and understand the codebase before any spec is written</li>
  <li>Review the exploration output</li>
  <li><code class="language-plaintext highlighter-rouge">/opsx:continue</code> (or fast-forward through artifacts) — progress through proposal, spec, design, and tasks one at a time</li>
</ol>

<p>In brownfield projects reviewing each artifact individually gives you more control over what gets generated thereby keeping the spec grounded in the real codebase.</p>

<h3 id="pass-codebase-context-during-explore-with-repomix-mcp">Pass Codebase Context During Explore with Repomix MCP</h3>

<p>During the explore phase, pass context about the existing codebase using Repomix MCP. This educates the AI on the brownfield codebase before spec writing begins, so the resulting artifacts reflect the actual system rather than assumptions.</p>

<p>Example command:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/opsx:explore I would like to remove the maybe option in RSVP, use repomix mcp to understand existing code
</code></pre></div></div>

<p>Repomix packages your codebase into a format the AI can consume directly, giving the explore phase accurate grounding in what already exists.</p>

<p>For large codebases, tools like Repomix are especially helpful in managing context window usage.</p>

<h2 id="conclusion">Conclusion</h2>

<p>Incremental approach gives you control, accuracy, and progressively growing coverage, without requiring a big upfront investment in reverse-engineering specs that may not hold up. You start where the work is, build specs that reflect genuine intent, and let the brownfield gradually transform over time.</p>

<p>To see this in action, watch the video below. It walks through a real-world example demonstrating how to use RepoMix to package an existing codebase, feed it to an AI model for analysis, and then author a targeted spec for the next change.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/gJvwn-nuSc8" title="Spec-Driven Development with Brownfield Projects" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen=""></iframe>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/03/10/spec-driven-development-brownfield/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on March 10, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="legacy code" /><category term="brownfield" /><category term="incremental development" /><category term="repomix" /><summary type="html"><![CDATA[How to apply Spec-Driven Development to brownfield projects — codebases that lack specifications and rely solely on existing implementation.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">OpenSpec 1.2 Release</title><link href="https://blog.harikrishnan.io/2026-02-25/openspec-1-2-release" rel="alternate" type="text/html" title="OpenSpec 1.2 Release" /><published>2026-02-25T00:00:00+00:00</published><updated>2026-02-25T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-02-25/openspec-1-2-release</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-02-25/openspec-1-2-release"><![CDATA[<p><img src="/assets/images/posts/intent-driven/openspec-1-2-release-banner.jpg" alt="OpenSpec 1.2 Release" /></p>

<p>OpenSpec 1.2 is <a href="https://github.com/Fission-AI/OpenSpec/releases/tag/v1.2.0">officially released</a>.</p>

<p>The 1.2 release focuses on balancing workflow simplicity from 0.x releases with advanced customization introduced in release 1.0.</p>

<h2 id="openspec-profiles-and-schemas">OpenSpec Profiles and Schemas</h2>

<p>The primary addition in 1.2 is <strong>profiles</strong>, which manage the command workflow.</p>

<h3 id="profiles">Profiles</h3>

<ul>
  <li><strong>Core Profile</strong>: The new default uses a simplified process: explore, propose, apply, and archive. The propose command generates all change proposal artifacts at once.</li>
  <li><strong>Custom Profile</strong>: Provides access to advanced commands, allowing you to step through proposal artifacts individually using the continue command, or generate them all at once using the fast-forward command.</li>
</ul>

<h3 id="schemas">Schemas</h3>

<p>While profiles manage workflow, schemas control which artifacts are generated during the proposal phase. The default OpenSpec schema is “Spec-Driven,” which generates proposal.md, spec.md, design.md, and tasks.md.</p>

<p>Custom schema examples include:</p>
<ul>
  <li><strong>Minimalist</strong>: Reduces output to strictly spec and task artifacts.</li>
  <li><strong>Event-Driven</strong>: Tailored for event-driven architectures with specialized artifacts.</li>
</ul>

<h2 id="customizability">Customizability</h2>

<p>Release 1.2 balances keeping basic workflow easy to adopt while retaining customizability essential for enterprise-scale adoption.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/Y1zfpJHY_4s" title="OpenSpec 1.2 Release" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen=""></iframe>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/02/25/openspec-1-2-release/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on February 25, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="openspec" /><category term="release" /><category term="workflows" /><category term="profiles" /><category term="schemas" /><summary type="html"><![CDATA[OpenSpec 1.2 introduces new workflow capabilities — here is what is new in this release.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">The Intent Harness</title><link href="https://blog.harikrishnan.io/2026-02-23/intent-harness" rel="alternate" type="text/html" title="The Intent Harness" /><published>2026-02-23T00:00:00+00:00</published><updated>2026-02-23T00:00:00+00:00</updated><id>https://blog.harikrishnan.io/2026-02-23/intent-harness</id><content type="html" xml:base="https://blog.harikrishnan.io/2026-02-23/intent-harness"><![CDATA[<p><img src="/assets/images/posts/intent-driven/intent-harness-banner.jpg" alt="The Intent Harness" /></p>

<p>An agentic harness is the execution layer that channels LLM capability into useful work. It does this by combining the model’s reasoning with tools, workflow control, memory, and guardrails. For sustained autonomous execution, it relies on sufficiently structured context that makes intent, constraints, and success conditions explicit. Without this structure, the agent may act in ways that are not aligned with the intended outcome. This results in constant supervision being necessary.</p>

<p>In order to achieve sustained autonomous execution without the risk of losing alignment between intent and implementation, we need to close the gap in shared understanding. The Intent Harness fills this void by helping transform ideas into well-articulated intent that an agent can execute with less supervision.</p>

<h2 id="intent-harness">Intent Harness</h2>

<p>Most useful ideas do not begin as fully formed specifications. They begin as intuition.</p>

<p>A team senses a feature that should exist. A product manager sees a pattern in customer behavior. An engineer notices an architectural weakness. A founder feels that a workflow should be simpler. Sometimes that intuition comes from expertise. Sometimes it is supported by data. Either way, it starts out incomplete.</p>

<p>That incompleteness is not a flaw. It is actually useful.</p>

<p>Intuition is valuable precisely because it leaves room to explore options, test assumptions, and discover better paths before committing to implementation. The problem is not that ideas begin vaguely. The problem is what happens when we send that vagueness straight into an execution system.</p>

<p>Without a disciplined process for clarification, the result is shallow prompting, weak task framing, and low-quality execution. The agent may still produce output, but that output remains tightly coupled to constant human supervision.</p>

<p>The Intent Harness exists to solve this. Being a layer above the Agentic Harness, its job is to help humans articulate intent clearly before execution begins. It achieves this by enabling dialog between humans and AI to establish shared understanding. Just as the agentic harness helps channel raw LLM capability into useful work, the intent harness helps channel raw intuition and ideas into well-engineered intent.</p>

<p><strong>Spec-Driven Development</strong> plays a major role here by giving that intent a structured, reviewable form. It helps us harness intent without forcing us to prematurely lock down every detail.</p>

<p>That means creating a system that helps us:</p>

<ul>
  <li>examine an idea from multiple angles</li>
  <li>challenge assumptions</li>
  <li>make constraints explicit</li>
  <li>define success criteria</li>
  <li>decide what should and should not be built</li>
  <li>break work into meaningful units before execution starts</li>
</ul>

<h2 id="harness-engineering">Harness Engineering</h2>

<p>If the questions we ask, the review discipline we apply, and the framework we use to think all shape the resulting intent, then the quality of that system is critical. Engineering the harness determines how well we articulate intent and how much reliable autonomy we can expect from our agents.</p>

<p>Weak intent engineering produces weak execution:</p>

<ul>
  <li>specs become shallow</li>
  <li>task boundaries become fuzzy</li>
  <li>review becomes ceremonial</li>
  <li>agents need constant correction</li>
</ul>

<p>Strong intent engineering produces better outcomes:</p>

<ul>
  <li>clearer specifications</li>
  <li>better task decomposition</li>
  <li>earlier surfacing of ambiguities</li>
  <li>longer, more focused independent agent execution</li>
</ul>

<p>This is why the conversation around AI-assisted delivery should not stop at model capability or coding-agent ergonomics. The real leverage increasingly comes from the quality of the harness that shapes intent before execution starts.</p>

<p>Looking at it from this angle, how we interpret bugs, mismatches, and execution failures also changes.</p>

<p><img src="/assets/images/posts/intent-driven/intent-harness-feedback-loop.jpg" alt="Harness Feedback Loop" /></p>

<p><em>Image from my <a href="https://www.infoq.com/articles/enterprise-spec-driven-development/">InfoQ article about Spec-Driven Development Adoption at Enterprise Scale</a>.</em></p>

<p>A defect in implementation is not always just an implementation problem. Sometimes it is a signal that the harness itself needs improvement.</p>

<p>For example:</p>

<ul>
  <li>a bug in code may point to a gap in the spec</li>
  <li>a gap in the spec may point to insufficient human review</li>
  <li>insufficient review may point to a pattern of high-volume, low-quality specs being generated</li>
  <li>the structure and quality of those specs may ultimately indicate a weak workflow</li>
</ul>

<p>Seen this way, execution failures are not only quality issues in the output. They are also feedback on the quality of the system that produced the output.</p>

<p>That is an important shift.</p>

<p>It means we should not ask only, “Why did the agent get this wrong?”</p>

<p>We should also ask, “What in our elicitation, specification, review, or validation process allowed this ambiguity to survive?”</p>

<p>This is where the harness metaphor becomes genuinely useful. The purpose of the harness is not just to make the agent productive. It is to make the overall human–AI system learnable and improvable.</p>

<h2 id="closing-thoughts">Closing thoughts</h2>

<p>A good Intent Harness should do more than help teams generate artifacts. Its primary responsibility is to enable human and AI collaboration that helps elicit intent thoroughly, encourages meaningful review, and ultimately ensures alignment between intent and implementation.</p>

<p><em>This post is a living document. I intend to continue updating it.</em></p>

<hr />

<p><strong><a href="https://intent-driven.dev/blog/2026/02/23/intent-harness/">Read the full article on intent-driven.dev →</a></strong></p>

<p><em>Originally published on intent-driven.dev on February 23, 2026</em></p>]]></content><author><name>Hari Krishnan</name></author><category term="intent harness" /><category term="spec driven development" /><category term="agent harness" /><category term="vibe coding" /><category term="context engineering" /><summary type="html"><![CDATA[Between human ideas and agent execution there is a gap. The Intent Harness is the layer that transforms raw ideas into structured, durable instructions the agent can act on independently.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://harikrishnan.io/images/harikrishnan.jpeg" /><media:content medium="image" url="https://harikrishnan.io/images/harikrishnan.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>