server-gateway-refactor
Installation
SKILL.md
Server Gateway Refactor
Use this skill when an apps/server route file has grown into a mixed transport/business/infra module and the user wants it engineered rather than merely split by line count.
First Read
Start from the exact route file the user named. Read nearby tests and domain services before editing. Use rg for call sites and avoid deleting legacy routes without checking tests/docs/env references.
Look for these responsibilities:
- HTTP/WebSocket transport shape: Hono routes, auth, request parsing, response mounting, upgrade setup.
- Gateway operation shape: authenticated user, parsed body/query, operation id, model/provider routing, external calls.
- Infra behavior: billing, rate limiting, telemetry/tracing, request logs, PostHog, retries, cache.
- Domain services: persistence, Stripe records, character/provider ownership, chat messages, flux transactions.