Actions and services
Skill soden46/syarif-laravel-ai-skills/skills/actions-and-services
Reusable Laravel AI skills for Codex, Claude Code, and other AI coding assistants
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.
2 things to look at
- 20 days oldThe repository was created 20 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 1 stars1 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.
What its author says it does
Copied from the file, not written here
Use Actions and Services as deliberate Laravel application boundaries for use cases, integrations, and reusable workflows.
SKILL.md
2.4 KB, 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.