actions-pattern
Garante que novas Actions sigam o padrão de classes actions reutilizáveis do Easy Budget.
Best use case
actions-pattern is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Garante que novas Actions sigam o padrão de classes actions reutilizáveis do Easy Budget.
Teams using actions-pattern should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/actions-pattern/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How actions-pattern Compares
| Feature / Agent | actions-pattern | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Garante que novas Actions sigam o padrão de classes actions reutilizáveis do Easy Budget.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Padrão de Actions do Easy Budget
Esta skill define o padrão arquitetural para criação de Actions no sistema Easy Budget. Actions são classes focadas em uma única responsabilidade de negócio, reutilizáveis e composáveis.
## Estrutura Padrão
```php
<?php
declare(strict_types=1);
namespace App\Actions\ModuleName;
use App\Support\ServiceResult;
use Exception;
class ActionName
{
public function __construct(
private DependencyA $dependencyA,
private DependencyB $dependencyB
) {}
/**
* Descrição do que a action executa.
*/
public function execute(ParamType $param): ServiceResult
{
try {
// 1. Validações de pré-condição
if (!$this->isValid($param)) {
return ServiceResult::error('Mensagem de erro específica.');
}
// 2. Operações de banco em transação (se necessário)
return DB::transaction(function () use ($param) {
// Lógica de negócio
$result = $this->performAction($param);
// Registro de histórico (se aplicável)
$this->logAction($param, $result);
return ServiceResult::success($result, 'Mensagem de sucesso.');
});
} catch (Exception $e) {
return ServiceResult::error($e->getMessage());
}
}
private function isValid(ParamType $param): bool
{
// Lógica de validação
return true;
}
private function performAction(ParamType $param): mixed
{
// Implementação da ação
return $result;
}
private function logAction(ParamType $param, mixed $result): void
{
// Registro de histórico se o modelo suportar
if (method_exists($param, 'actionHistory')) {
$param->actionHistory()->create([
'tenant_id' => tenant('id'),
'action' => 'action_name',
'description' => 'Descrição da ação realizada.',
'user_id' => auth()->id(),
]);
}
}
}
```
## Regras de Composição
1. **Dependências via Constructor Injection**: Sempre injete dependências no construtor
2. **Método `execute` único**: Cada Action deve ter um único ponto de entrada
3. **ServiceResult obrigatório**: Sempre retorne `ServiceResult` para operações que podem falhar
4. **Transação de banco**: Use `DB::transaction()` para operações que modificam dados
5. **Tratamento de exceções**: Use try-catch e retorne erros via `ServiceResult::error()`
6. **Registro de histórico**: Use `actionHistory()` quando disponível
## Exemplo de Composição de Actions
```php
class ComplexBusinessAction
{
public function __construct(
private ActionA $actionA,
private ActionB $actionB,
private ActionC $actionC
) {}
public function execute(Context $context): ServiceResult
{
// Compõe múltiplas actions em um fluxo de negócio
$resultA = $this->actionA->execute($context);
if ($resultA->isError()) {
return $resultA;
}
return $this->actionB->execute($context);
}
}
```
## Quando Criar uma Nova Action
- Quando a lógica de negócio é reutilizável em múltiplos controllers
- Quando o fluxo envolve múltiplas operações transacionais
- Quando há necessidade de composição com outras actions
- Quando a lógica é complexa o suficiente para justificar separação
## Quando NÃO Criar uma Action
- Operações simples de CRUD que podem ir direto no Service
- Lógica que só é usada em um único lugar
- Operações que são apenas wrapper de repositoryRelated Skills
ActiveRecord Query Patterns
Complete guide to ActiveRecord query optimization, associations, scopes, and PostgreSQL-specific patterns. Use this skill when writing database queries, designing model associations, creating migrations, optimizing query performance, or debugging N+1 queries and grouping errors.
Action Pattern Conventions
This skill should be used when the user asks about "Laravel action pattern", "action class naming", "how to structure actions", "React component patterns", "Node.js service structure", "framework-specific conventions", or discusses creating reusable, focused classes following action pattern conventions in Laravel, Symfony, React, Vue, or Node.js projects.
Action Cable & WebSocket Patterns
Real-time WebSocket features with Action Cable in Rails. Use when: (1) Building real-time chat, (2) Live notifications/presence, (3) Broadcasting model updates, (4) WebSocket authorization. Trigger keywords: Action Cable, WebSocket, real-time, channels, broadcasting, stream, subscriptions, presence, cable
accessibility-patterns
Build inclusive web experiences following WCAG guidelines. Covers semantic HTML, ARIA, keyboard navigation, color contrast, and testing strategies. Triggers on accessibility, a11y, WCAG, screen readers, or inclusive design requests.
acc-create-saga-pattern
Generates Saga pattern components for PHP 8.5. Creates Saga interfaces, steps, orchestrator, state management, and compensation logic with unit tests.
acc-create-retry-pattern
Generates Retry pattern for PHP 8.5. Creates resilience component with exponential backoff, jitter, and configurable retry strategies. Includes unit tests.
acc-create-outbox-pattern
Generates Transactional Outbox pattern components for PHP 8.5. Creates OutboxMessage entity, repository, publisher, and processor with unit tests.
acc-check-leaky-abstractions
Detects leaky abstractions in PHP code. Identifies implementation details exposed in interfaces, concrete returns from abstract methods, framework leakage into domain, and infrastructure concerns in application layer.
abp-service-patterns
ABP Framework application layer patterns including AppServices, DTOs, Mapperly mapping, Unit of Work, and common patterns like Filter DTOs and ResponseModel. Use when: (1) creating AppServices, (2) mapping DTOs with Mapperly, (3) implementing list filtering, (4) wrapping API responses.
abp-infrastructure-patterns
ABP Framework cross-cutting patterns including authorization, background jobs, distributed events, multi-tenancy, and module configuration. Use when: (1) defining permissions, (2) creating background jobs, (3) publishing/handling distributed events, (4) configuring modules.
abp-entity-patterns
ABP Framework domain layer patterns including entities, aggregates, repositories, domain services, and data seeding. Use when: (1) creating entities with proper base classes, (2) implementing custom repositories, (3) writing domain services, (4) seeding data.
a2a-sdk-patterns
SDK installation and setup patterns for Agent-to-Agent Protocol across Python, TypeScript, Java, C#, and Go. Use when implementing A2A protocol, setting up SDKs, configuring authentication, or when user mentions SDK installation, language-specific setup, or A2A integration.