Actions and services
Skill soden46/syarif-laravel-ai-skills/skills/actions-and-services
Use Actions and Services as deliberate Laravel application boundaries for use cases, integrations, and reusable workflows.From its SKILL.md
npx -y skills add soden46/syarif-laravel-ai-skills --skill actions-and-servicesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.4 KB, 456 tokens by cl100k_base, as published. Nobody here has run it
Actions And Services
Actions and Services create application boundaries. Use them based on need, not because every controller method needs another layer.
When To Use An Action
Use an Action for one named use case:
CreateRecordApproveRecordCancelRecordGenerateRecordDocument
Actions fit workflows with clear input and output.
final class CreateRecord
{
public function handle(User $actor, array $data): Record
{
return DB::transaction(function () use ($actor, $data) {
return Record::create([
'owner_id' => $actor->id,
'name' => $data['name'],
]);
});
}
}
When To Use A Service
Use a Service when a component owns a broader capability:
- integration client;
- document generation;
- pricing/calculation policy;
- import/export workflow;
- reusable application workflow.
final class GatewayService
{
public function createLink(Record $record): string
{
$response = Http::baseUrl(config('services.gateway.url'))
->timeout(5)
->retry(2, 200, throw: false)
->post('/links', [
'reference' => $record->public_reference,
'amount' => $record->total,
]);
throw_unless($response->successful(), RuntimeException::class);
return $response->json('url');
}
}
Integration Boundaries
Keep provider calls in focused services or adapters. The boundary should own:
- request mapping;
- authentication/signing details;
- timeouts and retries;
- response parsing;
- provider error translation;
- sanitized structured logging;
- fake-driven tests.
Do not globalize provider endpoints, payload quirks, status maps, or customer copy.
Interfaces And Repositories
Do not create an interface for every service.
Add an interface only when:
- multiple implementations exist;
- provider swapping is likely;
- configuration selects implementations;
- the contract is shared across modules;
- the boundary protects domain code from infrastructure.
Do not require Repository Pattern for normal Eloquent CRUD. Add a repository only for real data-access complexity or storage-provider variation.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.