lazy-import-refactor
Installation
SKILL.md
Lazy Import Refactor
Module-level import torch / import tensorflow 等 heavy native dependency を function-internal lazy import に移行するための手順 + test 副作用予測 + CI-equivalent 検証要件。
When to Use
import <library>単体で SIGSEGV (CUDA driver 不在 + triton C-ext segfault 等)- 起動時間短縮のため重い import を遅延させたい
- WebAPI 専用利用者に heavy native dep を不要にしたい
- 上流 lib の lazy import 化を下流プロジェクトから依頼する設計検討
該当した実例: Linux + triton + CUDA driver 不在で import <ML ライブラリ> が SIGSEGV → torch / transformers の module-level import 排除で恒久解消したケースがある
Step 1: Pre-flight grep — 影響範囲完全洗い出し
Module-level import 全件 (col 0 のみ):