Refactoring & Modernization
Compatible with Cursor, Claude Code, Cline, Roo Code, Antigravity

God Class & Monolithic Method Decomposition (SOLID)

Decompose monolithic 1,000+ line classes into Single Responsibility components using SOLID design patterns.

Design PatternsSOLIDOOPRefactoringClean Architecture
Skill Objective

Decompose monolithic classes into decoupled, Single Responsibility components adhering to SOLID principles with clean dependency injection.

Execution Workflow Procedure

Ordered steps the coding agent executes when performing this skill.

1

Map Domain Responsibilities

Group the methods and state of the God Class into distinct concerns (e.g. Auth, Billing, Notifications, Persistence).

2

Extract Interfaces & Services

Define clean interfaces for each extracted domain service and wire them via constructor dependency injection.

3

Preserve Facade Backward Compatibility

Retain the original class as a thin delegating Facade to ensure existing callers remain completely unaffected.

Agent Safety Guardrails & Anti-Hallucination Rules

  • DO NOT break existing public method signatures; delegate to new services through the existing facade.
  • DO NOT create circular dependencies between extracted services.

Expected Output Format

Extracted services, interface contracts, and the updated delegating facade.

📐 Responsibility Breakdown: Mapping of extracted service boundaries.
🛠️ Extracted Service Implementations: Clean, decoupled component classes.

Domain Verification Checks

Single Responsibility (SRP): Ensures each extracted service has only one reason to change.
Interface Segregation (ISP): Clients depend only on minimal methods they call.
Facade Compatibility: Preserves existing entry points.

Example Agent Invocations

"Decompose this 1,200-line UserManager class into discrete authentication, notification, and billing services."
"Break apart this monolithic checkout controller using the Facade and Strategy patterns."

Install / Configure This Skill

# Place in .cursorrules or create .cursor/rules/god-class-solid-decomposition.mdc
# Trigger: Whenever you perform god class & monolithic method decomposition (solid)

---
name: god-class-solid-decomposition
description: Deconstruct 1,000+ line monolithic classes into decoupled SOLID services using Facade and Strategy patterns.
version: 1.0.0
compatibility: [Cursor, Claude Code, Cline, Roo Code, Antigravity]
---

# God Class & Monolithic Method Decomposition (SOLID)

## Objective
Split oversized classes into focused, single-responsibility components while preserving backward compatibility.

## Workflow
1. **Responsibility Grouping**: Cluster methods by domain concern (Auth, Billing, Storage, Email).
2. **Service Extraction**: Extract interfaces and implementations with dependency injection.
3. **Facade Delegation**: Retain the original class as a thin facade delegating to the new services.
Complementary Agent Prompt

Need a quick one-time prompt for chat?

Try the God Class & Long Method Decomposition with Design Patterns — a lightweight version designed for 1-click copying directly into Claude, ChatGPT, or Cursor chat.

View Prompt

SprintKit Workflow Integrations

Complementary tools and checklists to pair with this agent workflow.

Related Agent Skills

Explore related procedural workflows in this discipline.

All Skills

Safe Legacy Code Modernization with Golden Master Tests

Safely modernize fragile legacy codebases using Martin Fowler refactoring patterns and characterization tests.

RefactoringClean CodeDesign Patterns+1
4 workflow stepsView skill

Layered Monolith to Hexagonal / Clean Architecture Refactor

Refactor tangled MVC controllers and service layers into Clean Architecture (Ports & Adapters).

Clean ArchitectureHexagonalDDD+2
3 workflow stepsView skill

Spring Boot Service & JPA Code Review

Rigorous code review workflow for Spring Boot services examining transactions, JPA queries, concurrency, and validation.

JavaSpring BootJPA+3
5 workflow stepsView skill