Agent skill

Env Var Conventions

by sgl-project in sgl-project/sglang

Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.

Apache-2.0Auto-check passedDevOps & Cloud

Install Env Var Conventions

skills CLI
$ npx skills add sgl-project/sglang --skill env-var-conventions -a claude-code

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

GitHub CLI
$ gh skill install sgl-project/sglang env-var-conventions --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/sgl-project/sglang.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/env-var-conventions .claude/skills/env-var-conventions && 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
env-var-conventions
GitHub stars
37k
Used in
2 other repos
Token cost
~2.9k tokens
SKILL.md length
1,218 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.

  • Reviewing any SGLANG environment variable (or migrating a legacy SGL alias)
  • SKILL.md covers Rule 1 — Define in the Envs…, Rule 2 — Pick the typed…, Rule 3 — Access via the… and Rule 4 — Naming: SGLANG_…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Touching python/sglang/srt/environ.py

What it does

Env Var Conventions is an agent skill from sgl-project/sglang. Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate. Use when adding, renaming, or reviewing any SGLANG environment variable (or migrating a legacy SGL alias), or when touching python/sglang/srt/environ.py.

Its SKILL.md is about 2.9k 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 DevOps & Cloud, covering Secrets management. It works with SGLang and Python. The repository describes itself as: SGLang is a high-performance serving framework for large language models and multimodal models. The licence is Apache-2.0.

When your agent uses it

  • Reviewing any SGLANG environment variable (or migrating a legacy SGL alias)
  • Touching python/sglang/srt/environ.py

Example prompts

  • “Use the env-var-conventions skill to convention for SGLang environment variables — where to define, how to access, how to name, and how to deprecate”
  • “/env-var-conventions”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit f620d73. 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

Env Var Conventions loads about 2.9k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 1,218 words of instructions outside code blocks.

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

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 sgl-project/sglang at commit f620d73, republished under its Apache-2.0 licence (© sgl-project). 1,218 words, ~2,875 tokens.

