large-file-refactor

large-file-refactor is a skill for Claude Code, Codex from JunMystery/Agent-Guidance-Python. It costs 48 tokens per session (1,123 once invoked), scanned A, original, MIT.

Workflow for refactoring large or monolithic files by responsibility, not by line-count alone. Use when splitting files over 300 LOC, extracting modules, reducing mixed responsibilities, or breaking React components into hooks/subcomponents.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/junmystery/agent-guidance-python/large-file-refactor
Any agent
npx skills add JunMystery/Agent-Guidance-Python --skill large-file-refactor
Clone the repo
git clone --depth 1 https://github.com/JunMystery/Agent-Guidance-Python

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for large-file-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/junmystery/agent-guidance-python/large-file-refactor.svg)](https://agentmods.dev/skills/junmystery/agent-guidance-python/large-file-refactor)
Your own site
<a href="https://agentmods.dev/skills/junmystery/agent-guidance-python/large-file-refactor"><img src="https://agentmods.dev/badge/skills/junmystery/agent-guidance-python/large-file-refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,123 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00048 $0.01123
Opus 5 $0.00024 $0.00562
Sonnet 5 $0.00010 $0.00225
Haiku 4.5 $0.00005 $0.00112

Measured today against content hash 7de6cd910a89, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

large-file-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/large-file-refactor/SKILL.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Large-File Refactor

Use this skill when a task asks to split a large file, reduce a monolithic module, extract services/controllers/helpers, or bring files closer to the 300 LOC guideline.

Core Rule

Split by responsibility, not by line count alone.

Do not cut a file into arbitrary chunks just to satisfy a numeric target. A 320-line cohesive algorithm may be better left intact, while a 260-line file with unrelated validation, persistence, and notification logic may deserve extraction.

Audit Scope

Audit only project-owned source files and project documentation, or a specific file path the user explicitly provided.

When discovering candidate files yourself, use git ls-files or an equivalent tracked-file list as the source of truth. Do not use a raw filesystem walk as the primary source unless repository ignore rules and the exclusions below have already been applied.

Always exclude:

  • .git/, .venv/, venv/, env/, .vscode/, .idea/
  • node_modules/, __pycache__/, .pytest_cache/, .cache/
  • build/, dist/, htmlcov/, coverage reports, and test artifacts
  • generated files, vendored files, externally synchronized files, and binary/media files

If the user provides a specific path, audit that path only. If the path is ignored, vendored, generated, or outside normal project scope, warn about that status and continue only when the user clearly requested that exact file.

For broad requests such as "AI Audit large-file-refactor violations", report only in-scope project candidates. Do not list excluded environment, editor, cache, build, vendor, generated, or binary/media files as violations.

Decision Thresholds

  • <300 LOC: keep the file unless it clearly mixes unrelated responsibilities.
  • 300-500 LOC: recommend splitting only when the file has more than one durable responsibility.
  • >500 LOC: perform an explicit split analysis before implementation.

Count meaningful code first. Ignore blank lines and comments when judging whether the file is truly large.

Read the full file on GitHub · 102 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 102 lines · 48 tokens per session scan A 7de6cd910a89

Subscribe to this mod's changes

large-file-refactor is a skill published in the GitHub repository JunMystery/Agent-Guidance-Python (2 stars, last pushed 1mo ago), licensed MIT. It adds 48 tokens to every session and 1,123 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

n8n-error-handling

Wire n8n error handling so failures are loud, structured, and recoverable. Use when building any webhook/API workflow, a scheduled or unattended workflow, or any path where a silent failure would drop user-visible work — and whenever the user mentions error handling, onError, continueErrorOutput, error…

czlonkowski/n8n-mcp · 128 tokens

n8n-multi-instance

Use when an n8n-mcp account targets more than one n8n instance — i.e. the n8ninstances tool is available, the user mentions multiple n8n instances or environments (prod vs staging, several teams or clients), a workflow / datatable / credential / execution call returns an unexpected NOTFOUND or reads data you don't…

czlonkowski/n8n-mcp · 181 tokens

common-store-changelog

Generate user-facing release notes for the App Store and Google Play from git history (App Store <=4000 chars, Google Play <=500). Use when generating release notes, app store changelog, play store release, or "what's new" text for a mobile app.

HoangNguyen0403/agent-skills-standard · 60 tokens

common-telemetry

Enforce session-cost telemetry and execution-metadata reporting. Use when explicitly invoking getsessioncost, reporting token/cost usage, applying telemetry or cost guidance during a workflow handoff, or writing artifacts/session-cost.md at a workflow terminal state.

HoangNguyen0403/agent-skills-standard · 53 tokens

publish-release

Publish a GitHub release for the C# MCP SDK after a prepare-release PR has been merged. Refreshes release notes to include any PRs merged since preparation, warns about version or breaking change impacts from late-arriving PRs, and creates a draft GitHub release. Use when asked to publish a release, finalize a…

modelcontextprotocol/csharp-sdk · 87 tokens

bulk-update

Update properties or content across many pages in a Notion database with dry-run and error recovery.

n24q02m/better-notion-mcp · 21 tokens