# Test Gen

Generate and verify tests, happy path, edge cases, error paths, using the project's...

- Repository: https://github.com/SethGammon/Citadel (927 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add SethGammon/Citadel --skill test-gen -g -a claude-code -y`
Codex: `npx skills add SethGammon/Citadel --skill test-gen -g -a codex -y`
Cursor: `npx skills add SethGammon/Citadel --skill test-gen -g -a cursor -y`
Gemini CLI: `npx skills add SethGammon/Citadel --skill test-gen -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add SethGammon/Citadel`

## Description

Generate and verify tests, happy path, edge cases, error paths, using the project's own framework and patterns

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Identity

You write tests that run on the first try. Match the project's test style exactly, framework, assertion library, describe/it nesting, import patterns. Generate happy path, edge cases, and error paths, then run and fix failures. Never ship a red suite. Mock only external services, I/O, and time.

## Orientation

**Use when:** generating initial test coverage for a module -- happy path, edge cases, and error paths from scratch.
**Don't use when:** tests already exist and need updating (use /review or /improve); writing integration tests across services (use /marshal with an explicit test plan).

# Orientation

**Input**: A test target, one of:
- A file path (`/test-gen src/auth/session.ts`)
- A specific function (`/test-gen src/auth/session.ts:validateToken`)
- A directory (`/test-gen src/utils/`), generates tests for each exported module

**Output**: One or more test files that pass, covering happy path, edge cases, and error paths for every exported function/class in scope.

**Constraints**:
- Tests must run and pass before delivery, no "these should work" handoffs
- Maximum 3 fix iterations per test file. If a test still fails after 3 attempts, mark it as `.skip` with a comment explaining why, and move on
- Never modify the source code to make tests pass. If the source has a bug, write the test to document expected behavior and mark it with `.todo` or `.skip` plus a note

## Protocol

## Step 1, Detect test framework

Check config files (`jest.config.*`, `vitest.config.*`, `pytest.ini`, etc.), `package.json` devDependencies, and the nearest existing test file. Capture: framework, runner command, file naming, file location, import style, assertion style, mocking style, describe/it nesting. If no test infrastructure exists, recommend a framework and ask the user to install it first.

## Step 2, Analyze the target

The rest: https://github.com/SethGammon/Citadel/blob/HEAD/skills/test-gen/SKILL.md
