<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ngoclinh93qt</title>
    <description>The latest articles on DEV Community by ngoclinh93qt (@ngoclinh93qt).</description>
    <link>https://dev.to/ngoclinh93qt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2247830%2Fb038ffb9-7a93-48d0-8ec7-4423ac2f8b8a.png</url>
      <title>DEV Community: ngoclinh93qt</title>
      <link>https://dev.to/ngoclinh93qt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ngoclinh93qt"/>
    <language>en</language>
    <item>
      <title>The API Notebook Pattern: One File for Docs, Tests, and Agent Context</title>
      <dc:creator>ngoclinh93qt</dc:creator>
      <pubDate>Sun, 14 Jun 2026 07:50:49 +0000</pubDate>
      <link>https://dev.to/ngoclinh93qt/the-api-notebook-pattern-one-file-for-docs-tests-and-agent-context-fi7</link>
      <guid>https://dev.to/ngoclinh93qt/the-api-notebook-pattern-one-file-for-docs-tests-and-agent-context-fi7</guid>
      <description>&lt;p&gt;Most API workflow pain is not about sending the request.&lt;/p&gt;

&lt;p&gt;It is about everything around the request.&lt;/p&gt;

&lt;p&gt;The docs live in a README. The real payload shape lives in the backend. The manual test lives in a GUI collection. The CI check lives in a shell script. Then a coding agent enters the project and has to reconstruct the same route, auth rule, and expected response from scattered clues.&lt;/p&gt;

&lt;p&gt;That fragmentation makes drift the default.&lt;/p&gt;

&lt;p&gt;A useful way to reduce it is the &lt;strong&gt;API notebook pattern&lt;/strong&gt;: keep the explanation, runnable request, expected response, assertions, and workflow notes in small files inside the repository.&lt;/p&gt;

&lt;p&gt;One artifact can then serve four audiences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;developers can read it,&lt;/li&gt;
&lt;li&gt;reviewers can diff it,&lt;/li&gt;
&lt;li&gt;CI can execute it,&lt;/li&gt;
&lt;li&gt;coding agents can use it as bounded context.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is an API notebook?
&lt;/h2&gt;

&lt;p&gt;An API notebook is not a giant specification dump. It is also more than a saved request.&lt;/p&gt;

&lt;p&gt;It is a small, reviewable file for one endpoint or product flow. It should answer the questions developers repeatedly ask during implementation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is this endpoint for?&lt;/li&gt;
&lt;li&gt;What request should I send?&lt;/li&gt;
&lt;li&gt;Which variables or credentials does it need?&lt;/li&gt;
&lt;li&gt;What response counts as correct?&lt;/li&gt;
&lt;li&gt;What should fail the check?&lt;/li&gt;
&lt;li&gt;Which workflow depends on this behavior?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A minimal notebook might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Create checkout session&lt;/span&gt;

Creates a hosted checkout session for an open cart.

&lt;span class="gu"&gt;## Request&lt;/span&gt;

&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;http
&lt;/span&gt;&lt;span class="err"&gt;POST {{baseUrl}}/checkout/sessions
Content-Type: application/json
Authorization: Bearer {{authToken}}

{
  "cartId": "{{cartId}}",
  "successUrl": "https://example.test/success"
}&lt;/span&gt;
&lt;span class="p"&gt;```&lt;/span&gt;

&lt;span class="gu"&gt;## Expected response&lt;/span&gt;

&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;http
&lt;/span&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;201&lt;/span&gt; &lt;span class="ne"&gt;Created&lt;/span&gt;

{
  "id": "{{checkoutSessionId}}",
  "cartId": "{{cartId}}",
  "status": "ready"
}
&lt;span class="p"&gt;```&lt;/span&gt;

&lt;span class="gu"&gt;## Assertions&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; status: 201
&lt;span class="p"&gt;-&lt;/span&gt; body.id: exists
&lt;span class="p"&gt;-&lt;/span&gt; body.cartId: equals "{{cartId}}"
&lt;span class="p"&gt;-&lt;/span&gt; body.status: equals ready

&lt;span class="gu"&gt;## Notes&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; Requires an authenticated customer session.
&lt;span class="p"&gt;-&lt;/span&gt; Returns 409 when the cart is already checked out.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is intentionally boring.&lt;/p&gt;

&lt;p&gt;But it gives a reviewer enough context to understand the contract, gives CI enough structure to run a check, and gives a coding agent fewer reasons to guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why existing API workflows drift
&lt;/h2&gt;

