Agent skill

Gen Tests

by AlphaLab-USTC in AlphaLab-USTC/OhMyCode

Generate high-quality tests for OhMyCode modules. An agent skill from AlphaLab-USTC/OhMyCode.

MITAuto-check passedTesting & QA

Install Gen Tests

skills CLI
$ npx skills add AlphaLab-USTC/OhMyCode --skill gen-tests -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install AlphaLab-USTC/OhMyCode gen-tests --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/AlphaLab-USTC/OhMyCode.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/gen-tests .claude/skills/gen-tests && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gen-tests
GitHub stars
131
Token cost
~1.6k tokens
SKILL.md length
506 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

Generate high-quality tests for OhMyCode modules. An agent skill from AlphaLab-USTC/OhMyCode.

  • Works in 5 steps: Resolve Target → Read Existing Test Patterns → Design Test Cases → …
  • User wants to create
  • SKILL.md covers When to Use, Input, Step 1 — Resolve Target and Step 2 — Read Existing Test…, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Gen Tests is an agent skill from AlphaLab-USTC/OhMyCode. Generate high-quality tests for OhMyCode modules. Use when user wants to create, add, or generate tests for a module or file.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Test generation. It works with Bash. The repository describes itself as: Minimal and Customizable CC-Style Coding Agent. The licence is MIT.

When your agent uses it

  • User wants to create
  • Generate tests for a module

Example prompts

  • “/gen-tests”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Resolve Target
  2. Read Existing Test Patterns
  3. Design Test Cases
  4. Generate Test Code
  5. Run and Verify → hand off to /run-tests

What it can do on your machine

Read from SKILL.md and the folder at commit 4d1bb28. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Gen Tests loads about 1.6k tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 506 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from AlphaLab-USTC/OhMyCode at commit 4d1bb28, republished under its MIT licence (© AlphaLab-USTC). 506 words, ~1,570 tokens.

