Provides a template and steps for adding end-to-end integration tests in the PilotSwarm ecosystem.

Install

mkdir -p .claude/skills/add-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15292" && unzip -o skill.zip -d .claude/skills/add-test && rm skill.zip

Installs to .claude/skills/add-test

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Add a new integration test to PilotSwarm test suite. Tests verify end-to-end flows through PilotSwarmClient, duroxide orchestration, and the Copilot SDK.
153 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Create new integration test files in a specified directory
  • Set up test environments using `createTestEnv`
  • Perform preflight checks with `preflightChecks`
  • Orchestrate client-worker interactions with `withClient`
  • Assert responses and conditions using helper functions

How it works

The skill guides the creation of new integration test files using Vitest, setting up test environments and orchestrating client-worker interactions. It enforces conventions for test structure and assertions.

Inputs & outputs

You give it
Description of the feature to test, desired test case
You get back
New integration test file, added to Vitest config, and runnable test

When to use add-test

  • Add integration test
  • Verify pilot swarm flow
  • Create test environment

About this skill

Add a New Test

Integration tests live in packages/sdk/test/local/ as individual .test.js files (or in subdirectories like sub-agents/). They require a running PostgreSQL database and a GitHub token (in .env). Tests use vitest with describe/it.

Steps

  1. Create a new test file in packages/sdk/test/local/ following this pattern:
import { describe, it, beforeAll } from "vitest";
import { createTestEnv, preflightChecks } from "../helpers/local-env.js";
import { withClient } from "../helpers/local-workers.js";
import { assert, assertNotNull } from "../helpers/assertions.js";

const TIMEOUT = 120_000;

async function testMyFeature(env) {
    await withClient(env, async (client) => {
        const session = await client.createSession();

        console.log("  Sending: prompt text");
        const response = await session.sendAndWait("prompt text", TIMEOUT);

        console.log(`  Response: "${response}"`);
        assertNotNull(response, "Should get a response");
    });
}

describe.concurrent("My Feature", () => {
    beforeAll(async () => { await preflightChecks(); });

    it("My Test Case", { timeout: TIMEOUT }, async () => {
        const env = createTestEnv("my-feature");
        try { await testMyFeature(env); } finally { await env.cleanup(); }
    });
});
  1. Add to the vitest config — the file will be auto-discovered if it matches test/local/**/*.test.js. Ensure the vitest config includes the path.

  2. Run the test:

cd packages/sdk
npx vitest run test/local/my-feature.test.js              # run just this file
npx vitest run test/local/my-feature.test.js -t "My Test"  # filter by test name
./scripts/run-tests.sh --suite=my-feature                  # via the runner script

Patterns

  • withClient(env, fn) — spins up a co-located worker + client pair, auto-forwards setSessionConfig. Use for most tests.
  • Manual worker/client — for testing specific worker features (e.g., registerTools), create them manually outside withClient.
  • Tool tests — set a let toolCalled = false flag, assert it's true after the prompt.
  • Event tests — use session.on() or session.getMessages(), add a setTimeout delay for polling.
  • Timer tests — use waitThreshold: 0 in client opts to force durable timers even for short waits.
  • CMS validation — use createCatalog(env) and validateSessionAfterTurn(env, sessionId) from test/helpers/cms-helpers.js.

Conventions

  • No custom system prompts — use client.createSession() without overriding systemMessage. The default agent prompt should be sufficient. If it isn't, fix the product, not the test.
  • No retries — never add retry to test configs. Fix the root cause.
  • Use describe.concurrent() for file-level parallelism within the vitest runner.
  • Use TIMEOUT constant (120s default) for sendAndWait.
  • Use assertion helpers from test/helpers/assertions.js.
  • Use describe/it from vitest.
  • Log key values with console.log(" ...") for debuggability.
  • Each test creates its own env via createTestEnv() for schema isolation.
  • If a change adds or modifies a TUI keybinding, update the startup keybinding hint/splash and the help dialog/modal at the same time, and add or update validation coverage for the affected user flow when practical.

Key files

  • packages/sdk/test/local/ — all test files
  • packages/sdk/test/helpers/ — shared helpers (assertions, fixtures, local-env, local-workers, cms-helpers)
  • packages/sdk/vitest.config.js — vitest configuration
  • scripts/run-tests.sh — shell runner for all suites

When not to use it

  • When not adding integration tests to the PilotSwarm test suite
  • When custom system prompts are required for the agent

Limitations

  • Requires a running PostgreSQL database and a GitHub token
  • No custom system prompts should be used with `client.createSession()`
  • No retries should be added to test configs

How it compares

This skill provides a structured template and helper functions for creating integration tests within the PilotSwarm framework, ensuring consistency and adherence to specific testing patterns, unlike general test writing.

Compared to similar skills

add-test side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
add-test (this skill)05moReviewIntermediate
prisma-connection-pool-exhaustion17moReviewIntermediate
hiddenroom-supabase01moNo flagsIntermediate
backend-patterns01moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

prisma-connection-pool-exhaustion

blader

Fix Prisma "Too many connections" and connection pool exhaustion errors in serverless environments (Vercel, AWS Lambda, Netlify). Use when: (1) Error "P2024: Timed out fetching a new connection from the pool", (2) PostgreSQL "too many connections for role", (3) Database works locally but fails in production serverless, (4) Intermittent database timeouts under load.

14

hiddenroom-supabase

cuvo1903-ctrl

Hidden Room Supabase backend skill for migrations, generated database types, Edge Functions, RLS policies, auth/profile sync, storage buckets, Stripe integration, cloud_jobs, and database documentation. Use when editing supabase/migrations, supabase/functions, database.types.ts, or Supabase-backed f

00

backend-patterns

chenqin231

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

00

web-server-architecture

develsvai

`web/src/server/**`의 router, service, 공통 계층을 건드릴 때 사용하는 스킬이다. tRPC router와 service 책임 분리, 도메인 구조, Prisma 사용 경계를 맞춘다.

00

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

orchardcore-tester

OrchardCMS

Tests OrchardCore CMS features through browser automation. Use when the user needs to build, run, setup, or test OrchardCore functionality including admin features, content management, media library, and module testing.

14

Search skills

Search the agent skills registry