service-pattern-generator

Transform fat controllers into thin controllers with service and repository layers.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/KILWA73/MiniSoc --skill service-pattern-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service-pattern-generator
Source: https://github.com/KILWA73/MiniSoc/tree/main/.agents/skills/service-pattern-generator
Command: npx skills add https://github.com/KILWA73/MiniSoc --skill service-pattern-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Fat controllers hide business logic and data access, making maintenance and testing difficult. This Skill guides extracting rules into a dedicated Service layer and moving data access into a Repository, enabling thin controllers and easier testing.

Core Features & Use Cases

  • Refactor workflow: identify validation, business logic, and queries in controllers, and move them into a Service and Repository layer.
  • Architecture clarity: provides a clean separation of concerns, improved testability, and easier maintenance.
  • Use Case: convert a monolithic controller into a modular, testable pattern with dependency injection wiring.

Quick Start

Provide a scalable Service and Repository skeleton wired via dependency injection for the selected controller.

Frequently Asked Questions about service-pattern-generator

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

FAQPage Schema
How do I refactor a fat controller into a thin controller with a service and repository layer?

Refactoring a fat controller involves extracting validation and business logic into a service layer and moving data access into a repository. This Skill guides that transformation to output clean controllers with dependency injection wiring for PHP and TypeScript projects.

What is the repository and service layer pattern for separating business logic?

The service and repository pattern separates concerns by moving data access into repositories and rules into services. This creates thin controllers that handle HTTP requests, resulting in improved testability and easier maintenance for monolithic codebases.

Can I use this service layer refactoring approach with both PHP and TypeScript projects?

Yes, this service layer refactoring approach applies to codebases in both PHP and TypeScript projects. It guides the extraction of queries and rules from monolithic controllers to generate modular, testable service and repository classes.

What's the best way to set up dependency injection when extracting business logic into a service class?

The best way to set up dependency injection is by wiring the repository into the service and the service into the controller. This Skill provides scalable skeletons and guidance for dependency injection to ensure clean separation of concerns.

Why should I move data access queries out of my controllers into a separate repository?

Moving data access queries into a separate repository hides data access details from the controller. This separation enables easier testing of business logic in the service layer without direct database dependencies, simplifying maintenance.