Download SKILL.mdSave it as .claude/skills/gen-tests/SKILL.md (or your agent's skills folder).
name
gen-tests
description
Generate high-quality tests for OhMyCode modules. Use when user wants to create, add, or generate tests for a module or file.

Generate Tests for OhMyCode

Generate project-convention-compliant tests for a given module or file.

This skill is part of the OhMyCode development closed-loop:

编码 ──→ /gen-tests ──→ /run-tests ──→ 分析失败 ──→ 修代码 ──╮
 ↑                                                            │
 ╰────────────────────────────────────────────────────────────╯

After generating tests, always proceed to /run-tests to verify them.

When to Use

  • User says "gen tests", "write tests", "add tests for …"
  • User provides a module name or file path (e.g., ohmycode/tools/bash.py, core/loop)
  • As part of the development loop: just finished writing/modifying source code and need tests

Input

$ARGUMENTS — module name or file path to test (e.g., ohmycode/tools/bash.py, core/loop, providers/anthropic).

If $ARGUMENTS is empty, ask the user which module to generate tests for.

Step 1 — Resolve Target

Map the argument to a source file path:

Argument formResolved source path
ohmycode/tools/bash.pyuse as-is
tools/bashohmycode/tools/bash.py
core/loopohmycode/core/loop.py
providers/openaiohmycode/providers/openai.py
configohmycode/config/config.py

Read the resolved source file. Identify:

  • Public classes / functions (skip _private unless critical)
  • Async vs sync interfaces
  • External dependencies (API calls, file I/O, subprocesses)
  • Branch paths (if/else, error returns, edge cases)

Step 2 — Read Existing Test Patterns

  1. Read tests/conftest.py to learn available fixtures:

    • MockProvider — fake LLM that yields configurable responses, use for anything touching providers
    • mock_provider — fixture returning a default MockProvider()
    • mock_config — minimal config dict
    • tmp_dir — alias for tmp_path, use for file-based tests
  2. Check for existing test file at the mirror path (see Step 4 path rule). If it exists, read it to understand current coverage and style — extend rather than overwrite.

Step 3 — Design Test Cases

List test scenarios before writing code. Cover three categories:

CategoryExamples
Happy pathNormal input → expected output
Error / failureInvalid input, missing params, API errors → graceful error
Edge casesEmpty input, huge input, concurrent calls, boundary values

For each scenario, write a one-line description:

- test_bash_echo: simple command returns stdout
- test_bash_exit_code: non-zero exit → is_error=True
- test_bash_timeout: long command + short timeout → timeout error

Step 4 — Generate Test Code

Path convention

Source ohmycode/X/Y.py → Test tests/X/test_Y.py

Examples:

  • ohmycode/tools/bash.py → tests/tools/test_bash.py
  • ohmycode/core/loop.py → tests/core/test_loop.py
  • ohmycode/providers/openai.py → tests/providers/test_openai_provider.py

Ensure tests/X/__init__.py exists (create empty if needed).

Show full SKILL.md (205 more words)Show less
Project rules
  • Async tests: decorate with @pytest.mark.asyncio
  • No network calls: mock all HTTP / API interactions
  • File isolation: use tmp_path or tmp_dir fixture for any file I/O
  • No hardcoded paths: everything relative or via tmp_path
  • Minimal mocking: prefer real objects with fake data over deep mock chains
  • One assert focus: each test function tests one logical behavior
Template — Tool test
python
import pytest
from ohmycode.tools.base import ToolContext
from ohmycode.tools.<module> import <ToolClass>

@pytest.fixture
def ctx(tmp_path):
    return ToolContext(mode="auto", agent_depth=0, cwd=str(tmp_path), is_sub_agent=False)

@pytest.mark.asyncio
async def test_<tool>_basic(ctx):
    tool = <ToolClass>()
    result = await tool.execute({"param": "value"}, ctx)
    assert not result.is_error
    assert "expected" in result.output

@pytest.mark.asyncio
async def test_<tool>_error(ctx):
    tool = <ToolClass>()
    result = await tool.execute({"bad_param": ""}, ctx)
    assert result.is_error
Template — Core module test
python
import pytest
from ohmycode.config.config import OhMyCodeConfig
from ohmycode.core.<module> import <Class>

@pytest.mark.asyncio
async def test_<feature>_happy_path(mock_provider):
    config = OhMyCodeConfig(provider="mock", model="test", mode="auto", api_key="x")
    obj = <Class>(config=config)
    obj._provider = mock_provider
    # setup and assertions ...

@pytest.mark.asyncio
async def test_<feature>_error(mock_provider):
    # test error handling path
    ...
Template — Provider test
python
import pytest
from ohmycode.providers.base import PROVIDER_REGISTRY

def test_<provider>_is_registered():
    import ohmycode.providers.<module>  # noqa: F401
    assert "<provider_name>" in PROVIDER_REGISTRY

def test_<provider>_instantiation():
    from ohmycode.providers.<module> import <ProviderClass>
    provider = <ProviderClass>(api_key="test-key", base_url="http://localhost:8080/v1")
    assert provider.name == "<provider_name>"

Step 5 — Run and Verify → hand off to /run-tests

After writing the test file, immediately use /run-tests to execute and verify:

  1. Run the new tests: /run-tests X/Y (e.g., /run-tests tools/bash)
  2. /run-tests will handle: execution, failure analysis, regression check

If /run-tests reports failures:

  • Test bug → fix the test code, re-run /run-tests
  • Implementation bug → fix the source code, re-run /run-tests
  • Loop until all green ✓

Quality Checklist

Before finishing, verify:

  • Happy path, error, and edge cases all covered
  • No hardcoded absolute paths — tmp_path used for file I/O
  • Fixtures from conftest.py reused where applicable
  • No real network calls — APIs mocked or faked
  • Async tests have @pytest.mark.asyncio
  • Test file at correct mirror path with __init__.py
  • Each test name clearly describes what it verifies
  • /run-tests confirms: new tests pass + full suite has no regressions

Next Step

→ /run-tests — always run tests after generating them

© AlphaLab-USTC, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/gen-tests of AlphaLab-USTC/OhMyCode.

Open the folder on GitHubat commit 4d1bb28

Compare with similar skills

Gen Tests next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Gen Tests compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Gen Tests this skillAlphaLab-USTC/OhMyCode131—~1.6kAutomated safety check: PassMIT
Ue Test AuthoringJasonMa0012/MooaToon750—~2.1kAutomated safety check: NotesCustom licence
Write and Verify Playwright Testsappsmithorg/appsmith41k—~2.9kAutomated safety check: NotesApache-2.0
E2Ecallstack/react-native-pager-view3.4k1 repos~2.1kAutomated safety check: PassMIT
Adk Verify Snippetsgoogle/adk-python22k—~1.4kAutomated safety check: PassApache-2.0
Engine E2Ewix/react-native-navigation13k—~1.1kAutomated safety check: PassMIT

Similar skills

  • Ue Test Authoring

    JasonMa0012/MooaToon

    A skill your agent uses when writing or modifying UE automated tests (Automation, CQTest, Functional, Gauntlet, LowLevel) with Rider MCP available.

    750 GitHub stars~2.1k tokensUpdated 21 days ago
    Testing & QAAuto-check: notes
  • Writes a Playwright end-to-end test from a prompt, runs it against a live Appsmith deployment and retries with fixes up to three times until it passes.

    41k GitHub stars~2.9k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • E2E

    callstack/react-native-pager-view

    Agentic end-to-end tests with e2e, the e2e runner. An agent skill from callstack/react-native-pager-view.

    3.4k GitHub starsUsed in 1 repo~2.1k tokens
    Testing & QAAuto-check passed
  • Adk Verify Snippets

    google/adk-python

    Official

    Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail…

    22k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Engine E2E

    wix/react-native-navigation

    Official

    Run Wix Engine (mobile-apps-engine) iOS E2E tests locally to validate RNN changes.

    13k GitHub stars~1.1k tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Hermetic Python Unit Tests

    dimensionalOS/dimos

    Rules for writing, fixing and reviewing pytest unit tests that are hermetic: behavior-focused, deterministic, isolated and cheap to run.

    4.6k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed

More from AlphaLab-USTC/OhMyCode

All 10 skills in this repo
  • Add Feature

    AlphaLab-USTC/OhMyCode

    Guide for adding a new feature to OhMyCode. An agent skill from AlphaLab-USTC/OhMyCode.

    131 GitHub stars~995 tokensUpdated 6 mo ago
    Auto-check passed
  • Add Provider

    AlphaLab-USTC/OhMyCode

    Guide for adding a new LLM provider to OhMyCode. An agent skill from AlphaLab-USTC/OhMyCode.

    131 GitHub stars~888 tokensUpdated 6 mo ago
    Auto-check passed
  • Add Tool

    AlphaLab-USTC/OhMyCode

    Guide for adding a new tool to OhMyCode. An agent skill from AlphaLab-USTC/OhMyCode.

    131 GitHub stars~758 tokensUpdated 6 mo ago
    Auto-check passed
  • Bench

    AlphaLab-USTC/OhMyCode

    Run OhMyCode benchmarks — score any provider/model with token tracking.

    131 GitHub stars~941 tokensUpdated 6 mo ago
    Auto-check passed
  • Customize Response Style

    AlphaLab-USTC/OhMyCode

    Guide for customizing OhMyCode's terminal output style and rendering.

    131 GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Customize System Prompt

    AlphaLab-USTC/OhMyCode

    Guide for customizing OhMyCode's AI personality and behavior via system prompt.

    131 GitHub stars~819 tokensUpdated 6 mo ago
    Auto-check passed

Works with

Categories

Questions about Gen Tests

What does Gen Tests do?

Generate high-quality tests for OhMyCode modules. An agent skill from AlphaLab-USTC/OhMyCode. Gen Tests is an agent skill from AlphaLab-USTC/OhMyCode. Generate high-quality tests for OhMyCode modules.

When should I use Gen Tests?

Gen Tests fits situations like: user wants to create; generate tests for a module.

How do I install Gen Tests in Claude Code?

Run `npx skills add AlphaLab-USTC/OhMyCode --skill gen-tests -a claude-code`. Or copy the skill folder (.claude/skills/gen-tests in AlphaLab-USTC/OhMyCode) into .claude/skills/gen-tests in your project. Claude Code loads it when a task matches its description.

How do I install Gen Tests in Codex?

Run `npx skills add AlphaLab-USTC/OhMyCode --skill gen-tests -a codex`. Or copy the skill folder (.claude/skills/gen-tests in AlphaLab-USTC/OhMyCode) into .agents/skills/gen-tests in your project. Codex loads it when a task matches its description.

Can I use Gen Tests in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add AlphaLab-USTC/OhMyCode --skill gen-tests -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gen-tests, .gemini/skills/gen-tests, .github/skills/gen-tests and .opencode/skills/gen-tests in your project.

What does Gen Tests need to run?

SKILL.md names no scripts, command-line tools or credentials: Gen Tests is instructions for the agent only. Our summary lists: Python 3.

Does Gen Tests access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Gen Tests safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Gen Tests use?

Gen Tests is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Gen Tests use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Gen Tests?

Skills that share tags, products or a category with Gen Tests: Ue Test Authoring (JasonMa0012/MooaToon, 750 stars), Write and Verify Playwright Tests (appsmithorg/appsmith, 41k stars), E2E (callstack/react-native-pager-view, 3.4k stars) and Adk Verify Snippets (google/adk-python, 22k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Gen Tests?

AlphaLab-USTC (a GitHub user) maintains it in AlphaLab-USTC/OhMyCode, which has 131 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on April 2, 2026.

Source: AlphaLab-USTC/OhMyCode on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.