&lt;p&gt;Most teams already have several useful API artifacts. The problem is that each one becomes a separate source of truth.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Artifact&lt;/th&gt;
&lt;th&gt;What it does well&lt;/th&gt;
&lt;th&gt;Where drift appears&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;README example&lt;/td&gt;
&lt;td&gt;Easy to scan&lt;/td&gt;
&lt;td&gt;Usually not executed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GUI collection&lt;/td&gt;
&lt;td&gt;Good for exploration&lt;/td&gt;
&lt;td&gt;Hard to review in pull requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenAPI file&lt;/td&gt;
&lt;td&gt;Broad schema coverage&lt;/td&gt;
&lt;td&gt;Often too broad for one implementation task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shell smoke test&lt;/td&gt;
&lt;td&gt;Fast in CI&lt;/td&gt;
&lt;td&gt;Too terse to explain the contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chat prompt&lt;/td&gt;
&lt;td&gt;Useful for one task&lt;/td&gt;
&lt;td&gt;Quickly becomes stale&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The handler changes first. Documentation catches up later. The collection may only exist in one workspace. The test checks the happy path but does not explain why the response changed.&lt;/p&gt;

&lt;p&gt;An API notebook reduces the number of places that must stay synchronized.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the contract in the pull request
&lt;/h2&gt;

&lt;p&gt;The biggest benefit is not the command line. It is the review loop.&lt;/p&gt;

