# Standards - Prefer cohesive modules with a single clear responsibility over line-count-only splitting. - Preserve behavior first; do not mix feature work with the refactor. - Avoid one-off abstractions. New modules must reflect real ownership boundaries that the codebase can keep using. - Keep public interfaces stable unless a minimal coordinated update is required. - Exclude generated, vendored, compiled, snapshot, fixture, and lock files from refactor targets unless explicitly treated as source by the repo. - Before editing, check for existing local changes in candidate files and avoid overwriting user work. - Refactor in small, reviewable increments so each target can be validated independently. - Run the smallest relevant test or lint command after each target, then run the broadest available final validation before finishing. - If no automated tests exist for a risky seam, add or strengthen focused tests before or during the refactor when practical. - Keep names, module placement, and imports maintainable and consistent with existing repo conventions. - Remove dead helpers, obsolete re-exports, and temporary scaffolding introduced during the split. - Leave tests green.