Skip to main content
Generates a controller class in the target module. It writes modules/<module>/src/controllers/<Name>Controller.ts and a mirrored modules/<module>/tests/controllers/<Name>Controller.spec.ts, registers the controller into the module’s controllers array, and installs the @talosjs/controller dependency when missing. It supports both HTTP and WebSocket (socket) controllers and configures the route name, path, and method.

Usage

Examples

Run with no flags to be prompted for the name, controller type, and route name, path, and method:
Create an HTTP controller non-interactively:
Create a socket controller:

Options

AI Skill

This command ships a matching controller:create skill. The skill generates the controller class, route type, and test file, then completes the implementation: keeping the controller thin, wiring validation and role-based access, and refreshing any SDK that exposes the route. Your AI agent uses it when creating a new HTTP or WebSocket controller with routing, validation, and access control.