Модульная структура Python-кода

engineering

modular-code is a Claude Code skill that guides Python code organization around modularity, targeting a 150–500 line file size sweet spot optimized for both AI code editors and human comprehension. It defines a four-tier scale: 150–500 lines is optimal, 500–1000 warrants looking for natural split points, 1000–2000 requires refactoring into focused modules, and 2000+ is critical and must be split to avoid tooling issues and cognitive overload. Splitting strategies include organizing by domain concept, abstraction layer, data type, or I/O boundary, with a recommended package layout using core.py, models.py, handlers.py, and utils.py. A five-step refactoring workflow covers identifying clusters, extracting incrementally, updating imports, running tests, and documenting changes. The skill is aimed at developers maintaining large Python codebases who want reliable AI-assisted editing and cleaner architecture.