sglang: Skill for Claude Code

.claude/skills/write-sglang-test/SKILL.md

write-sglang-test is a skill for Claude Code from sgl-project/sglang. It costs 88 tokens per session (5,996 once invoked), scanned A, original, Apache-2.0.

A guide for writing and registering SGLang tests. It covers unit tests, which check small pieces of code, and integration tests, which check components working together, including tests that launch an inference server.

In plain words
What is it for?
Use it to create CI and unit tests, register test cases, choose server fixtures, test configuration or request logic with mocks, and place tests in the correct directories.
Why use it?
It helps tests fit the project's continuous-integration system and avoids resource leaks when setup fails. It also encourages mocks when a real server is unnecessary, making tests simpler.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is sgl-project/sglang's own configuration. It tells Claude Code how to work on sglang itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything sglang configures →

About the project

SGLang is a framework for running inference for large language models and multimodal models, meaning it processes inputs to produce model outputs such as text or other media. It is used to serve and accelerate open AI models and related workloads.

sgl-project/sglang · 35,615 stars · on GitHub · sglang.io

Reuse

Borrowing it

Nothing to install: this file belongs to sgl-project/sglang. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/sgl-project/sglang/main/.claude/skills/write-sglang-test/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/sgl-project/sglang

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for write-sglang-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/write-sglang-test/github.svg)](https://agentmods.dev/skills/sgl-project/sglang/write-sglang-test)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/write-sglang-test"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/write-sglang-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for write-sglang-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/sgl-project/sglang/write-sglang-test"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/write-sglang-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,996 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 7 Sept 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 225
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 275
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
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.1 $0.00088 $0.05996
Opus 5 $0.00044 $0.02998
Sonnet 5 $0.00018 $0.01199
Haiku 4.5 $0.00009 $0.00600

Measured today against content hash af716dea54a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

write-sglang-test scanned grade A with 1 finding 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 today.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.post(
.claude/skills/write-sglang-test/SKILL.md · 458 lines

How it starts

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

Writing SGLang CI / UT Tests

This skill covers how to write and register tests. For CI pipeline internals (stage ordering, fast-fail, gating, partitioning, debugging CI failures), see the CI workflow guide.

Core Rules

  1. Always use CustomTestCase — never raw unittest.TestCase. It ensures tearDownClass runs even when setUpClass fails, preventing resource leaks in CI.
  2. tearDownClass must be defensive — use hasattr/null checks before accessing resources (e.g. cls.process) that setUpClass may not have finished allocating.
  3. Place tests in test/registered/<kind>/<subsystem>/<kind> is unit, kernel, e2e, accuracy, perf, or stress; hardware belongs in registrations, not directory names
  4. Reuse server fixtures — inherit from DefaultServerBase or write setUpClass/tearDownClass with popen_launch_server
  5. Mock boundaries, not SGLang behavior — mock slow or external dependencies only when the assertion still checks an observable result, state transition, or error. A test whose evidence is only assert_called* mirrors its mock and is not admissible. Launch a real server only when inference results or lifecycle behavior are the contract under test.

JIT kernel notes:

  • If the task is adding or updating code under python/sglang/kernels/jit/, prefer the add-jit-kernel skill first.
  • New JIT kernel correctness tests use test/registered/kernel/jit/**/test_*.py.
  • New JIT kernel benchmarks use test/registered/kernel/jit/benchmark/**/bench_*.py.
  • Those files are executed by test/run_suite.py through dedicated kernel suites (base-b-kernel-*); a register_*_ci(...) call placed under python/sglang/ is rejected by the check-no-registered-tests-in-package pre-commit hook.

Model & Backend Selection

Scenario Model CI Registration Suite
Unit tests (no server / engine launch) None register_cpu_ci base-a-test-cpu
Common / backend-independent (middleware, abort, routing, config, arg parsing) DEFAULT_SMALL_MODEL_NAME_FOR_TEST (1B) register_cuda_ci only base-b-test-1-gpu-small
Model-agnostic functionality (sampling, session, OpenAI API features) DEFAULT_SMALL_MODEL_NAME_FOR_TEST (1B) register_cuda_ci (+ AMD if relevant) base-b-test-1-gpu-small
General performance (single node, no spec/DP/parallelism) DEFAULT_MODEL_NAME_FOR_TEST (8B) register_cuda_ci base-b-test-1-gpu-large
Bigger features (spec, DP, TP, disaggregation) Case by case Case by case See suite table below

Read the full file on GitHub · 458 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. today Changed · +4 lines af716dea54a3
  2. 9d ago First seen · 454 lines · 88 tokens per session scan A 9a916274d5d0

Subscribe to this mod's changes

write-sglang-test is a skill published in the GitHub repository sgl-project/sglang (35,615 stars, last pushed today), licensed Apache-2.0. It adds 88 tokens to every session and 5,996 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories