skills/hono-architecture/SKILL.md
[Hyper] Use when working on Hono projects or adding Hono into a codebase. Enforces Hono architecture rules for app composition, route modules, middleware, validation, error handling, testing, and typed RPC boundaries before any code change.
npx skillsauth add alpoxdev/hypercore hono-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
<output_language>
Default all user-facing deliverables, saved artifacts, reports, plans, generated docs, summaries, handoff notes, commit/message drafts, and validation notes to Korean, even when this canonical skill file is written in English.
Preserve source code identifiers, CLI commands, file paths, schema keys, JSON/YAML field names, API names, package names, proper nouns, and quoted source excerpts in their required or original language.
Use a different language only when the user explicitly requests it, an existing target artifact must stay in another language for consistency, or a machine-readable contract requires exact English tokens. If a localized template or reference exists (for example *.ko.md or *.ko.json), prefer it for user-facing artifacts.
</output_language>
Enforces hypercore Hono architecture rules before code changes. Validate that the target is actually a Hono project, then apply strict rules for route composition, handlers, middleware, validation, error handling, platform entrypoints, and typed testing/RPC.
This skill is strict. Follow the rules exactly unless the user explicitly asks to prefer official Hono defaults over hypercore-specific conventions.
OPERATING MODE: This skill is self-contained. Do not block on global skills or external orchestration surfaces. If the user asks for exhaustive verification, keep verifying. Otherwise proceed directly with this skill's own validation flow.
IMPORTANT: Some rules in this skill are stricter than Hono itself. Treat those as hypercore conventions and label them clearly when reporting violations.
Review this Hono app structure before I add more routes.Refactor a Hono API so routing, middleware, and validators follow one architecture.Add a new Hono route and make sure testClient and AppType inference still work.Create a generic Express middleware guide.Review a React SPA that does not use Hono.Make a tiny copy-only response text change in a Hono handler.
Direct editing can be enough if no architectural boundary is affected.
Use official Hono defaults only, not the extra hypercore conventions.
This skill still applies, but relax hypercore-only strictness that exceeds the official docs.
Before doing any work, confirm the target is a Hono project:
rg -n '"hono"|@hono/' package.json
rg -n "from 'hono'|from \"hono\"" src app .
rg -n "new Hono\\(|createFactory\\(|testClient\\(|hc<" src app .
If none of those indicators exist, stop and route back to the normal implementation or review path instead of forcing Hono rules.
Read the detailed rules before editing:
architecture-rules.mdrules/conventions.mdrules/routes.mdrules/handlers.mdrules/middleware.mdrules/validation.mdrules/errors.mdrules/testing-rpc.mdrules/platform.mdWhen the change depends on current framework behavior or you need to justify a rule from the official docs, read:
references/official/hono-docs.mdUse the next file based on the change you are making:
rules/routes.mdcreateFactory(), createHandlers(), or typed context flow, read rules/handlers.mdc.set() / c.get() usage, read rules/middleware.mdrules/validation.mdHTTPException, app.onError(), or response-shaping problems, read rules/errors.mdtestClient(), hc<typeof app>, AppType, or larger-app inference, read rules/testing-rpc.mdbasePath() boundaries, read rules/platform.mdWhen the user explicitly asks for official Hono defaults instead of hypercore-only conventions:
references/official/hono-docs.md firstValidate planned changes against these gates.
| Check | Rule |
|------|------|
| Root app mixes transport, business logic, and persistence directly? | BLOCKED. Keep composition in app/route modules and move domain logic down. |
| Route modules bypass services and talk to DB/SDK directly without a clear reason? | BLOCKED by hypercore convention. Prefer routes -> services -> repositories/clients. |
| Controller-style class or giant controller file introduced for simple handlers? | BLOCKED. Hono best practices prefer smaller apps and route composition over controller-heavy structure. |
| Large feature area mounted manually without sub-app composition? | WARNING. Prefer app.route() / basePath() composition. |
| Check | Rule |
|------|------|
| Route registration scattered across unrelated files? | BLOCKED. Keep one obvious composition path. |
| Larger route module missing a dedicated folder with local schemas/handlers? | BLOCKED by hypercore convention. |
| Catch-all or fallback route registered before specific routes? | BLOCKED. Registration order matters in Hono. |
| Route module cannot be mounted cleanly with app.route() or a typed sub-app? | BLOCKED. |
| Check | Rule |
|------|------|
| Extracted handlers lose route typing or context typing? | BLOCKED. Use inline chaining or createFactory() / factory.createHandlers(). |
| Untyped c.set() / c.get() values used across middleware/handlers? | BLOCKED. Type Variables on the app/factory. |
| Request parsing and domain work mixed into a single long handler? | WARNING. Split validator, service, and response shaping. |
| Check | Rule |
|------|------|
| Non-trivial request data consumed without validator middleware? | BLOCKED. |
| Raw await c.req.json() or manual parsing repeated inside handlers? | BLOCKED unless the payload is trivial and tightly scoped. |
| Validation strategy is inconsistent across params/query/json/form in the same feature? | WARNING. Normalize it. |
| New validation library added without need? | BLOCKED unless explicitly requested. Prefer built-in validator(), @hono/zod-validator, or @hono/standard-validator. |
| Check | Rule | |------|------| | Middleware order assumed incorrectly? | BLOCKED. Registration order matters. | | Shared auth/logging/request-id logic duplicated across handlers? | WARNING. Prefer middleware. | | Context values survive across requests by assumption? | BLOCKED. Context is request-scoped only. | | Runtime-specific concerns leak from middleware into domain layers? | BLOCKED. |
| Check | Rule |
|------|------|
| Handler throws raw generic errors for expected HTTP failures everywhere? | WARNING. Prefer HTTPException or one centralized translation policy. |
| app.onError() missing in a non-trivial API? | WARNING. Add a central error boundary. |
| Code relies on HTTPException.getResponse() while forgetting existing Context headers? | BLOCKED. Preserve context-set headers when rebuilding responses. |
| Typed RPC client is exported but the app still depends on c.notFound() behavior? | BLOCKED. Avoid patterns the Hono RPC docs call out as incompatible. |
| Check | Rule |
|------|------|
| testClient() or hc<typeof app> type inference broken by non-chained route definition? | BLOCKED. Keep route types flowing through the exported app. |
| App type not exported where typed client/test usage is expected? | BLOCKED. Export AppType. |
| Large app split loses typed inference across sub-apps? | BLOCKED. Follow the larger-app chaining pattern from the Hono RPC docs. |
| Check | Rule |
|------|------|
| Runtime adapter code mixed into route modules? | BLOCKED. Keep adapter/bootstrap code at the edge. |
| Environment bindings/vars used without a typed Bindings/config boundary? | BLOCKED. |
| Debug helpers like showRoutes() enabled outside explicit dev-only setup? | WARNING. |
Auto-fix directly when the issue is local, reversible, and low-risk.
AppType exportcreateFactory() / factory.createHandlers()app.onError() or improve HTTP exception translationDo not auto-apply broad or potentially breaking migrations without explicit justification.
When changing Hono code, prefer this order:
testClient / hc / AppType inference still works when applicabledevelopment
[Hyper] Use when working on Vite + TanStack Router projects - enforces architecture rules (layers, routes, hooks, services, conventions) with mandatory validation before any code change. Triggers on file creation, route work, hook patterns, or any structural change in a Vite + TanStack Router codebase.
development
[Hyper] Update semantic versions across node/rust/python projects, keep discovered version files synchronized, and prefer the installed `git-commit` skill for the final git step with a direct fallback when it is unavailable.
development
[Hyper] Use when working on TanStack Start projects and the task involves auth, sessions, cookies, CSRF, secrets, env exposure, server functions/routes, headers/CSP, webhooks, or security review/fixes. Triggers on protecting routes, hardening auth flows, preventing secret leaks, securing server boundaries, or reviewing HTTP/security behavior in a TanStack Start app.
tools
[Hyper] Enforce TanStack Start architecture in existing Start projects, especially project/folder structure, route structure, nested shared folder organization, server functions, loader/client-server boundaries, importProtection, hooks, SSR/hydration, and hypercore conventions. Use before structural code changes, folder-structure reviews, route work, server function work, or architecture audits in TanStack Start codebases.