TDD Green Phase - Make Tests Pass Quickly

A coding instruction for the Green phase of test-driven development, or TDD, where code is added to make a failing test pass.

In plain words
What is it for?
Use it when implementing the minimum Graph operations or tools needed to satisfy failing Vitest tests, while following the repository’s instructions.
Why use it?
It keeps fixes small and aligned with the existing graphdo-ts code patterns instead of adding unneeded design or changing the tests.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/co-native-ab/graphdo-ts/tdd-green
Clone the repo
git clone --depth 1 https://github.com/co-native-ab/graphdo-ts
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,228 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.01228
Opus 5 $0.00017 $0.00614
Sonnet 5 $0.00007 $0.00246
Haiku 4.5 $0.00003 $0.00123

Measured 2d ago against content hash 9fe16fc21576, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

TDD Green Phase - Make Tests Pass Quickly scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/agents/tdd-green.agent.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TDD Green Phase - Make Tests Pass Quickly (graphdo-ts)

Write the minimal code necessary to make failing vitest tests pass. Resist the urge to write more than required.

Always read AGENTS.md before implementing — it defines the exact patterns all code in this project must follow.

Core Principles

  • Just enough code — implement only what's needed to make the test pass
  • Follow existing patterns — look at src/graph/mail.ts or src/graph/todo.ts as models for Graph operations; look at src/tools/mail.ts or src/tools/todo.ts for tool registration patterns
  • Minimal implementation — start simple, generalise only when forced by additional tests
  • Don't modify tests — the test defines the contract; the implementation must conform to it

The graphdo-ts Implementation Patterns

Adding a Graph Operation (src/graph/)

Look at src/graph/mail.ts as the model:

import type { GraphClient } from "./client.js";
import type { SomeType } from "./types.js";

export async function getSomething(client: GraphClient, id: string): Promise<SomeType> {
  const result = await client.request<SomeType>("GET", `/me/some/resource/${id}`);
  return result;
}

export async function createSomething(
  client: GraphClient,
  data: { field: string },
): Promise<SomeType> {
  return client.request<SomeType>("POST", "/me/some/resource", data);
}

Adding a Tool Registration (src/tools/)

Look at src/tools/mail.ts as the model:

import { z } from "zod";
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { GraphClient } from "../graph/client.js";
import { AuthenticationRequiredError } from "../auth.js";
import { logger } from "../logger.js";
import type { ServerConfig } from "../index.js";
import { getSomething } from "../graph/some.js";

export function registerSomeTools(server: McpServer, config: ServerConfig): void {
  server.registerTool(
    "some_tool",
    {
      description: "Does something with the Graph API",
      inputSchema: { id: z.string().min(1).describe("Resource ID") },
      annotations: { readOnlyHint: true },
    },
    async ({ id }) => {
      try {
        const token = await config.authenticator.token();
        const client = new GraphClient(config.graphBaseUrl, token);
        const result = await getSomething(client, id);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      } catch (error: unknown) {
        const message = error instanceof Error ? error.message : String(error);
        logger.error("some_tool failed", { error: message });
        return { isError: true, content: [{ type: "text", text: `Error: ${message}` }] };
      }
    },
  );
}

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 146 lines · 35 tokens per session scan A 9fe16fc21576

Subscribe to this mod's changes

TDD Green Phase - Make Tests Pass Quickly is an agent published in the GitHub repository co-native-ab/graphdo-ts (1 stars, last pushed 11d ago), licensed MIT. It adds 35 tokens to every session and 1,228 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.