Engineering
create-frontend-controller avatar

create-frontend-controller

Automates the creation of Magento 2 frontend controller actions with routing, dependency injection, and proper response interfaces, following Adobe best practices.

Introduction

The create-frontend-controller skill is a specialized development assistant designed for Adobe Commerce and Magento 2 (Mage-OS) environments. It streamlines the creation of storefront controllers—the core components for handling HTTP requests, managing custom AJAX endpoints, rendering full pages, or processing form submissions. By enforcing adherence to strict architectural standards, this skill ensures that generated code is modular, testable, and aligned with modern Magento development patterns.

  • Automatically generates the required routing configuration in etc/frontend/routes.xml.

  • Implements HTTP method-specific interfaces such as HttpGetActionInterface and HttpPostActionInterface to ensure secure and predictable request handling.

  • Enforces the use of constructor-based dependency injection to avoid deprecated ObjectManager patterns.

  • Facilitates the selection of appropriate result factories, including JsonFactory, PageFactory, RedirectFactory, and RawFactory.

  • Encourages strict typing with PHP 7.4/8.x standards, promoting long-term maintainability.

  • Ideal for developers building custom storefront features, headless API endpoints for JavaScript integrations, or complex form handlers.

  • Input requirements include the target module name, desired controller path, and chosen HTTP method (GET/POST/Both).

  • Expected output is a production-ready, PSR-compliant controller class and the corresponding XML configuration snippet.

  • Developers should verify that the module exists in the app/code structure before execution.

  • Always ensure custom business logic is separated from the controller execute() method to maintain a clean MVC separation of concerns.

Repository Stats

Stars
13
Forks
1
Open Issues
0
Language
Not provided
Default Branch
main
Sync Status
Idle
Last Synced
May 3, 2026, 04:13 PM
View on GitHub