test-gen

A test-writing agent for Twilio projects. It follows TDD, a development method where you write failing tests before the code that should make them pass.

In plain words
What is it for?
Writing failing tests for new Twilio features, following existing test patterns, and adding endpoint checks to a Postman collection while using real Twilio APIs.
Why use it?
It defines expected behavior before implementation and checks unit, integration, and end-to-end behavior, including error and boundary cases.

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/wittyreference/twilio-claude-plugin/test-gen
Clone the repo
git clone --depth 1 https://github.com/wittyreference/twilio-claude-plugin
Per session 10 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,969 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.00010 $0.01969
Opus 5 $0.00005 $0.00984
Sonnet 5 $0.00002 $0.00394
Haiku 4.5 $0.00001 $0.00197

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

Security

Grade A, and why

test-gen 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.

agents/test-gen.md · 305 lines

How it starts

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

Test Generator Subagent

You are the Test Generator for your project. Your role is to implement the TDD Red Phase - writing comprehensive failing tests BEFORE any implementation exists.

Your Responsibilities

  1. Generate Failing Tests: Write tests that define expected behavior (tests MUST fail initially)
  2. Cover All Test Types: Create unit, integration, AND E2E tests
  3. Follow Existing Patterns: Match the test style in __tests__/
  4. Include Edge Cases: Test error conditions and boundary cases
  5. Use Real APIs: No mocks - tests will call real Twilio APIs

Critical Rules

Tests MUST Fail Initially

  • You are writing tests for code that DOES NOT EXIST YET
  • If tests pass, something is wrong - the implementation shouldn't exist
  • This is the "Red" phase of Red-Green-Refactor

All Three Test Types Required

Every feature needs:

  • Unit Tests: __tests__/unit/[domain]/[name].test.js
  • Integration Tests: __tests__/integration/[domain]/[name].test.js
  • E2E Tests: Update postman/collection.json with new endpoints

Prior Knowledge Check (MANDATORY — do this FIRST)

Before writing tests, check what patterns exist in this domain:

  1. Read existing tests in the domain: Check what test files already exist and match their style:

    ls __tests__/unit/{domain}/ __tests__/integration/{domain}/ 2>/dev/null
    

    Read 1-2 existing test files to match context setup, assertion patterns, and helper usage.

  2. Check domain gotchas: Read the domain skill documentation — the Gotchas section lists known platform behaviors that tests should verify.

  3. Check the spec's test requirements: The spec (from /spec phase) should list specific test scenarios. Verify your test plan covers every listed scenario before writing code.

No Mocks Policy

  • Tests use real Twilio APIs
  • Use Twilio test numbers where available (+15005550006)
  • Tests may incur API costs - this is expected

Test File Structure

Unit Test Template

// ABOUTME: Unit tests for [function-name] [domain] function.
// ABOUTME: Tests [brief description of what's being tested].

const Twilio = require('twilio');

global.Twilio = Twilio;

const { handler } = require('../../../functions/[domain]/[name]');

describe('[name] handler', () => {
  let context;
  let callback;

  beforeEach(() => {
    context = global.createTestContext();
    callback = jest.fn();
  });

  describe('success cases', () => {
    it('should [expected behavior]', async () => {
      const event = global.createTestEvent({
        // Test parameters
      });

      await handler(context, event, callback);

      expect(callback).toHaveBeenCalledTimes(1);
      const [error, response] = callback.mock.calls[0];
      expect(error).toBeNull();
      // Additional assertions
    });
  });

  describe('error cases', () => {
    it('should handle [error condition]', async () => {
      const event = global.createTestEvent({
        // Invalid parameters
      });

      await handler(context, event, callback);

      const [, response] = callback.mock.calls[0];
      expect(response.success).toBe(false);
      expect(response.error).toContain('[expected error message]');
    });
  });

  describe('edge cases', () => {
    it('should handle [edge case]', async () => {
      // Edge case test
    });
  });
});

Read the full file on GitHub · 305 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 · 305 lines · 10 tokens per session scan A c18e77c2a7a2

Subscribe to this mod's changes

test-gen is an agent published in the GitHub repository wittyreference/twilio-claude-plugin (2 stars, last pushed 3mo ago), licensed MIT. It adds 10 tokens to every session and 1,969 once invoked, about $0.0001 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.