<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gopal Saini on Medium]]></title>
        <description><![CDATA[Stories by Gopal Saini on Medium]]></description>
        <link>https://medium.com/@saini_gopal?source=rss-9d48d5e8ddd4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0mQP4KXOeEWlcMKVmWLttg.jpeg</url>
            <title>Stories by Gopal Saini on Medium</title>
            <link>https://medium.com/@saini_gopal?source=rss-9d48d5e8ddd4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:39:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saini_gopal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why spec-driven development is becoming essential for agentic software engineering]]></title>
            <link>https://medium.com/@saini_gopal/why-spec-driven-development-is-becoming-essential-for-agentic-software-engineering-e1b6375c788a?source=rss-9d48d5e8ddd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1b6375c788a</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[spec-driven-development]]></category>
            <dc:creator><![CDATA[Gopal Saini]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 04:24:00 GMT</pubDate>
            <atom:updated>2026-09-20T04:24:00.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Us4XnI5-exQgzfzMFIBwgw.png" /></figure><p><em>Why spec-driven development is becoming essential for agentic software engineering</em></p><p>Software development is entering a different era. AI can now understand requirements, explore a repository, write code, create tests, analyze architecture and generate documentation. Increasingly, it can coordinate several agents working on different parts of the same problem. The speed is remarkable.</p><p>There is a consequence of that speed we don’t talk about enough: the smarter our AI tools become, the more it matters that we clearly define what we actually want them to do.</p><p>Most of the conversation today is about outcomes. Did the AI build it? Did the code get generated? Did the tests pass? Did the feature ship? Those are fair questions, but I think a more important one sits upstream of all of them:</p><blockquote>Did we give the AI enough clarity to produce the right outcome?</blockquote><p>That distinction will matter more and more as we move from AI-assisted development toward truly agentic software development.</p><h3>The era of “just build it” is changing</h3><p>Imagine handing an AI coding agent a simple instruction: <em>“Build a customer registration flow.”</em></p><p>A modern agent may get to work immediately. It can inspect the existing repository, identify components, read the APIs, make architectural decisions, write the frontend, modify backend services, add tests and even prepare the pull request. That is impressive.</p><p>It also hides a fundamental problem. What does “build a customer registration flow” actually mean?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-UjhzNueWsxE5_s38YaXRw.png" /><figcaption>One instruction, and ten questions it leaves unanswered.</figcaption></figure><p>Should the existing registration architecture be extended or replaced? Which components should be reused? What authentication and security requirements apply, and what happens when registration fails halfway through? Which accessibility standards have to hold? Which analytics events should fire? What are the performance expectations? Which systems is the agent allowed to change, and how should the implementation be validated?</p><p>Most importantly: what does “done” mean?</p><p>When a specification is ambiguous, an agent fills the gaps with assumptions. Those assumptions may be technically reasonable. They may also be completely wrong for the business or for the existing architecture. AI doesn’t eliminate ambiguity. It can accelerate it.</p><h3>The prompt is becoming a specification</h3><p>For years we have talked about prompt engineering as the way to get better responses out of AI. But software engineering needs much more than a good response. It needs predictable execution, traceability, validation, architectural consistency and a clear definition of success.</p><p>That means our prompts increasingly have to behave like software specifications. Instead of telling an agent to “build this feature,” we should hand it something closer to this: here is the intent, here is the context, here are the constraints, here is the architecture, here is how the work should be divided, here is how it should be validated, and here is what the final outcome must contain.</p><p>I think of this as a shift from prompt engineering to specification engineering. The goal is no longer a better answer from the AI. The goal is an <em>executable understanding of the problem</em>.</p><h3>What a good AI-ready specification contains</h3><p>Four areas matter most.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBaeWL53FLejFTfzSQqqsA.png" /></figure><p>The four parts of an AI-ready specification, and the question each one answers.</p><h3>1. Intent</h3><p>An agent needs to understand <em>why</em> we are building something. Compare “Add a registration form” with this:</p><blockquote>Improve customer registration so that new customers can complete onboarding with fewer failures, while maintaining our existing security, accessibility and analytics standards.</blockquote><p>The second version gives the agent a reason behind the implementation, and that reason shapes the architectural and implementation decisions it makes along the way.</p><h3>2. Execution strategy</h3><p>The next question is how the work should be executed, which becomes especially important once multiple agents are involved.</p><p>Take a larger feature that touches several parts of an enterprise system. We could run agents one after another: architecture, then frontend, backend, data, testing, security and integration. Or a master specification could fan the work out to frontend, backend and data agents at the same time, with integration and validation agents bringing the results back together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fd3rDQuHi1dj9BycS4RQUQ.png" /></figure><p>The same work, run in sequence and in parallel.</p><p>The second model can dramatically increase execution speed, but there is a catch. Parallel execution only works when the agents share a common understanding of the problem. Otherwise we are just creating multiple parallel interpretations of the same ambiguity.</p><h3>3. Validation</h3><p>This is probably the most overlooked part of AI-assisted development. We are getting good at telling AI what to build. We are not always as good at telling it how to prove that it built the right thing.</p><p>A specification should therefore carry explicit validation criteria. For the registration example, that might be:</p><ul><li>Existing registration journeys continue to work</li><li>Unit and integration tests pass</li><li>Critical user journeys pass end-to-end testing</li><li>Accessibility requirements are satisfied</li><li>No critical security issues are introduced</li><li>API performance stays within defined thresholds</li><li>Required analytics events are generated</li><li>Documentation is updated</li></ul><p>Now the agent is no longer optimizing for “I completed the task.” It is optimizing for “I completed the task <em>and</em> satisfied the acceptance criteria.” That is a very different objective.</p><h3>4. Expected outcome</h3><p>Finally, define what the deliverable must contain: a production-ready implementation, automated tests, architecture updates, security validation, observability updates, documentation, validation results, known limitations and a summary of the components that changed.</p><p>This gives the agent a meaningful definition of completion, because an AI-generated pull request is not necessarily a completed engineering task.</p><h3>Multi-stack spec-driven development</h3><p>All of this gets more interesting when a feature crosses technology stacks, and in modern enterprise applications it almost always does. A single feature might involve a React or Angular frontend built on a design system, Node.js, Java or .NET services behind GraphQL and REST APIs, PostgreSQL, Redis and event streams, AWS or Azure infrastructure, CI/CD, observability and security tooling, and now an AI layer of LLMs, RAG, MCP, agent orchestration and vector databases.</p><p>Now imagine handing one giant prompt to a single agent and expecting it to get every one of those dimensions right. It might work. There is a better approach: a multi-stack specification.</p><h3>One intent, multiple implementation specifications</h3><p>Think of the specification as a contract that connects the layers of the system. Business intent flows into functional requirements and architecture. From there it branches into a frontend specification, an API and backend specification, a data specification, a cloud and infrastructure specification, and security and observability requirements. Everything converges again on testing and validation and, finally, a single definition of done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TstC20zEQ4A7fDZA7bvHg.png" /><figcaption>Shared layers at the top and bottom, one implementation spec per agent in the middle.</figcaption></figure><p>Each implementation agent receives the context it needs and no more. The frontend agent doesn’t need to understand every database migration. The database agent doesn’t need to design the user interface. The security agent doesn’t need to implement the entire application. But all of them need to understand the same intent and the same contracts. That is where a well-designed specification becomes powerful.</p><h3>Agent swarming needs orchestration</h3><p>There is a lot of excitement around agent swarms, and for good reason: a complex software problem can potentially be broken into independent workstreams and executed simultaneously.</p><p>But swarming is not “give the task to ten agents.” It is closer to “define the problem, establish boundaries, identify dependencies, assign responsibilities, define contracts and create validation gates.” Agent intelligence is not enough. We need agent coordination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2gxkd_xRqly-SPRfTzQNg.png" /></figure><p>Five things a swarm needs besides intelligence.</p><p>A good swarm needs shared context, so everyone understands the same objective. It needs clear boundaries, so every agent knows what it owns. It needs explicit dependencies, so agents know what they can do independently and what has to wait for another workstream. It needs contracts that define interfaces, APIs, schemas and expected behavior. And it needs validation gates, so work is checked continuously before it moves forward.</p><p>None of this is fundamentally different from good software engineering. We are simply applying the same principles to AI agents.</p><h3>The role of engineers is changing</h3><p>This shift also changes what engineering leadership looks like. Traditionally, engineers spent a significant share of their time implementing solutions. As AI becomes more capable of implementation, more of our effort moves toward problem definition, system design, specification, agent orchestration, validation and governance.</p><p>The engineer becomes less of a code producer and more of an architect, orchestrator, reviewer and validator.</p><p>That doesn’t make coding irrelevant. Quite the opposite. Strong engineering fundamentals matter even more, because someone still has to judge whether the generated solution makes sense. AI can generate implementation. Humans still need to define intent and establish trust.</p><h3>“Done” should not mean “the agent finished”</h3><p>This may be the biggest mindset change we need to make. An agent finishing its assigned task does not mean the feature is complete. A generated pull request does not mean the requirement is satisfied. Passing unit tests does not automatically mean the user’s problem has been solved.</p><p>We need a stronger definition of done. Here is mine:</p><blockquote>Done means the intended outcome has been implemented, validated, and satisfies the agreed functional, technical, security, quality and operational requirements.</blockquote><p>Whether the work was completed by one engineer, a team of engineers, one AI agent or a swarm of them should not change that definition.</p><h3>From coding instructions to executable specifications</h3><p>I believe this is where software development is heading. In traditional development, requirements went to human engineers, who produced code. In AI-assisted development, requirements go to humans working with AI. In agentic development, the flow becomes intent, specification, agent swarm, implementation, validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6spqO4LBC_0w4WcGeVyAxA.png" /></figure><p>Three models of software development.</p><p>That is more than a productivity improvement. It is a different development model, and it asks for a different engineering mindset. As AI gets better at implementation, human clarity becomes more valuable, not less. When execution becomes cheap, ambiguity becomes expensive.</p><p>The next generation of engineering excellence may not be defined only by how quickly we can write code. It may be defined by how precisely we can describe what needs to be built, why it matters, how it should be built, how different agents should collaborate, and how we will know the result is correct.</p><p>That is why I believe multi-stack, spec-driven development will become an important foundation for the agentic software engineering era. The future may belong not just to people who can code with AI, but to people who can architect work for AI.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1b6375c788a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apollo Server Unit testing using Jest & nock.]]></title>
            <link>https://medium.com/@saini_gopal/apollo-server-unit-testing-using-jest-nock-70c04ff6b5f7?source=rss-9d48d5e8ddd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/70c04ff6b5f7</guid>
            <category><![CDATA[nock]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[apollo-server]]></category>
            <dc:creator><![CDATA[Gopal Saini]]></dc:creator>
            <pubDate>Fri, 11 Sep 2020 02:38:29 GMT</pubDate>
            <atom:updated>2020-09-11T12:14:00.883Z</atom:updated>
            <content:encoded><![CDATA[<p>When I went through the documentation in <a href="https://www.apollographql.com/docs/apollo-server/">Apollo Server</a> for <a href="https://www.apollographql.com/docs/apollo-server/testing/mocking/">Testing approach</a>, I feel there could be a better way to do the same &amp; I decided to utilize nock for mocking <a href="https://www.apollographql.com/docs/apollo-server/data/data-sources/"><strong>RestDataSource</strong></a><strong> </strong>response.</p><p>Here, I will walkthrough to configure Apollo Server along with nock.</p><p>Before move to actual implementation, let’s have a quick overview of Apollo Server &amp; nock…</p><blockquote><strong>Apollo Server is an </strong><a href="https://github.com/apollographql/apollo-server"><strong>open-source</strong></a><strong>, spec-compliant GraphQL server</strong> that’s compatible with any GraphQL client, including <a href="https://www.apollographql.com/docs/react">Apollo Client</a>. It’s the best way to build a production-ready, self-documenting GraphQL API that can use data from any source.</blockquote><blockquote>We can use Apollo Server as:</blockquote><blockquote>A stand-alone GraphQL server, including in a serverless environment</blockquote><blockquote>An add-on to your application’s existing <a href="https://www.apollographql.com/docs/apollo-server/integrations/middleware/">Node.js middleware</a> (such as Express or Fastify)</blockquote><p>Here it’s a setup example how to create Apollo Test Server…</p><pre>// test-utils/apollo-server.ts</pre><pre>import {<br>    ApolloServer<br>} from &#39;apollo-server&#39;;<br>import {<br>    createTestClient<br>} from &#39;apollo-server-testing&#39;;<br>import schema from &#39;../schema&#39;; /<br>import dataSources from &#39;../services&#39;;</pre><pre>const createApolloTestServer = () =&gt; {<br>    const server = new ApolloServer({<br>        schema,<br>        dataSources,<br>        debug: true,<br>        context: () =&gt; {<br>            return {<br>                token: &#39;foo&#39;<br>            };<br>        }<br>    });<br>    return server;<br>};</pre><pre>const apolloServer = createApolloTestServer();</pre><pre>export const {<br>    query,<br>    mutate<br>} = createTestClient(apolloServer);</pre><blockquote><a href="https://github.com/nock/nock"><strong>nock</strong></a></blockquote><blockquote>Well, there are a number of cool things about nock, just to mention a few…</blockquote><blockquote>HTTP server mocking and expectations library for node.js</blockquote><blockquote>Nock can be used to test modules that perform HTTP requests in isolation.</blockquote><blockquote><strong>Why nock? &amp; how does it work?</strong></blockquote><blockquote>Nock works by overriding Node’s http.request method. Also, it overrides http.ClientRequest too to cover for modules that use it directly.</blockquote><p>Let’s see an example, how nock can help to return mock responses…</p><pre>// modules/todo/__test__/todos.spec.ts</pre><pre>import nock from &#39;nock&#39;;<br>import {<br>    query as useQuery<br>} from &#39;./../../../test-utils/apollo-server&#39;;<br>import {<br>    GET_TODOS<br>} from &#39;./gql&#39;;<br>import todos from &#39;./../../../mocks/todos.json&#39;;</pre><pre>describe(&#39;Todos Module&#39;, () =&gt; {<br>    it(&#39;should return todos&#39;, async () =&gt; {<br>        nock(&#39;<a href="https://jsonplaceholder.typicode.com&/#39;">https://jsonplaceholder.typicode.com&#39;</a>)<br>            .get(&#39;/todos&#39;)<br>            .reply(200, todos);</pre><pre>        const response = await useQuery({<br>            query: GET_TODOS<br>        });<br>        expect(response).toMatchSnapshot();<br>    });<br>});</pre><p>Nock can help on the same way to perform testing on RESTDatasource as well…</p><pre>// services/todo/__test__/todos.spec.ts</pre><pre>import nock from &#39;nock&#39;;<br>import {<br>    initialize<br>} from &#39;./../../../test-utils/setup&#39;;<br>import {<br>    TodosAPI<br>} from &#39;../index&#39;;<br>import todos from &#39;./../../../mocks/todos.json&#39;;</pre><pre>describe(&#39;Todos RESTDatasource&#39;, () =&gt; {<br>    let todosAPI: TodosAPI;<br>    beforeAll(() =&gt; {<br>        todosAPI = initialize(TodosAPI); // manual..<br>    });</pre><pre>it(&#39;should return todos&#39;, async () =&gt; {<br>    nock(&#39;<a href="https://jsonplaceholder.typicode.com&/#39;">https://jsonplaceholder.typicode.com&#39;</a>)<br>         .get(&#39;/todos&#39;)<br>         .reply(200, todos);</pre><pre>    const response = await todosAPI.getTodos();<br>        expect(response).toMatchSnapshot();<br>    });<br>});</pre><p>In actual, we are not spying any method/function in between as it’s mentioned <a href="https://github.com/apollographql/fullstack-tutorial/blob/master/final/server/src/__tests__/integration.js">here</a>. You can find the complete source code here on this <a href="https://github.com/gsaini/apollo-server-getting-started">github repository</a>.</p><p><strong>Conclusion</strong></p><p>By using nock along with Apollo Server, we can better manage test mocks by intercepting HTTP Requests in isolation.</p><p>In all cases, single source of mocking/expectations would be always <strong>nock</strong>. When we talk about single source of mocking &amp; performing test on a module in isolation, it enables the ways for integration testing to verify the actual dataSource/API <strong>response</strong> as well as Apollo Server <strong>query/mutation.</strong></p><p><em>Thanks for reading this article! Please leave a comment below if you have any questions &amp; feel free to provide feedback to improve.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70c04ff6b5f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>