file-refactor
Installation
SKILL.md
File Refactor Skill
This skill optimizes file sizes by extracting types, utilities, hooks/components, formatters, and constants into separate focused modules. Default target: keep files under 600 lines unless the repo documents a different limit.
When to Trigger
- File exceeds 600 lines (or the repo's documented limit)
- Module has mixed concerns (types, utils, handlers, rendering, constants in one file)
- Screen/component has inline sub-components that could be extracted
- Python service has long pure helpers, dataclasses, or CLI subcommands mixed with orchestration
- File has long utility functions that could be separated
- You need to decouple a monolithic file
Language Routing
| Stack | Typical targets |
|---|---|
| TypeScript / React | types.ts, utils.ts, hooks/, components/, constants.ts |
| Python | models.py, *_format.py, *_sections.py, utils.py, constants.py, thin __init__.py re-exports |