adonisjs-controllers

Create thin AdonisJS v6 controllers that delegate domain logic to services.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Controllers are extremely thin. They handle HTTP concerns only and contain zero domain logic, ensuring business rules live in services or actions and are wired via dependency injection.

Core Features & Use Cases

  • Thin RESTful controllers for API endpoints
  • Support for standard RESTful methods (index, show, store, update, destroy)
  • Invokable controllers for single-action endpoints and lazy-loading routes
  • Dependency Injection and route model binding to keep controllers light
  • Validation via VineJS patterns and clear HTTP responses

Quick Start

Create a thin PostsController that delegates to a PostService for data operations and wire up routes using lazy loading.

Frequently Asked Questions about adonisjs-controllers

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

FAQPage Schema
How do I keep AdonisJS controllers thin and free of domain logic?

To keep AdonisJS controllers thin, handle HTTP concerns only and delegate business rules to injected services. This ensures domain logic lives in service classes instead of the controller layer.

What is the best way to structure RESTful controllers in AdonisJS v6?

The best way to structure RESTful controllers in AdonisJS v6 is to use standard methods like index, show, store, update, and destroy. Delegate data operations to injected service classes to maintain a clean HTTP layer.

How does dependency injection work with route model binding in AdonisJS?

Dependency injection in AdonisJS wires services into controllers automatically, while route model binding injects resolved model instances directly. Together they keep controllers light by eliminating manual data fetching and service instantiation.

When should I use invokable controllers instead of standard RESTful controllers?

Use invokable controllers in AdonisJS for single-action endpoints instead of standard RESTful controllers with multiple methods. They support lazy-loading routes and are ideal when an endpoint handles one specific workflow.

Can I use VineJS validation directly inside thin AdonisJS controllers?

Yes, you can use VineJS validation inside thin AdonisJS controllers to validate incoming HTTP requests. Controllers handle validation and return clear HTTP responses, then delegate validated data to service-driven workflows.