action-pattern

仓库创建 2026年7月4日最近提交 22 天前SkillHot 收录 22 天前
▸ 精选理由

有助于代码组织与测试,适合追求可维护性的团队。

这个 Skill 做什么

将业务逻辑封装为可复用、可组合的单责任 Action 类并使用统一执行约定。

把业务逻辑拆成小而单一职责的 Action 类,每个类只做一件事并遵循统一的 execute() 调用约定,便于组合和复用。比传统的 Service 类更清晰、易测、可组合,能把复杂流程拆成小块管理。适合想提升代码一致性、可测试性和重用性的项目。

▸ 展开 SKILL.md 英文原文

Creating and using action classes to encapsulate business logic. Actions replace traditional Service classes with reusable, composable, single-responsibility classes that follow a consistent `execute()` convention.

开发编程设计模式单一职责可组合通用
0
Stars
0
Forks
23
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ceilidhboy/skills/master/skills/action-pattern/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ceilidhboy/skills/master/skills/action-pattern/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Action Pattern

## Overview

The Action pattern encapsulates business logic into reusable, composable, single-responsibility classes. Actions replace traditional "Service" classes and provide a clean, testable way to organize application behavior.

## Core Principles

### 1. Single Responsibility Principle (SRP)

Each action should have **one reason to change**. If a class is doing multiple things, it should be split into multiple actions, not multiple methods within the same class.

**Key Question**: Does this action have more than one responsibility? If yes, split it into separate actions.

**Note**: This same principle applies to **tasks** in the task list. See [single-task-responsibili
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有