large-file-refactor
Skill6 starsChanged 6 days agoMITView on GitHub
This skill is coordination-exempt: skip the ai-coord gate for its declared work. If a slash or dollar invocation already added these instructions to the conversation, follow them directly. In that case, do not invoke this skill again through a skill tool. Use LOC thresholds to discover candidates, then decide whether a split is justified by cohesion, coupling, ownership, and change risk. Source files match above 1000 LOC. Test files use a relaxed 2000 LOC discovery threshold. 2. Preserve the helper's…
1 other project uses a version of this.
Adopted by
Most recently taken up by
- PaulRBerg/agent-skillsword for word, first seen Oct 24, 2026
Other versions1 project uses a version of this.
Word for word · 1
- PaulRBerg/agent-skills★ 104100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agents-brainSkill
- agents-docsSkill
- agents-introspectionSkill
- agents-systemSkill
- ai-pruneSkill
- apple-device-integrationSkill
- brainstorm-with-meSkill
- chromium-browserSkill
- cli-castSkill
- cli-coingeckoSkill
- cli-ghSkill
- cli-justSkill
- codebase-designSkill
- code-polishSkill
- commitSkill
- copy-transcript-pathSkill
- effect-tsSkill
- evm-atlasSkill
- fresh-eyes-sweepSkill
- frontend-designSkill
- grill-meSkill
- html-playgroundSkill
- interview-meSkill
- naming-refactorSkill
- node-deps-bumperSkill
- orchestrationSkill
- pdfSkill
- release-bumperSkill
- repo-fanoutSkill
- repo-harmonizationSkill
- repo-renameSkill
- retroSkill
- skill-harmonizationSkill
- social-mediaSkill
- spreadsheetsSkill
- tailwind-cssSkill
- task-handoffSkill
- todo-archiveSkill
- tool-finderSkill
- vitestSkill
- wrap-upSkill
- writing-editorSkill
- yeetSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
If a slash or dollar invocation already added these instructions to the conversation, follow them directly.
- Distinctive: line 18
Use LOC thresholds to discover candidates, then decide whether a split is justified by cohesion, coupling, ownership, and change risk.
- Distinctive: line 37
If the helper reports no threshold matches, stop after the report.
- Distinctive: line 46
Use the evidence to choose extraction boundaries, target module names, migration order, and test coverage.
- Very specific: line 65
If a selected file is generated or vendored because --include-generated was used, plan against the generator, schema, or upstream source …
- Distinctive: line 70
Treat the table as the source of truth for size ranking only.
- Distinctive: line 71
Keep the plan cohesive. Do not split solely to reduce line count.
- Distinctive: line 72
Prefer existing project module boundaries and naming conventions.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Large File Refactor
This skill is coordination-exempt: skip the ai-coord gate for its declared work.
If a slash or dollar invocation already added these instructions to the conversation, follow them directly. In that case, do not invoke this skill again through a skill tool.
Use LOC thresholds to discover candidates, then decide whether a split is justified by cohesion, coupling, ownership, and change risk. Source files match above 1000 LOC. Test files use a relaxed 2000 LOC discovery threshold.
Arguments
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.
Workflow
Resolve the skill directory, then run the helper from the target repository:
uv run "<skill-dir>/scripts/large-file-refactor.py" [path] [--include-generated]- 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. When Serena is installed, prefer it:
- Inspect symbol overviews, references, imports, and relevant history.
- Use the evidence to choose extraction boundaries, target module names, migration order, and test coverage.
- This workflow defaults to a report and plan. Implement only when the user's request already authorizes execution or the user subsequently approves it. Do not require a separate request for an unchanged, already authorized outcome.
Refactor Plan Format
For each selected file, include:
- Current role: the file's apparent responsibility and why line count is a symptom.
- Semantic pass: the exact symbol/reference/history inspection to run before moving code.
- Split proposal: 2-5 target modules or files with responsibilities.
- Migration order: small, reviewable steps that preserve public behavior.
- Verification: narrow tests, type checks, builds, or smoke checks that prove the split.
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.
Guard Rails
- Treat the table as the source of truth for size ranking only. Rank refactor priority separately.
- Keep the plan cohesive. Do not split solely to reduce line count.
- Prefer existing project module boundaries and naming conventions.
- Report when the helper used its portable LOC estimate instead of
tokei.
Completion
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

