hono-api-best-practices
Installation
SKILL.md
API Design & Standards (Hono + Zod)
When to Use This Skill
- Defining new HTTP endpoints for a bounded context
- Reviewing, auditing, or refactoring existing API routes for consistency
- Establishing API standards for a TypeScript/Clean Architecture backend
- Designing contracts for frontend, SDK, CLI, MCP, or third-party consumers
- Defining or updating API contracts in a shared contracts package (e.g.
api-contracts) - Enforcing consistent route registration and generated OpenAPI docs
Choose the API Style First
This skill supports two mutually exclusive conventions. Lock onto exactly one per project before designing or auditing any endpoint, and never mix them within the same API surface. The shared core below (Clean Architecture, Zod as source of truth, createRoute + app.openapi, the error helper, generated OpenAPI) applies to both styles. Only paths, methods, parameter placement, and response shapes differ.
| Style | Shape | Read |
|---|---|---|
| Standard REST | Resource paths + HTTP verbs (GET/POST/PATCH/PUT/DELETE); params in path/query/body; responses return the resource/collection directly |
references/style-rest.md |
| POST-only action-based | Every endpoint is POST /<context>/<entity>/<action>; JSON body only; responses use the { data, message } / { error, details } envelope |
references/style-post-only.md |