modularize
/modularize
Dzieli zbyt duże pliki kodu na moduły, gdy przekraczają około 200 linii albo stają się zbyt złożone.
- Autor
- yamcodes ↗
- Repozytorium
- arkenv ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 23.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 23.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Dzieli zbyt duże pliki kodu na moduły, gdy przekraczają około 200 linii albo stają się zbyt złożone.
Oryginalny opis (EN)
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.
Jak działa
- 1. Core heuristics & guardrails
- 2. Refactoring patterns
- 3. Step-by-step workflow
Podgląd SKILL.md
--- 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. ### 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`).
Pliki w paczce (2)
- SKILL.md 4 KB
- evals/evals.json 2 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · yamcodes/arkenv | 90 | MIT |
| anthony-chaudhary/fak | 100 | Apache-2.0 |
| fusengine/agents | 90 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki aaa7cd16676d (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100refactor-plan
Analizuje kod pod kątem duplikacji i złożoności oraz przygotowuje plan działań refaktoryzacyjnych na poziomie kodu. - 100software-design-complexity
Ogranicza złożoność kodu przez głębokie moduły i ukrywanie informacji, gdy API albo klasa stają się zbyt rozbudowane. - 100modularize-brave-browser
Wydziela katalog //brave/browser z monolitu źródeł do osobnych celów nagłówków, implementacji i testów oraz usuwa cykliczne zależności. - 98tl-complexity-assessment
Znajduje duże pliki, przerośnięte moduły i kandydatów do refaktoryzacji w bazach TypeScript, JavaScript i React. - 100modularize-chrome-browser
Wydziela źródła podfolderu chrome/browser/ z monolitycznego celu //chrome/browser:browser do osobnych targetów source_set w pliku BUILD.gn, w ramach Project Bedrock. - 100codebase-organizer
Monitoruje rozmiary plików i dzieli duże pliki na mniejsze moduły przyjazne dla AI, dbając o przechodzące testy przed refaktoryzacją i po niej.