add-test

add-test is a skill for Claude Code, Codex from magnusquest/startgg-mcp. It costs 42 tokens per session (1,930 once invoked), scanned A, original, Apache-2.0.

A guide for creating tests for an existing tool, data endpoint, or service using Vitest, a JavaScript testing framework. The tests are placed beside the code they check.

In plain words
What is it for?
Use it to add coverage for normal behavior, invalid input, service failures, optional fields, and code that uses shared request context.
Why use it?
It helps catch incorrect results, failures, missing inputs, and unusual cases before changes are considered complete.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add coverage for normal behavior, invalid input, service failures, optional fields, and code that uses shared request context.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/magnusquest/startgg-mcp/add-test
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.

Any agent
npx skills add magnusquest/startgg-mcp --skill add-test
Clone the repo
git clone --depth 1 https://github.com/magnusquest/startgg-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/add-test/github.svg)](https://agentmods.dev/skills/magnusquest/startgg-mcp/add-test)
Your own site
<a href="https://agentmods.dev/skills/magnusquest/startgg-mcp/add-test"><img src="https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/add-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/magnusquest/startgg-mcp/add-test"><img src="https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/add-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,930 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00042 $0.01930
Opus 5 $0.00021 $0.00965
Sonnet 5 $0.00008 $0.00386
Haiku 4.5 $0.00004 $0.00193

Measured 9d ago against content hash 0c4290e60a5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

add-test 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 9d 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.

skills/add-test/SKILL.md · 217 lines

How it starts

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

Context

Tests use Vitest and createMockContext from @cyanheads/mcp-ts-core/testing. Test files are colocated with their source: foo.tool.ts gets foo.tool.test.ts in the same directory.

For the full createMockContext API and testing patterns, read:

skills/api-testing/SKILL.md

Steps

  1. Identify the target — which tool, resource, or service needs tests
  2. Read the source file — understand the handler's logic, input/output schemas, error paths, and which ctx features it uses
  3. Create the test file colocated with the source
  4. Write test cases covering happy path, error paths, and edge cases
  5. Run npm test to verify
  6. Run bun run devcheck to verify types

Determining What to Test

Read the handler and identify:

Aspect Test Strategy
Happy path Valid input → expected output. Always include at least one.
Input variations Optional fields omitted, defaults applied, boundary values
Error paths Invalid state, missing resources, service failures → correct error thrown
ctx.state usage Use createMockContext({ tenantId: 'test' }) to enable storage
ctx.elicit / ctx.sample Mock with vi.fn(), also test the absent case (undefined)
ctx.progress Use createMockContext({ progress: true }) for task tools
format function Test separately if defined — it's pure, no ctx needed
Auth scopes Not tested at handler level (framework enforces) — skip

Templates

Tool test

/**
 * @fileoverview Tests for {{TOOL_NAME}} tool.
 * @module mcp-server/tools/definitions/{{TOOL_NAME}}.test
 */

import { describe, expect, it } from 'vitest';
import { createMockContext } from '@cyanheads/mcp-ts-core/testing';
import { {{TOOL_EXPORT}} } from './{{tool-name}}.tool.js';

describe('{{TOOL_EXPORT}}', () => {
  it('returns expected output for valid input', async () => {
    const ctx = createMockContext();
    const input = {{TOOL_EXPORT}}.input.parse({
      // valid input matching the Zod schema
    });
    const result = await {{TOOL_EXPORT}}.handler(input, ctx);
    expect(result).toMatchObject({
      // expected output shape
    });
  });

  it('throws on invalid state', async () => {
    const ctx = createMockContext();
    const input = {{TOOL_EXPORT}}.input.parse({
      // input that triggers an error path
    });
    await expect({{TOOL_EXPORT}}.handler(input, ctx)).rejects.toThrow();
  });

  it('formats output correctly', () => {
    const output = { /* mock output matching the output schema */ };
    const blocks = {{TOOL_EXPORT}}.format!(output);
    expect(blocks).toHaveLength(1);
    expect(blocks[0].type).toBe('text');
  });
});

Read the full file on GitHub · 217 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. 9d ago First seen · 217 lines · 42 tokens per session scan A 0c4290e60a5d

Subscribe to this mod's changes

add-test is a skill published in the GitHub repository magnusquest/startgg-mcp (1 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 42 tokens to every session and 1,930 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.