Agent skill

Modularize

by yamcodes in yamcodes/arkenv

Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries.

MITAuto-check passedDevelopment

Install Modularize

skills CLI
$ npx skills add yamcodes/arkenv --skill modularize -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yamcodes/arkenv modularize --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yamcodes/arkenv.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/modularize .claude/skills/modularize && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
modularize
GitHub stars
145
Token cost
~903 tokens
SKILL.md length
414 words
Files
2
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries.

  • Works in 3 steps: Core heuristics & guardrails → Refactoring patterns → Step-by-step workflow
  • The user requests to split a file
  • SKILL.md covers 1. Core heuristics & guardrails, 2. Refactoring patterns and 3. Step-by-step workflow
  • Calls pnpm

What it does

Modularize is an agent skill from yamcodes/arkenv. Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries. Trigger when the user requests to split a file, modularize code, or refactor a large module, and when files exceed size (~200 lines) or complexity guidelines.

Its SKILL.md is about 900 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `evals/evals.json`).

It sits in Development, covering Refactoring. The repository describes itself as: ⛯ Typesafe environment variables with ArkType, Zod, or Valibot. The licence is MIT.

When your agent uses it

  • The user requests to split a file
  • Modularize code
  • Refactor a large module
  • When files exceed size (~200 lines)

Example prompts

  • “/modularize”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Core heuristics & guardrails
  2. Refactoring patterns
  3. Step-by-step workflow

What it can do on your machine

Read from SKILL.md and the folder at commit 7340aa2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Modularize loads about 903 tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 414 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~903

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from yamcodes/arkenv at commit 7340aa2, republished under its MIT licence (© yamcodes). 414 words, ~903 tokens.

Download SKILL.mdSave it as .claude/skills/modularize/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
modularize
description
Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries. Trigger when the user requests to split a file, modularize code, or refactor a large module, and when files exceed size (~200 lines) or complexity guidelines.
metadata.internal
true

Modularize

A skill for automatically refactoring, splitting, and compressing codebase files when they exceed size or complexity boundaries.

1. Core heuristics & guardrails

Rather than enforcing a strict, rigid line count, utilize ~200 lines as a warning light/signal to evaluate logical cohesion and maintainability.

Heuristics to evaluate before refactoring:
  • Logical Cohesion: Does the file focus on one primary concern? Or does it contain independent blocks?
  • Function/Block Size: Prioritize keeping functions small (under 20-30 lines) first.
  • Nesting/Complexity: High cyclomatic complexity/nesting vs. simple flat lists.
  • Fragmentation Risk: Avoid "jump-to-definition" fatigue by not over-splitting cohesive units.
Guardrails:
  • The "Abort" Condition: Skip refactoring if the file is predominantly a configuration dictionary, list of constants, or single massive switch statement that logically belongs together.
  • API Contract Preservation: Maintain public APIs using barrel files (e.g., index.ts) to re-export split modules, preventing breaking changes for consumers.
  • Dependency Injection: Favor passing context via arguments rather than creating tangled relative imports (e.g., ../../../).

2. Refactoring patterns

A. test files

For large test suites (e.g., splitting a 600+ line test file):

  • Split by Behavior/Topic: Group tests into separate files named after the feature or option under test (e.g. coercion.test.ts, arrays.test.ts, options.test.ts, etc.).
  • Shared Setup: Extract common setup, beforeEach/afterEach hooks, mocks, or helper functions into a small local test utility or shared helper file, but only when duplication is real and significant.
  • Run Focused Tests: After splitting, run the affected test suite files individually before running the wider project check.
Show full SKILL.md (177 more words)Show less
B. source modules

For CLI commands, components, or services:

  • Isolate Concerns: Isolate interactive UI prompts, file system adapters, API clients, and terminal reporters into discrete sub-modules.
  • High-Level Orchestrator: Keep the original file purely as a high-level orchestrator that coordinates the sub-modules.
  • Avoid Speculative Abstractions: Avoid creating generic reusable classes/functions before there are multiple active callers. Keep them as local module splits first.

