create-controller

Generate CRUD controllers connecting HTTP routes to Hono.js services.

1|Updated May 21, 2025
One-click install
npx skills add https://github.com/madooei/backend-template --skill create-controller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-controller
Source: https://github.com/madooei/backend-template/tree/main/.claude/skills/create-controller
Command: npx skills add https://github.com/madooei/backend-template --skill create-controller

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Controllers are the thin layer between HTTP requests and business logic, enabling clean routing and service orchestration without embedding logic in routes.

Core Features & Use Cases

  • Generates a fully structured controller class skeleton with CRUD handlers wired to services.
  • Promotes dependency injection, typed AppEnv usage, and consistent error handling patterns.
  • Use Case: Create a NoteController that handles GET, POST, PATCH, DELETE with NotFoundError on missing entities.

Quick Start

Create src/controllers/{entity}.controller.ts and wire it to src/services/{entity}.service.ts using the existing schemas and patterns.

Frequently Asked Questions about create-controller

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

FAQPage Schema
How do I create CRUD controllers in Hono.js without embedding business logic in my routes?

Use this Skill to generate a controller class skeleton that wires HTTP routes to dependency-injected services, keeping the layer thin. This enforces clean routing and orchestration without embedding logic directly in routes.

What files do I need before generating a TypeScript controller for my API?

Before generating a TypeScript controller, you need a corresponding service file and schema file. The controller connects HTTP routes to these existing services and validation middlewares for consistent, testable API behavior.

How does dependency injection work with Hono.js controllers and AppEnv typing?

Dependency injection in Hono.js controllers uses typed AppEnv usage to pass services to arrow-based handler patterns. This promotes easy testing and consistent error handling, such as returning NotFoundError for missing entities.

Can I use this approach to handle validation middlewares and NotFoundError in a TypeScript API?

Yes, the generated controllers integrate validation middlewares and use NotFoundError for missing entities. This provides consistent error handling across all CRUD operations in your TypeScript API built with Hono.js.

What is the best way to structure API routing and service orchestration in a TypeScript Hono project?

The best way to structure API routing is using a thin controller layer between HTTP requests and services. Controllers orchestrate services via dependency injection and arrow-based handler patterns, preventing logic from embedding in routes.