&lt;p&gt;When API behavior changes intentionally, the contract should change in the same pull request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt; ## Expected response
 {
   "id": "{{userId}}",
   "email": "{{email}}",
&lt;span class="gd"&gt;-  "status": "pending_verification"
&lt;/span&gt;&lt;span class="gi"&gt;+  "status": "active"
&lt;/span&gt; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That small diff explains the behavior change more directly than many route-handler diffs.&lt;/p&gt;

&lt;p&gt;It also lets the review process ask better questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this response change intentional?&lt;/li&gt;
&lt;li&gt;Which flow depends on the old value?&lt;/li&gt;
&lt;li&gt;Were the failure cases updated?&lt;/li&gt;
&lt;li&gt;Does CI execute this contract?&lt;/li&gt;
&lt;li&gt;Will a coding agent read the new behavior before editing related code?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Endpoint files and flow files solve different problems
&lt;/h2&gt;

&lt;p&gt;One endpoint file should own one contract.&lt;/p&gt;

&lt;p&gt;A flow file should describe a product journey that connects several contracts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;1.&lt;/span&gt; Create cart
&lt;span class="p"&gt;   -&lt;/span&gt; Capture: response.body.id as cartId
&lt;span class="p"&gt;2.&lt;/span&gt; Add item
&lt;span class="p"&gt;   -&lt;/span&gt; Inject: cartId, sku, quantity
&lt;span class="p"&gt;3.&lt;/span&gt; Create checkout session
&lt;span class="p"&gt;   -&lt;/span&gt; Inject: cartId
&lt;span class="p"&gt;   -&lt;/span&gt; Capture: response.body.id as checkoutSessionId
&lt;span class="p"&gt;4.&lt;/span&gt; Get checkout session
&lt;span class="p"&gt;   -&lt;/span&gt; Inject: checkoutSessionId
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is easier to reason about than a disconnected list of request tabs because the value movement is explicit.&lt;/p&gt;

&lt;p&gt;A repository can stay simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;api-docs/
  reqbook.md
  _shared/
    env.md
  apis/
    auth/post-login.md
    users/post-create-user.md
    checkout/post-create-session.md
  flows/
    signup-login-profile.md
    cart-checkout.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why this helps coding agents
&lt;/h2&gt;

&lt;p&gt;Coding agents are good at reading files. They are less reliable when they must infer workflow state from several systems.&lt;/p&gt;

&lt;p&gt;If the API contract is split across source code, documentation, collection tabs, environment notes, and old prompts, the agent spends context reconstructing the behavior before it can make the actual change.&lt;/p&gt;

&lt;p&gt;A notebook gives it a bounded artifact containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;request method, URL, headers, and body,&lt;/li&gt;
&lt;li&gt;variables and environment names,&lt;/li&gt;
&lt;li&gt;expected status and response shape,&lt;/li&gt;
&lt;li&gt;assertions that define success,&lt;/li&gt;
&lt;li&gt;business rules and failure cases,&lt;/li&gt;
&lt;li&gt;nearby flow context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This does not make the agent smarter. It makes the task less ambiguous.&lt;/p&gt;

&lt;p&gt;The same principle applies even if you do not use AI tools: stable, executable examples are easier for every developer to trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Reqbook fits
&lt;/h2&gt;

&lt;p&gt;I am building &lt;a href="https://markapidown.net/" rel="noopener noreferrer"&gt;Reqbook&lt;/a&gt;, so I am biased, but it is one implementation of this pattern.&lt;/p&gt;

&lt;p&gt;Reqbook keeps API docs, requests, tests, flows, and coding-agent context as runnable Markdown in the repository. Its browser UI, VS Code extension, CLI, CI commands, and agent tooling operate on the same files.&lt;/p&gt;

&lt;p&gt;A basic loop looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rqb validate api-docs/
rqb &lt;span class="nb"&gt;exec &lt;/span&gt;api-docs/apis/checkout/post-create-session.md &lt;span class="nt"&gt;--env&lt;/span&gt; dev
rqb flow api-docs/flows/cart-checkout.md &lt;span class="nt"&gt;--env&lt;/span&gt; dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The product is less important than the workflow shape:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read the contract before changing implementation code.&lt;/li&gt;
&lt;li&gt;Update the contract when behavior changes.&lt;/li&gt;
&lt;li&gt;Execute the endpoint or flow locally.&lt;/li&gt;
&lt;li&gt;Run the same artifact in CI.&lt;/li&gt;
&lt;li&gt;Keep it available to reviewers and coding agents.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When the notebook pattern is not a good fit
&lt;/h2&gt;

&lt;p&gt;This pattern is not the right default for every team.&lt;/p&gt;

&lt;p&gt;A traditional API client or hosted platform may be a better choice when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;most work is manual, GUI-heavy exploration,&lt;/li&gt;
&lt;li&gt;hosted collaboration and governance matter more than repo ownership,&lt;/li&gt;
&lt;li&gt;the API is small enough that a few smoke tests are sufficient,&lt;/li&gt;
&lt;li&gt;nobody needs the test files to double as documentation or agent context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is also a maintenance cost. A useful notebook requires more discipline than saving a request tab.&lt;/p&gt;

&lt;p&gt;In return, you get a contract that is readable, reviewable, executable, and reusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with one workflow
&lt;/h2&gt;

&lt;p&gt;Do not migrate an entire API at once.&lt;/p&gt;

&lt;p&gt;Pick one flow that already creates confusion:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;signup, login, and profile fetch,&lt;/li&gt;
&lt;li&gt;cart creation, item addition, and checkout,&lt;/li&gt;
&lt;li&gt;workspace creation and member invitation,&lt;/li&gt;
&lt;li&gt;webhook registration and callback verification.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the endpoint contracts.&lt;/li&gt;
&lt;li&gt;Record expected responses and basic assertions.&lt;/li&gt;
&lt;li&gt;Keep secrets outside committed files.&lt;/li&gt;
&lt;li&gt;Run the workflow locally.&lt;/li&gt;
&lt;li&gt;Add the stable path to CI.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The useful standard is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A developer can read it. A reviewer can diff it. CI can run it. A coding agent can use it before changing code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is what makes an API notebook more than documentation.&lt;/p&gt;

</description>
      <category>api</category>
      <category>testing</category>
      <category>devtool</category>
      <category>ai</category>
    </item>
    <item>
      <title>I am building Reqbook: a notebook for API workflows</title>
      <dc:creator>ngoclinh93qt</dc:creator>
      <pubDate>Sun, 14 Jun 2026 07:36:46 +0000</pubDate>
      <link>https://dev.to/ngoclinh93qt/i-am-building-reqbook-a-notebook-for-api-workflows-3080</link>
      <guid>https://dev.to/ngoclinh93qt/i-am-building-reqbook-a-notebook-for-api-workflows-3080</guid>
      <description>&lt;p&gt;I am building Reqbook because API knowledge often gets split across too many places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;docs explain the endpoint&lt;/li&gt;
&lt;li&gt;Postman or curl sends the request&lt;/li&gt;
&lt;li&gt;CI tests check a small slice&lt;/li&gt;
&lt;li&gt;coding agents get separate prompt context&lt;/li&gt;
&lt;li&gt;PR reviewers see only the code diff&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reqbook tries to make one artifact do more work: runnable Markdown API specs that live in the repo and can be read by humans, run in CI, and used as coding-agent context.&lt;/p&gt;

&lt;p&gt;I will mostly write about API docs as code, executable documentation, MCP/CLI tradeoffs, and practical API testing workflows.&lt;/p&gt;

</description>
      <category>api</category>
      <category>showdev</category>
      <category>testing</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
