testing

A guide to writing and organizing automated tests, including unit tests for small pieces of code and integration or end-to-end tests for connected parts of an application.

In plain words
What is it for?
Use it to write or debug tests, create fakes and in-memory database helpers, regenerate ClickHouse test schemas, and expose test utilities safely from packages.
Why use it?
It helps choose the right test type and keeps test-only helpers out of production code. It also covers testing with PostgreSQL and ClickHouse, databases commonly used by applications.

Skill for Claude CodeCodex

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 skills/latitude-dev/latitude-llm/testing
Any agent
npx skills add latitude-dev/latitude-llm --skill testing
Clone the repo
git clone --depth 1 https://github.com/latitude-dev/latitude-llm

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,066 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.00041 $0.01066
Opus 5 $0.00020 $0.00533
Sonnet 5 $0.00008 $0.00213
Haiku 4.5 $0.00004 $0.00107

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

Security

Grade A, and why

testing 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 3d 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/skills/testing/SKILL.md · 112 lines

How it starts

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

Testing conventions and in-memory databases

When to use: Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.

Package exports (test code isolation)

Test utilities (fakes, in-memory DB helpers, fixtures) must not be exported from a package’s main entry (src/index.ts).

  • Never re-export from ./test/ or ./testing/ in the main src/index.ts
  • To expose test helpers, add a /testing subpath in package.json exports:
{
  "exports": {
    ".": "./src/index.ts",
    "./testing": "./src/testing/my-test-helpers.ts"
  }
}
  • Consumers: import { Fake } from "@platform/my-package/testing"
  • Biome noRestrictedImports blocks test paths in production source; tsdown fails the build if test code is resolved from prod entry points

Conventions

  • Shared default environment: Node with globals enabled (packages/vitest-config/index.ts)
  • Write tests, mostly e2e, some unit tests when logic is complex
  • Unit tests: domain entities/use-cases/policies with fakes
  • Contract tests: adapter compliance against domain ports
  • Integration tests: infra-backed tests for Postgres/ClickHouse/Redis/BullMQ/object storage
  • End-to-end tests: ingest boundary to query boundary across organization scoping
  • Keep tests deterministic and isolated
  • Prefer package-local runs during iteration; run full monorepo tests before PR

Database testing (in-memory)

Always use in-memory databases for tests. Do not use vi.mock/vi.fn to mock repository methods and do not require running database servers. The project provides embedded, in-process database engines that run the real SQL against the real schema:

  • ClickHouse → chdb (chdb package): An in-process ClickHouse engine via @platform/testkit.
  • Postgres → PGlite (@electric-sql/pglite): An in-process Postgres via WASM via @platform/testkit.

Read the full file on GitHub · 112 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. 3d ago First seen · 112 lines · 41 tokens per session scan A d10cfba15530

Subscribe to this mod's changes

testing is a skill published in the GitHub repository latitude-dev/latitude-llm (4,611 stars, last pushed yesterday), licensed MIT. It adds 41 tokens to every session and 1,066 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-30.