3. Step-by-step workflow

  1. Inspect & Classify: Read the file, identify dependencies/imports, and evaluate heuristics to decide whether to refactor or abort.
  2. Design Boundaries: Formulate a plan for the split. Define clear boundaries, minimal interfaces, and ensure no public contracts are broken.
  3. Incremental Execution: Extract sub-modules or smaller test files in small, logical batches. Check compilation/type-checking at each step.
  4. Update Imports & Exports: Re-wire caller modules, update barrel/index files, and resolve imports cleanly.
  5. Verify: Run the targeted tests, execute typechecking (e.g., pnpm typecheck or pnpm typecheck:packages), run the package build step (e.g., pnpm build or pnpm build:packages) to guarantee ESM/CJS module resolution/exports remain intact, and execute linting and formatting checks (e.g., pnpm fix).

© yamcodes, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/modularize of yamcodes/arkenv.

  • SKILL.md
  • evals/evals.json

Open the folder on GitHubat commit 7340aa2

Compare with similar skills

Modularize next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Modularize compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Modularize this skillyamcodes/arkenv145—~903Automated safety check: PassMIT
Guidelinesakash-network/node1.1k22 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow156k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman41k—~2.6kAutomated safety check: PassGPL-3.0
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.3kAutomated safety check: PassMIT
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT

Similar skills

  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 22 repos~577 tokens
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    156k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    41k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • ast-grep Structural Search

    code-yeongyu/oh-my-openagent

    Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.

    70k GitHub stars~3.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Codex

    skills-directory/skill-codex

    A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    1.5k GitHub starsUsed in 3 repos~1.8k tokens
    DevelopmentAuto-check passed

More from yamcodes/arkenv

All 20 skills in this repo
  • Hallmark

    yamcodes/arkenv

    Anti-AI-slop design skill for greenfield pages, audits, redesigns, and design extraction from URLs or screenshots.

    145 GitHub starsUsed in 4 repos~18k tokens
    Auto-check passed
  • Bulletproof React

    yamcodes/arkenv

    Bulletproof React architecture patterns for scalable, maintainable applications.

    145 GitHub stars~1.8k tokensUpdated 2 days ago
    Auto-check passed
  • Arkenv

    yamcodes/arkenv

    Answer questions about ArkEnv and help implement environment variable validation.

    145 GitHub stars~2.5k tokensUpdated 2 days ago
    Auto-check passed
  • Code Review

    yamcodes/arkenv

    Fetch, analyze, and address code reviews and comments on GitHub, or perform a code review on changes in the workspace.

    145 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Forward Port

    yamcodes/arkenv

    Manually forward-ports merged dev (v0) changes to the v1 branch, adapting code to v1's package layout and changeset names.

    145 GitHub stars~970 tokensUpdated 2 days ago
    Auto-check passed
  • Groom Issue

    yamcodes/arkenv

    Groom a poorly written issue by grilling the user to clarify requirements, updating the issue on GitHub via the gh cli, and utilizing the triage skill to apply the correct label and add an agent…

    145 GitHub stars~1k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Modularize

What does Modularize do?

Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries. Modularize is an agent skill from yamcodes/arkenv. Automatically refactor, split, and compress codebase files when they exceed size or complexity boundaries.

When should I use Modularize?

Modularize fits situations like: the user requests to split a file; modularize code; refactor a large module; when files exceed size (~200 lines).

How do I install Modularize in Claude Code?

Run `npx skills add yamcodes/arkenv --skill modularize -a claude-code`. Or copy the skill folder (skills/modularize in yamcodes/arkenv) into .claude/skills/modularize in your project. Claude Code loads it when a task matches its description.

How do I install Modularize in Codex?

Run `npx skills add yamcodes/arkenv --skill modularize -a codex`. Or copy the skill folder (skills/modularize in yamcodes/arkenv) into .agents/skills/modularize in your project. Codex loads it when a task matches its description.

Can I use Modularize in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yamcodes/arkenv --skill modularize -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/modularize, .gemini/skills/modularize, .github/skills/modularize and .opencode/skills/modularize in your project.

What does Modularize need to run?

Going by SKILL.md and its folder, Modularize needs the command-line tools its instructions call (pnpm).

Does Modularize access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Modularize safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Modularize use?

Modularize is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Modularize use?

About 903 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Modularize?

Skills that share tags, products or a category with Modularize: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 41k stars) and ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Modularize?

yamcodes (a GitHub user) maintains it in yamcodes/arkenv, which has 145 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 5, 2026.

Source: yamcodes/arkenv on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.