MCPInstall

large-file-refactor

Discover large source-file refactor candidates and propose split plans based on cohesion and risk, using available semantic tooling.

Installs
67
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/paulrberg/agent-skills --skill large-file-refactor
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads large-file-refactor automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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

  1. Resolve the skill directory, then run the helper from the target repository:

    uv run "<skill-dir>/scripts/large-file-refactor.py" [path] [--include-generated]
    
  2. Preserve the helper's Markdown table as the exhaustive report. Do not omit matching rows, even when the refactor plan only covers a subset.

  3. If the helper reports no threshold matches, stop after the report. A match is a candidate, not proof that the file should be split.

  4. Draft a refactor plan for the 3 largest files only, unless the user explicitly requested another count.

  5. 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.
  6. 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.

FAQ

What does the large-file-refactor skill do?

Discover large source-file refactor candidates and propose split plans based on cohesion and risk, using available semantic tooling.

How do I install large-file-refactor?

Run npx skills add https://github.com/paulrberg/agent-skills --skill large-file-refactor in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/large-file-refactor/ (personal) or .claude/skills/large-file-refactor/ (project).

Which AI agents can use large-file-refactor?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is large-file-refactor safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains large-file-refactor?

It is published by paulrberg in paulrberg/agent-skills. It has 67 recorded installs.

More from paulrberg/agent-skills

View all →

effect-ts

paulrberg/agent-skills

Use for nontrivial Effect 4 work including services/layers, typed errors, Schema/JsonSchema, Config, runtime/concurrency, @effect/vitest, effect/ai and @effect/ai-, effect/sql and @effect/sql-, Effect Atom (@effect/atom-), or @prb/effect-next.

Data & Databases3.1K installs

tailwind-css

paulrberg/agent-skills

Use for Tailwind v4 styling: add/fix classes, configure or migrate Tailwind, use tailwind-variants, or tw-animate-css.

cli-gh

paulrberg/agent-skills

Use for GitHub CLI automation: repository reads, workflow runs, search, codespaces, releases, configuration, or gh command syntax. Use yeet for contribution writes to PRs, issues, comments, or discussions.

code-polish

paulrberg/agent-skills

Polish changed code when the user explicitly asks, or when an active workflow requests post-implementation simplification and risk-profiled review over a fixed file scope.

AI & Agents2.8K installs

yeet

paulrberg/agent-skills

Use for GitHub PR/issue/discussion workflows: create/update PRs, issues, or discussions and post issue or discussion comments; triggers include yeet.

AI & Agents2.6K installs

bump-release

paulrberg/agent-skills

Cut a release: bump versions, write changelogs, commit, tag.

AI & Agents2.4K installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.