adonisjs-actions

Encapsulate domain logic into single-purpose AdonisJS v6 action classes.

2|1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-actions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adonisjs-actions
Source: https://github.com/omakei/adonisjs-architecture-skill/tree/main/adonisjs/skills/adonisjs-actions
Command: npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-actions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Domain logic in controllers, services, or jobs leads to duplication and brittle code. This Skill provides a pattern of single-purpose, composable actions to encapsulate business logic, ensure testability, and enforce transactional safety.

Core Features & Use Cases

  • Single-responsibility action classes with typed inputs and a public handle method.
  • Constructor injection to compose complex workflows from smaller actions.
  • Transactional database writes with db.transaction() and proper useTransaction.
  • Guard methods and domain exceptions for strong validation and recoverable errors.
  • Organize actions by domain entity and reuse across controllers, jobs, and listeners.

Quick Start

Create a simple UpdateUserAction to encapsulate updating user data and persisting within a transaction.

Frequently Asked Questions about adonisjs-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract domain logic from AdonisJS controllers?

Encapsulate domain logic into single-purpose AdonisJS action classes with typed inputs and a handle method, removing business rules from controllers for better reuse and testability across your application.

What is the best way to handle database transactions in AdonisJS business logic?

Use dedicated action classes that wrap database operations with db.transaction() and proper useTransaction configuration, ensuring transactional safety and robust error handling with domain exceptions for your workflows.

Can I compose multi-step workflows with dependency injection in AdonisJS?

Yes, AdonisJS actions support constructor injection, allowing you to compose complex multi-step workflows by injecting and orchestrating smaller, single-responsibility action classes within your controllers, jobs, or event listeners.

How do you organize reusable actions for AdonisJS jobs and event listeners?

Organize single-purpose action classes by domain entity to reuse them seamlessly across controllers, jobs, and event listeners, applying typed inputs and guard methods for consistent validation and recoverable error handling.

Does AdonisJS v6 support typed inputs and domain exceptions for actions?

Yes, AdonisJS v6 actions enforce strong validation through typed inputs and guard methods, throwing domain exceptions to provide recoverable errors and robust handling for complex application workflows.

When should I move business rules into domain actions instead of services?

Move business rules into domain actions when controllers, services, or jobs lead to code duplication and brittle structures, replacing them with composable, transactional actions that ensure testability and single responsibility.