← スキル一覧に戻る

create-action
by hieupvXmasEve
⭐ 0🍴 0📅 2026年1月6日
SKILL.md
name: create-action description: Generates a new business logic Action class following the Modular Monolith pattern. Use when implementing a new feature or moving logic out of a controller (e.g., "Create an action to register students"). allowed-tools: Write, Read
Create Business Action
This skill generates a standardized Action class for business logic, ensuring consistent naming and structure.
Instructions
-
Identify Parameters:
- Module: The domain module (e.g.,
Identity,Academic). - Entity: The object being acted upon (e.g.,
Student,Course). - Verb: The operation (e.g.,
Register,Update,Cancel). - Class Name:
{Verb}{Entity}Action(e.g.,RegisterStudentAction).
- Module: The domain module (e.g.,
-
Determine Path:
app/Modules/{Module}/Actions/{ClassName}.php
-
Generate Code:
- Namespace:
App\Modules\{Module}\Actions - Method:
public static function run(...) - Strict typing.
- Transaction handling if writing to DB.
- Namespace:
Template
<?php
namespace App\Modules\Identity\Actions;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use App\Modules\Identity\DTO\StudentRegistrationData; // Example DTO usage if applicable
class RegisterStudentAction
{
/**
* Execute the action.
*
* @param array $data Validated data from Request
* @return User
*/
public static function run(array $data): User
{
return DB::transaction(function () use ($data) {
// Business logic here
// 1. Create User
// 2. Assign Role
// 3. Dispatch Events
return $user;
});
}
}
Best Practices Reminders
- No Validation: Validation happens in FormRequests before calling this Action.
- No HTTP: Do not return
response()orredirect()from here. Return data or throw exceptions. - Single Responsibility: One action per business use case.
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です