modularize

Refactors monolithic Go source code into modular, behavior-preserving units with automated verification.

30|12|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/anthony-chaudhary/fak --skill modularize-anthony-chaudhary
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modularize
Source: https://github.com/anthony-chaudhary/fak/tree/main/.claude/skills/modularize
Command: npx skills add https://github.com/anthony-chaudhary/fak --skill modularize-anthony-chaudhary

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires goimports, gofmt, and includes scripts (resource) components.

What problem does it solve?

This skill addresses the accumulation of architectural debt in large Go codebases, specifically targeting god-files and god-functions that hinder maintainability and code quality.

Core Features & Use Cases

  • Behavior-Preserving Refactoring: Uses automated planning and verification to split large files and functions along real concern seams without altering program logic.
  • Automated Verification: Employs a suite of tools to prove that no declarations were dropped and that the refactored code remains functionally identical to the original.
  • Use Case: When a core package in the kernel exceeds 1500 lines, use this skill to safely extract cohesive concerns into new files, improving the architecture KPI and reducing code debt.

Quick Start

Invoke the modularize skill to identify and split the heaviest architecture defect in the current package.

Frequently Asked Questions about modularize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split a monolithic Go source file without changing program behavior?

Behavior-preserving refactoring uses automated planning and verification to split large files and functions along real concern seams. It proves no declarations were dropped and the refactored code remains functionally identical to the original.

When do I need to refactor a god-file in a Go codebase?

You should refactor a god-file when architectural debt hinders maintainability and code quality. Specifically, when a core package in the kernel exceeds 1500 lines, extract cohesive concerns into new files to reduce code debt.

What is the best way to verify no declarations were dropped during a Go refactoring?

The best way to verify no declarations were dropped during Go refactoring is to use an automated verification suite. This validates declaration-set preservation, build-tag safety, and initialization-order integrity through integrated toolchain validation.

Does the modularize refactoring process require goimports and gofmt?

Yes, the modular refactoring process requires goimports and gofmt as dependencies. These tools format the code and manage imports automatically when splitting large Go files and functions into concern-based components.

Can I extract cohesive concerns from a monolith while maintaining build-tag safety?

Yes, you can extract cohesive concerns from a monolith while maintaining build-tag safety. The refactoring process satisfies technical requirements for declaration-set preservation and initialization-order integrity through toolchain validation.

What are the limitations of automated code motion for modularizing Go functions?

Automated code motion for modularizing Go functions requires strict adherence to behavior-preserving refactoring standards. It is limited by the need to maintain declaration-set preservation, build-tag safety, and initialization-order integrity.