← Back to list

scaffold-service
by iurygdeoliveira
Repositorio destinado a fornecer um kit inicial para desenvolvimento de SaaS usando laravel e filament
⭐ 29🍴 12📅 Jan 20, 2026
SKILL.md
name: scaffold-service description: Creates or refactors Business Logic into Service classes using MCP-Aware standards.
Service Pattern Skill
Use this skill to encapsulate complex business logic, keeping Controllers/Livewire components "thin". This is the Business Logic Layer of the application.
When to use this skill
- When a Controller/Component method exceeds 10 lines of logic.
- When logic is reused across multiple entry points (API + Web + Console).
- When implementing complex domain features (e.g., Checkout, Subscription).
Recommended Tools
- serena_find_referencing_symbols: MANDATORY when refactoring. Check where the code is currently called to avoid breaking changes.
- laravel_boost_search_docs: Check for specific Laravel helpers (e.g.,
DB::transaction,Pipeline) if the logic involves flow control.
Workflow
1. Refactoring Analysis (If moving code)
If moving existing logic:
- Use
serena_find_referencing_symbolson the method being moved. - Plan the dependency injection change (Constructor vs Method).
2. Implementation Rules
A. Location & Naming
- Directory:
app/Services - Naming:
[Domain]Service.php(e.g.,PaymentService). - Strict Types:
declare(strict_types=1);mandatory.
B. Dependency Injection
- Constructor: For dependencies used in multiple methods.
- Method Injection: For dependencies specific to one operation.
- No Facades: Inject contracts when possible (e.g.,
Illuminate\Contracts\Mail\Mailerinstead ofMailfacade) for easier testing.
C. Return Types & Exceptions
- Always specify return types.
- Throw custom Exceptions (
App\Exceptions\[Domain]Exception) instead of generic\Exceptionor returningfalse/strings.
3. Template
<?php
declare(strict_types=1);
namespace App\Services;
use App\Models\Order;
use Illuminate\Support\Facades\DB;
use App\Exceptions\Order\PaymentFailedException;
final class CheckoutService
{
public function __construct(
private readonly PaymentGateway $gateway
) {}
/**
* @throws PaymentFailedException
*/
public function process(Order $order, string $token): void
{
DB::transaction(function () use ($order, $token) {
if (! $this->gateway->charge($order, $token)) {
throw new PaymentFailedException("Charge failed for Order {$order->id}");
}
$order->update(['status' => 'paid']);
});
}
}
Score
Total Score
80/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon

