Srp

From SDiamante13/dotfiles · View interactive version

Srp is an AI agent skill from the GitHub repository SDiamante13/dotfiles. Refactor a class toward the Single Responsibility Principle by identifying responsibilities, grouping cohesive behavior, and extracting focused classes. Use when the user says `/srp`, asks for SRP refactoring, or runs `/refactor:srp`.

How to use this skill

Skill file

Refactor the class provided in $ARGUMENTS to adhere to the Single Responsibility Principle by extracting classes and simplifying the design.

Instructions:

  1. Identify all responsibilities within the given class
  2. Group related methods and properties by their cohesive purpose
  3. Extract each responsibility into its own focused class
  4. Consider alternative, simpler designs that make future changes easier
  5. Ensure each resulting class has only one reason to change

Analysis approach:

Common responsibility patterns to separate:

Output format:

  1. Current responsibilities: List each identified responsibility with supporting methods/properties
  2. Proposed class structure:
  1. Refactored design: Show the transformed code structure
  2. Alternative designs: Present 1-2 simpler alternatives if applicable
  3. Benefits: Explain how each extraction improves:

Design principles to apply:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.