skills/large-file-refactor/SKILL.md
Discover large source-file refactor candidates and propose cohesion- and risk-driven split plans using available semantic tooling.
npx skillsauth add paulrberg/dot-agents large-file-refactorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use LOC thresholds to discover candidates, then decide whether a split is justified by cohesion, coupling, ownership, and change risk. Test files use a relaxed 2000 LOC discovery threshold.
path: Optional file or directory to scan. Default: current working directory.--include-generated: Include generated, vendored, dependency, and build-output paths that are skipped by default.Resolve the skill directory, then run the helper from that directory:
uv run scripts/large-file-refactor.py "$ARGUMENTS"
If no arguments were provided, run the default scan:
uv run scripts/large-file-refactor.py
Preserve the helper's Markdown table as the exhaustive report. Do not omit matching rows, even when the refactor plan only covers a subset.
If the helper reports no threshold matches, stop after the report. A match is a candidate, not proof that the file should be split.
Draft a refactor plan for the 3 largest files only, unless the user explicitly requested another count.
For each candidate, rank split value by mixed responsibilities, change frequency/risk, coupling, and testability. Use whichever semantic symbol/reference tooling is available; prefer Serena when installed:
Do not implement the refactor unless the user separately asks for execution.
For each selected file, include:
Lead each plan with one explicit verdict: ### ✂ Split justified, ### 🧱 Keep intact, or
### ⚠️ Generated — change the generator. Use a compact evidence table for repeated criteria. When proposing a split,
show the source and target modules as a tree only when it clarifies ownership.
If a selected file is generated or vendored because --include-generated was used, plan against the generator, schema,
or upstream source instead of hand-splitting generated output.
tokei.Complete with the exhaustive threshold report plus evidence-ranked plans only for candidates whose cohesion or change
risk justifies a split. Lead with ### 🔎 Large-file scan — <candidate count>, state when a large file should remain
intact and why, and surface the portable-LOC fallback as ⚠️ Approximate counts when used. Keep the helper's exhaustive
table, paths, LOC values, and commands exact and undecorated.
development
Refactor naming and repository structure exhaustively while preserving behavior and external contracts.
tools
Uses Chrome DevTools via MCP for efficient debugging, troubleshooting and browser automation. Use when debugging web pages, automating browser interactions, analyzing performance, or inspecting network requests. This skill does not apply to `--slim` mode (MCP configuration).
testing
Audit an entire repository with fresh eyes for correctness errors, bugs, omissions, duplication, inconsistencies, and other evidenced mistakes; fix every safe issue and verify the result.
development
Autonomous overnight codebase improvement with bounded runtime, evidence-gated changes, and verification.