large-class-style
Installation
SKILL.md
Code Style for Scheduler / TokenizerManager / ModelRunner
Conventions for SGLang's three large classes:
Scheduler—python/sglang/srt/managers/scheduler.pyTokenizerManager—python/sglang/srt/managers/tokenizer_manager.pyModelRunner—python/sglang/srt/model_executor/model_runner.py
1. Frozen Code
- Some core files are frozen: orchestration-only — a thin composition root that constructs collaborators, wires them, delegates to them, and coordinates the calls. They must stay that way.
- Domain logic does not belong in a frozen file; it lives in a collaborator class in its own module.
1.1 Why
- The file is a thin orchestrator over collaborator classes; freezing keeps it that way and stops it growing back into a god class.
- Keeping domain logic in collaborators (their own files) is what makes per-file code ownership, single responsibility, and unit testing possible.
- The orchestrator is the composition root: it may know about every collaborator, because wiring and sequencing them is its job. Coordination stays here — domain logic does not.