Download SKILL.mdSave it as .claude/skills/env-var-conventions/SKILL.md (or your agent's skills folder).
name
env-var-conventions
description
Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate. Use when adding, renaming, or reviewing any `SGLANG_*` environment variable (or migrating a legacy `SGL_*` alias), or when touching `python/sglang/srt/environ.py`.

Environment Variables — Conventions

Apply this skill when adding, renaming, or reviewing any sglang-owned environment variable (SGLANG_*, or a legacy SGL_* alias being phased out), or when touching python/sglang/srt/environ.py.

Rule 1 — Define in the Envs class in python/sglang/srt/environ.py

All sglang-owned env vars live as EnvField descriptors on the Envs class. Never add a new os.getenv("SGLANG_..."), get_bool_env_var("SGLANG_..."), or get_int_env_var("SGLANG_...") call site — the helpers in python/sglang/srt/utils/common.py carry an explicit FIXME: move your environment variable to sglang.srt.environ and exist only for pre-existing call sites.

Group the new entry under an existing section comment (e.g. # Logging Options, # Scheduler: recv interval, # Flashinfer). Add a new section comment only when none fits — never drop a new entry at the bottom of an unrelated block.

Decision table: register in Envs or use os.getenv?
VariableOwnerGoes through Envs?
SGLANG_*sglangAlways. The canonical prefix for all new entries.
MOONCAKE_*, ASCEND_*, DEEP_NORMAL_*, IS_H200, USE_TRITON_W8A8_FP8_KERNEL, HF_HUB_DISABLE_XET, DISABLE_OPENAPI_DOCUpstream/vendor alias that sglang wants to centralizeYes — register in Envs so .get() / .override() work uniformly. Keep the upstream prefix.
CUDA_*, NCCL_*, TORCH_*, OMP_*, HF_HUB_* (raw upstream)External toolingNo. Read with os.getenv — they're set by the launcher / driver, not by sglang.
RANK, LOCAL_RANK, WORLD_SIZE, MASTER_ADDR, MASTER_PORT, HOME, PATHDistributed launcher / OSNo. os.getenv only.
Test runner internals (PYTEST_CURRENT_TEST, etc.)Test frameworkNo. os.getenv only.

SGL_* is not a parallel valid prefix — it's a deprecated legacy alias. _convert_SGL_to_SGLANG rewrites SGL_* to SGLANG_* at import time with a DeprecationWarning. Never define a new SGL_* descriptor or os.getenv("SGL_...") call site; if you see one in code, it's tech debt to migrate.

The rule of thumb: if the value's lifecycle is owned by sglang code (we read it, we may want to override it in tests, we may want to rename it), put it in Envs. If the value is set by something outside sglang and we only consume it as-is, use os.getenv.

Rule 2 — Pick the typed descriptor

TypeUse for
EnvBool(default)boolean flag
EnvInt(default)integer
EnvFloat(default)float
EnvStr(default)string
EnvTuple(())comma-separated list, parsed via s.split(",") and stripped

Default value:

  • For a knob whose "unset" state must be distinguishable from any concrete value, use None as the default (e.g. EnvStr(None), EnvInt(None)). The descriptor handles set-to-None correctly via _set_to_none.
  • For a feature flag, the default encodes the production behavior. ENABLE_FOO = EnvBool(False) means foo is off in prod; DISABLE_FOO = EnvBool(False) means foo is on in prod. See Rule 4 on picking the verb.
IntEnum for multi-state knobs

When a knob has more than two discrete states (e.g. an off / soft / strict ladder), define an IntEnum next to Envs and pass the enum member as the EnvInt default. Callers compare against the enum, not raw integers:

python
class ToolStrictLevel(IntEnum):
    OFF = 0
    FUNCTION = 1
    PARAMETER = 2

SGLANG_TOOL_STRICT_LEVEL = EnvInt(ToolStrictLevel.OFF)

# At the call site:
if envs.SGLANG_TOOL_STRICT_LEVEL.get() >= ToolStrictLevel.PARAMETER:
    ...

Don't pile SGLANG_ENABLE_FOO_STRICT / SGLANG_ENABLE_FOO_OFF boolean knobs that fight each other — one ordered integer is cleaner.

Rule 3 — Access via the EnvField API, never raw os.environ

python
from sglang.srt.environ import envs

if envs.SGLANG_FOO.get():
    ...

envs.SGLANG_FOO is the descriptor itself; its __bool__ and __len__ raise on purpose so that if envs.SGLANG_FOO: fails loudly instead of silently reading as truthy. The .get() is mandatory at every read site.

Full API surface
MethodUse
.get()Read value (parsed). Returns default if unset, or None if explicitly set to None.
.set(value)Set value. set(None) flips the internal _set_to_none flag so the next .get() returns None, not default.
.clear()Unset entirely. Next .get() returns default.
.is_set()True iff the key is present in os.environ (regardless of value, including the explicit-None case).
.override(value)Context manager — set on enter, restore exactly what was there on exit. Use this in tests.

The _set_to_none distinction matters: clear() → is_set()=False, get()=default; set(None) → is_set()=True, get()=None. A few descriptors (e.g. SGLANG_TEST_MAX_RETRY = EnvInt(None), SGLANG_DISAGGREGATION_THREAD_POOL_SIZE = EnvInt(None)) rely on this to distinguish "user opted out" from "default applies".

Test overrides
python
with envs.SGLANG_TEST_RETRACT.override(True):
    ...

Don't mutate os.environ directly in tests — override restores the original cleanly, including the explicit-None state, even if the block raises.

For multiple overrides composed dynamically, use ExitStack:

python
with ExitStack() as stack:
    for name, value in test_envs.items():
        stack.enter_context(getattr(envs, name).override(value))
    run_test()
Subprocess inheritance

override mutates the real os.environ, so child processes spawned inside the with block inherit the override. This is the supported way to seed a subprocess.Popen:

python
with envs.SGLANG_TEST_RETRACT.override(True):
    subprocess.Popen([...]).wait()

A child started outside the with block sees the original value.

temp_set_env is for non-sglang keys only

The module-level temp_set_env(**env_vars) helper exists for overriding non-sglang env vars (e.g. CUDA_LAUNCH_BLOCKING, NCCL_DEBUG) in tests. It explicitly rejects SGLANG_* / SGL_* keys:

python
# Wrong — raises ValueError
with temp_set_env(SGLANG_TEST_RETRACT="true"): ...

# Right — sglang keys go through the descriptor
with envs.SGLANG_TEST_RETRACT.override(True): ...

# Right — non-sglang keys go through temp_set_env
with temp_set_env(CUDA_LAUNCH_BLOCKING="1"): ...

The allow_sglang=True escape hatch exists for the rare case where you must bypass Envs (e.g. setting an env var name that's only constructed at runtime); don't use it just to skip writing a descriptor.

Show full SKILL.md (489 more words)Show less

Rule 4 — Naming: SGLANG_ prefix + verb category

Prefix is always SGLANG_ for new entries. SGL_* is auto-translated to SGLANG_* with a DeprecationWarning in _convert_SGL_to_SGLANG; never add a new SGL_* key.

The second token signals intent. Pick the right verb up front — renames require an alias entry (Rule 5).

VerbMeaningExample
ENABLE_FOOKnob that turns feature foo on/off. Default in the EnvBool encodes prod behavior.SGLANG_ENABLE_TORCH_COMPILE, SGLANG_ENABLE_OVERLAP_PLAN_STREAM
DISABLE_FOOKill-switch. DISABLE_FOO=True turns foo off.SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP
USE_FOOSelects which implementation / backendSGLANG_USE_AITER, SGLANG_USE_DEEPGEMM_BMM
FORCE_FOOOverrides autodetectionSGLANG_FORCE_FP8_MARLIN, SGLANG_FORCE_STREAM_INTERVAL
LOG_FOOLogging-only knobSGLANG_LOG_GC, SGLANG_LOG_MS
TEST_FOOTest-only hookSGLANG_TEST_RETRACT, SGLANG_TEST_MAX_RETRY
DEBUG_FOODebug-only instrumentationSGLANG_DEBUG_MEMORY_POOL, SGLANG_DEBUG_SYMM_MEM
OPT_FOOPerf-optimization toggle (heavily used by DSV4 work)SGLANG_OPT_USE_FUSED_HASH_TOPK, SGLANG_OPT_USE_CUSTOM_ALL_REDUCE_V2

Picking between ENABLE_FOO and DISABLE_FOO: both verbs are valid. The only forbidden combination is DISABLE_FOO = EnvBool(True), because it produces a true double-negative at the call site (if not envs.SGLANG_DISABLE_FOO.get(): reads as "if not disabled"). All other combinations are fine:

PatternCall siteVerdict
ENABLE_FOO = EnvBool(False)if envs.SGLANG_ENABLE_FOO.get():OK — opt-in feature
ENABLE_FOO = EnvBool(True)if envs.SGLANG_ENABLE_FOO.get():OK — on in prod, user opts out via False
DISABLE_FOO = EnvBool(False)if not envs.SGLANG_DISABLE_FOO.get():OK — single negation, reads as "if enabled"
DISABLE_FOO = EnvBool(True)if not envs.SGLANG_DISABLE_FOO.get():Forbidden — true double-negative

SGLANG_* is the canonical sglang prefix. Vendor-integration keys (MOONCAKE_*, ASCEND_*, DEEP_NORMAL_*, IS_H200) keep their upstream prefix and live in the same Envs class — these are integration aliases, not sglang-owned feature flags.

Rule 5 — Renames go through *WithAlias or _print_deprecated_env

For a rename where the old key must keep working with a warning:

python
SGLANG_NEW_NAME = EnvBoolWithAlias(True, deprecated_name="SGLANG_OLD_NAME")

Use EnvBoolWithAlias / EnvIntWithAlias. The fallback emits a DeprecationWarning and copies the old value over.

For a full removal where the env var is going away, add to _convert_SGL_to_SGLANG:

python
_print_deprecated_env("SGLANG_OLD_NAME", "SGLANG_NEW_NAME")  # mapped to a replacement
_print_deprecated_env("SGLANG_OLD_NAME")                     # no replacement, gone

For env-var to CLI-flag migration, add at module top-level:

python
_warn_deprecated_env_to_cli_flag(
    "SGLANG_FOO",
    "Please use '--foo' instead.",
)

Don't silently flip a default during a rename. If the new default disagrees with the old one, that's a behavior change — call it out in the PR body separately from the rename.

Rule 6 — Env var vs CLI flag

If the knob is…Goes in
User-facing (documented, expected to flip per deployment)server_args.py CLI flag
Expert toggle, A-B kill-switch, vendor integrationenviron.py env var
Test / debug hookenviron.py env var with TEST_ / DEBUG_ prefix
Temporary env var rolling out to a CLI flagenv var first, then migrate via _warn_deprecated_env_to_cli_flag

Don't add a CLI flag that just forwards to an env var, and don't add an env var that duplicates an existing CLI flag. Pick one surface.

Out of scope

  • External / vendor env vars consumed raw (HF_HUB_*, CUDA_*, NCCL_*, TORCH_*, OMP_*, RANK, MASTER_ADDR, etc.): see the decision table in Rule 1 — os.getenv is correct, don't pull them into Envs.
  • Pre-existing get_bool_env_var(...) / get_int_env_var(...) call sites: leave them as is; new code shouldn't add more, but mass-migration is out of scope for a feature PR.
  • Upstream-aliased keys already in Envs (MOONCAKE_*, ASCEND_*, DEEP_NORMAL_*, IS_H200, USE_TRITON_W8A8_FP8_KERNEL, HF_HUB_DISABLE_XET, DISABLE_OPENAPI_DOC — see Rule 1 decision table): the SGLANG_ prefix rules in Rule 4 don't apply — the upstream prefix is the canonical name.

© sgl-project, Apache-2.0. 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 .agents/skills/env-var-conventions of sgl-project/sglang.

Open the folder on GitHubat commit f620d73

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in sgl-project/sglang, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Env Var Conventions 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.

Env Var Conventions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Env Var Conventions this skillsgl-project/sglang37k2 repos~2.9kAutomated safety check: PassApache-2.0
Flow Contextflowexec/flow137—~654Automated safety check: PassApache-2.0
Hyperloom SetupAMD-AGI/Hyperloom218—~7.2kAutomated safety check: NotesCustom licence
Python Configurationwshobson/agents40k—~1.6kAutomated safety check: NotesMIT
Azurekid-sid/claude-spellbook190—~3.7kAutomated safety check: NotesMIT
Env Managerbobmatnyc/claude-mpm155—~3.9kAutomated safety check: NotesCustom licence

Similar skills

  • Flow Context

    flowexec/flow

    This project uses flow for automation. An agent skill from flowexec/flow.

    137 GitHub stars~654 tokensUpdated 7 days ago
    DevOps & CloudAuto-check passed
  • Hyperloom Setup

    AMD-AGI/Hyperloom

    Configures Hyperloom after pip install --target . An agent skill from AMD-AGI/Hyperloom.

    218 GitHub stars~7.2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Python Configuration

    wshobson/agents

    Python configuration management via environment variables and typed settings.

    40k GitHub stars~1.6k tokensUpdated 4 days ago
    DevOps & CloudAuto-check: notes
  • Azure

    kid-sid/claude-spellbook

    A skill your agent uses when writing Python code that integrates with Azure Blob Storage, AI Search, Document Intelligence, or Key Vault — or when configuring Managed Identity auth, designing a…

    190 GitHub stars~3.7k tokensUpdated 2 mo ago
    DevOps & CloudAuto-check: notes
  • Env Manager

    bobmatnyc/claude-mpm

    Environment variable validation, security scanning, and management for Next.js, Vite, React, and Node.js applications

    155 GitHub stars~3.9k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check: notes
  • A skill your agent uses when the user says 'deploy to Railway', 'Railway setup', 'railway-deploy', or needs to deploy a Node.js, Python, or Docker application to Railway with environment variables…

    423 GitHub stars~2.1k tokensUpdated 13 days ago
    DevOps & CloudAuto-check passed

More from sgl-project/sglang

All 32 skills in this repo
  • Sglang Prod Incident Triage

    sgl-project/sglang

    Replay-first debug flow for SGLang serving problems. An agent skill from sgl-project/sglang.

    37k GitHub starsUsed in 3 repos~2.1k tokens
    Auto-check passed
  • LLM Torch Profiler Analysis

    sgl-project/sglang

    Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.

    37k GitHub starsUsed in 2 repos~6.4k tokens
    Auto-check passed
  • Babysit PR To Pass CI

    sgl-project/sglang

    Start and persistently pursue a goal to babysit an SGLang pull request until selected GitHub Actions workflows pass on the latest PR head.

    37k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Compute Mamba Ratio

    sgl-project/sglang

    Compute the optimal --mamba-full-memory-ratio (or --max-mamba-cache-size pin) for a hybrid attention + linear-attention (Mamba / GDN / KDA) model's two serving memory pools, from the workload and…

    37k GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed
  • Debug Distributed Hang

    sgl-project/sglang

    Debug hanging issues in SGLang distributed inference (TP/PP/DP/EP).

    37k GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • Kl Consistency Test

    sgl-project/sglang

    Write, calibrate, and debug the prefill-vs-decode logprob (KL) consistency tests in sglang -- the two independent conditions a zero requires (every operator batch-invariant, and the two paths…

    37k GitHub starsUsed in 2 repos~3.7k tokens
    Auto-check passed

Works with

Categories

Questions about Env Var Conventions

What does Env Var Conventions do?

Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate. Env Var Conventions is an agent skill from sgl-project/sglang. Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.

When should I use Env Var Conventions?

Env Var Conventions fits situations like: reviewing any SGLANG environment variable (or migrating a legacy SGL alias); touching python/sglang/srt/environ.py.

How do I install Env Var Conventions in Claude Code?

Run `npx skills add sgl-project/sglang --skill env-var-conventions -a claude-code`. Or copy the skill folder (.agents/skills/env-var-conventions in sgl-project/sglang) into .claude/skills/env-var-conventions in your project. Claude Code loads it when a task matches its description.

How do I install Env Var Conventions in Codex?

Run `npx skills add sgl-project/sglang --skill env-var-conventions -a codex`. Or copy the skill folder (.agents/skills/env-var-conventions in sgl-project/sglang) into .agents/skills/env-var-conventions in your project. Codex loads it when a task matches its description.

Can I use Env Var Conventions 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 sgl-project/sglang --skill env-var-conventions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/env-var-conventions, .gemini/skills/env-var-conventions, .github/skills/env-var-conventions and .opencode/skills/env-var-conventions in your project.

What does Env Var Conventions need to run?

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

Does Env Var Conventions 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 Env Var Conventions 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 Env Var Conventions use?

Env Var Conventions is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Env Var Conventions use?

About 2.9k tokens (SKILL.md is roughly 12k 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 Env Var Conventions?

Skills that share tags, products or a category with Env Var Conventions: Flow Context (flowexec/flow, 137 stars), Hyperloom Setup (AMD-AGI/Hyperloom, 218 stars), Python Configuration (wshobson/agents, 40k stars) and Azure (kid-sid/claude-spellbook, 190 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Env Var Conventions?

sgl-project (a GitHub organization) maintains it in sgl-project/sglang, which has 36,907 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 9, 2026.

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