本文へ移動
cccskills
無料GitHub で公開

srp

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`.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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:

  • Identify responsibilities by:
    • Methods that serve different actors/users
    • Distinct areas of functionality
    • Different reasons for change
    • Unrelated data and behavior groupings
    • Infrastructure vs domain logic separation
    • I/O operations vs business logic

Common responsibility patterns to separate:

  • Data persistence/storage from business logic
  • Validation logic from core behavior
  • Formatting/presentation from domain logic
  • External service communication from internal logic
  • Configuration from implementation
  • Factory/creation logic from usage
  • Orchestration/coordination from execution
  • Logging/metrics from business operations

Output format:

  1. Current responsibilities: List each identified responsibility with supporting methods/properties
  2. Proposed class structure:
    • Name and purpose of each extracted class
    • Methods and properties it would contain
    • Clear single responsibility statement
  3. Refactored design: Show the transformed code structure
  4. Alternative designs: Present 1-2 simpler alternatives if applicable
  5. Benefits: Explain how each extraction improves:
    • Testability
    • Maintainability
    • Flexibility for change
    • Code clarity

Design principles to apply:

  • Prefer composition over inheritance
  • Keep classes small and focused
  • High cohesion within classes
  • Low coupling between classes
  • Clear, single purpose for each class
  • Consider using interfaces for flexibility

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

catchup

無料

Rebuilds session context after a clear by reading git history, plans, and beads state. Triggers on 'catch up'.

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

changelog

無料

Generate a bullet-point summary of branch changes for a PR description. Triggers on "changelog", "pr summary", "summarize branch", or "/changelog".

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

commit

無料

Commit the current changes with quality checks, status review, staged diff inspection, appropriate tests, and a clear commit message. Use when the user says "commit", "c", asks to make a commit, or wants changes saved in git.

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

declutter

無料

Refactor code to remove dead code, useless comments, unused variables, and unused imports. Use when asked to declutter a class, clean up noisy code, remove cruft, or run `/refactor:declutter`.

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

dry

無料

Refactor duplicated code by extracting helpers, shared abstractions, or clearer reusable structure. Use when asked to apply DRY, remove duplication, consolidate repeated logic, or run `/refactor:dry`.

日本語の概要は準備中です。原文の説明を表示しています。

SDiamante13/dotfiles82026年10月2日 更新

SDiamante13 のスキルをすべて見る

このスキルの問題を報告する