Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Vllm Test Generator

ASecurity

Generate test cases for the vllm-project/vllm repository (https://github.com/vllm-project/vllm). Use this skill when the user wants to write unit tests or integration/e2e tests for vllm code, functions, classes, or features. Triggered by requests like "帮我写XXX的测试用例", "生成XXX的单元测试", "为XXX功能写测试", "generate tests for XXX in vllm", "write a test for XXX vllm function". Do NOT use for vllm-ascend — use vllm-ascend-ut-generator instead.

19 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythonbashgitapibackend

Works with

api

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/29/2026

$npx -y skills add shen-shanshan/vllm-dev-skills --skill vllm-test-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vllm Test Generator?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Vllm Test Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/shen-shanshan-vllm-test-generator/badge)](https://www.skillsdirectory.com/skills/shen-shanshan-vllm-test-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: vllm-test-generator
description: Generate test cases for the vllm-project/vllm repository (https://github.com/vllm-project/vllm). Use this skill when the user wants to write unit tests or integration/e2e tests for vllm code, functions, classes, or features. Triggered by requests like "帮我写XXX的测试用例", "生成XXX的单元测试", "为XXX功能写测试", "generate tests for XXX in vllm", "write a test for XXX vllm function". Do NOT use for vllm-ascend — use vllm-ascend-ut-generator instead.
---

# vLLM Test Generator

Generate well-structured tests for [vllm-project/vllm](https://github.com/vllm-project/vllm), following the conventions of the existing test suite.

## Step 1 — Fetch Context

Before writing, fetch the relevant source and existing tests:

```bash
# Browse existing tests for the target area
gh api repos/vllm-project/vllm/contents/tests/<subdir> --jq '[.[] | {name}]'

# Read a representative existing test file
gh api repos/vllm-project/vllm/contents/tests/<path>.py --jq '.content' | base64 -d

# Read the source under test if needed
gh api repos/vllm-project/vllm/contents/vllm/<path>.py --jq '.content' | base64 -d
```

## Step 2 — Classify the Test

| What is being tested | Type | Directory |
|---|---|---|
| Single function / class / method | Unit | `tests/` or matching subdir |
| Config parsing, data structures, utils | Unit | `tests/` root |
| CUDA kernels | Unit | `tests/kernels/` |
| Attention backends | Unit/Integration | `tests/v1/attention/` or `tests/kernels/` |
| Full model inference with LLM class | Integration | `tests/entrypoints/llm/` |
| OpenAI-compatible API | Integration | `tests/entrypoints/openai/` |
| Model correctness (HF vs vLLM) | Integration | `tests/basic_correctness/` or `tests/models/language/` |
| Quantization end-to-end | Integration | `tests/quantization/` |
| LoRA end-to-end | Integration | `tests/lora/` |
| Distributed / multi-GPU | Integration | `tests/distributed/` |
| v1 engine internals | Unit/Integration | `tests/v1/` matching subdir |
| v1 e2e scenarios | Integration | `tests/v1/e2e/general/` |

If the user specifies a directory, use it.

## Step 3 — Write the Test

### License header (required on every file)

```python
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
```

### Unit test pattern

```python
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

from unittest.mock import MagicMock, patch
import pytest

from vllm.<module> import <ClassName>


def test_<function_behavior>():
    # Arrange
    obj = <ClassName>(...)
    # Act
    result = obj.<method>(...)
    # Assert
    assert result == expected


@patch("vllm.<module>.<dependency>")
def test_<function_with_mock>(mock_dep):
    mock_dep.return_value = ...
    result = <function>(...)
    mock_dep.assert_called_once_with(...)
    assert result == expected


class Test<ClassName>:

    def test_<method>(self):
        ...
```

Key rules for unit tests:
- Never load a real model
- Mock external deps (`torch.cuda.*`, network calls, file I/O)
- Use `pytest.raises(ExceptionType)` to test error paths
- Prefer plain `pytest` functions; use classes only when grouping related tests

### Integration test pattern (with LLM class)

```python
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

import weakref
import pytest
from vllm import LLM, SamplingParams
from vllm.distributed import cleanup_dist_env_and_memory

MODEL = "distilbert/distilgpt2"  # use a tiny model

PROMPTS = ["Hello, my name is", "The capital of France is"]


@pytest.fixture(scope="module")
def llm():
    llm = LLM(model=MODEL, max_num_batched_tokens=4096,
               gpu_memory_utilization=0.10, enforce_eager=True)
    yield weakref.proxy(llm)
    del llm
    cleanup_dist_env_and_memory()


@pytest.mark.skip_global_cleanup
def test_<feature>(llm: LLM):
    outputs = llm.generate(PROMPTS, sampling_params=SamplingParams(max_tokens=10))
    assert len(outputs) == len(PROMPTS)
```

### Integration test pattern (HF vs vLLM correctness)

```python
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

import pytest
from ..conftest import HfRunner, VllmRunner
from ..models.utils import check_outputs_equal

MODELS = ["hmellor/tiny-random-LlamaForCausalLM"]


@pytest.mark.parametrize("model", MODELS)
def test_<feature>(hf_runner, vllm_runner, model, example_prompts):
    with hf_runner(model) as hf_model:
        hf_outputs = hf_model.generate_greedy(example_prompts, max_new_tokens=5)
    with vllm_runner(model) as vllm_model:
        vllm_outputs = vllm_model.generate_greedy(example_prompts, max_tokens=5)
    check_outputs_equal(outputs_0_lst=hf_outputs, outputs_1_lst=vllm_outputs,
                        name_0="hf", name_1="vllm")
```

## Step 4 — Choose a Small Model

Always use the smallest suitable model. Prefer these:

| Use case | Model | Size |
|---|---|---|
| General text / any architecture | `distilbert/distilgpt2` | ~117M |
| Tiny random weights (no GPU quality) | `hmellor/tiny-random-LlamaForCausalLM` | <10M |
| Tiny random weights (Gemma2) | `hmellor/tiny-random-Gemma2ForCausalLM` | <10M |
| Real small LLM | `meta-llama/Llama-3.2-1B-Instruct` | 1B |
| Multimodal VLM | `llava-hf/llava-1.5-7b-hf` or smaller VLM | 7B |
| Quantization | `distilbert/distilgpt2` with int8 | ~60M |

Use `gpu_memory_utilization=0.10` to `0.3` and `max_num_batched_tokens≤4096` for integration tests.

## Step 5 — Place the File

- File name: `test_<subject>.py`
- If user didn't specify a directory, use the mapping in Step 2
- Ensure `__init__.py` exists in the target directory (check with `gh api`)

## Step 6 — Update CI (Integration tests only)

vLLM uses **Buildkite** (not GitHub Actions) for its main CI. Configuration lives in `.buildkite/test_areas/*.yaml`.

Find the matching yaml for the test area:

```bash
gh api repos/vllm-project/vllm/contents/.buildkite/test_areas --jq '[.[] | {name}]'
gh api repos/vllm-project/vllm/contents/.buildkite/test_areas/<area>.yaml --jq '.content' | base64 -d
```

Add the new test file to `source_file_dependencies` and `commands` of the relevant step:

```yaml
steps:
- label: Basic Correctness
  source_file_dependencies:
  - vllm/
  - tests/basic_correctness/test_basic_correctness
  - tests/basic_correctness/test_my_new_test.py   # ← add here
  commands:
  - pytest -v -s basic_correctness/test_basic_correctness.py
  - pytest -v -s basic_correctness/test_my_new_test.py          # ← add here
```

If no existing yaml fits, create a new one following the same structure (group, depends_on, steps).

**Unit tests** (no model loading) do NOT need CI changes — they run as part of existing catch-all steps.

## Reference

For detailed annotated examples from the real test suite, see:
- [references/test-patterns.md](references/test-patterns.md) — read when you need a specific pattern (conftest fixtures, parametrize, mock usage, distributed markers)

Attribution

shen-shanshanshen-shanshan
View sourceSee grades on GitHubMore from shen-shanshan →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →