elysia-architecture
Skill1 starsChanged 3 months agoMITView on GitHub
Enforce portable Elysia app architecture: feature modules, folder trees, naming, one-route-one-file, thin handlers, schema/services ownership, and mount tables. Use when scaffolding a new Elysia API or feature, adding endpoints, reviewing or reorganizing module layout, or when the user asks for elysia-architecture / Elysia house style. Optional with-* overlays for Effect, env, session auth, capability authz, API keys, Drizzle, OpenAPI, observability, HTTP errors, domain packages, plugins, cron, webhooks, service auth, and Vitest.
- Reads credentials
In this repository81 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agents-mdSkill
- base-uiSkill
- better-authSkill
- brainstormSkill
- bullmqSkill
- bunSkill
- clickhouseSkill
- clone-to-tempSkill
- compound-uiSkill
- copywritingSkill
- create-durable-planSkill
- d3Skill
- date-fnsSkill
- decimal-jsSkill
- deduplicateSkill
- design-engineerSkill
- designSkill
- drizzle-ormSkill
- effectSkill
- elysiaSkill
- evlogSkill
- feedsmithSkill
- grokSkill
- handoffSkill
- heyapiSkill
- impitSkill
- intlayerSkill
- jsdocSkill
- kafkaSkill
- kill-legacySkill
- legend-stateSkill
- loopSkill
- mantine-hooksSkill
- mobbinSkill
- motionSkill
- oxfmtSkill
- oxlintSkill
- permixSkill
- plain-languageSkill
- playwrightSkill
- react-boundariesSkill
- react-emailSkill
- reactSkill
- reorganizeSkill
- researchSkill
- schema-dtsSkill
- sentrySkill
- seoSkill
- setup-competitors-mdSkill
- setup-copywriting-mdSkill
- setup-icp-mdSkill
- setup-project-mdSkill
- simplify-layoutSkill
- storybookSkill
- subagentsSkill
- tailwindSkill
- tailwind-variantsSkill
- takumiSkill
- tanstack-chartsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
If the target repo already documents architecture (e.g.
- Very specific: line 53
No route factories / shared HTTP wrappers: Do not invent makeSyncGet, mapXToHttp, or utils/*-http.ts that wrap handlers.
- Very specific: line 55
Do not grow
utils/for HTTP: Prefer schema/, services/domain, or inlined route edges.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Elysia Architecture
Portable house style for Elysia HTTP apps. Use this skill alone — it does not depend on other skills.
Job: where code lives, how folders/files are named, and ownership boundaries.
Not this skill: Elysia API quirks, plugin lifecycle details, Eden, adapters, or latest framework docs. Prefer current Elysia docs for those.
If the target repo already documents architecture (e.g. AGENTS.md) and it
conflicts, repo wins unless the user asks to migrate toward this skill.
Stack defaults (core)
| Piece | Default |
| Runtime | Bun (Node/adapters OK if the app already uses them) |
| HTTP | Elysia feature plugins under src/modules/<feature>/ |
| Module layout | routes/ + schema/ + domain logic folder |
| Tests | Vitest under tests/ (unit / integration projects) when the repo uses Vitest |
Domain logic may be plain TypeScript modules. Load matching with-* extensions when those stacks are present (see below).
Modes
- Scaffold — new feature module from checklist.md + tree.md.
- Apply — place new endpoints/schemas/services in the canonical spots.
- Review — compare the tree to rules.md; propose moves; do not invent a parallel layout.
Hard rules (core)
- Feature =
src/modules/<feature>/. Group by domain (billing,users), not by technical layer at the app root. - One route file = one exported Elysia plugin with a stable
name, and typically one HTTP verb (or a tight related group). Do not pack unrelated verbs into one file. routes/index.tsis a mount table only —.use(child)(+prefix). No handlers, no domain logic, no shared mappers.- Schemas live under
schema/(body,response,query,paramsas needed). Do not dump DTOs into route files or invent parallel hand-written response interfaces when schemas already define the contract. - Routes stay thin. HTTP concerns (auth guards, status mapping, request/response) in the route file; business rules in services (or plain domain modules).
- No route factories / shared HTTP wrappers. Do not invent
makeSyncGet,mapXToHttp, orutils/*-http.tsthat wrap handlers. Inline the edge in each route file. - Map failures at the HTTP edge only. Public bodies stay small (e.g.
{ error: string }+ status). Do not leak internal causes. - Do not grow
utils/for HTTP. Preferschema/, services/domain, or inlined route edges. - Naming: folder = noun/domain; file = action or aspect (
create.ts,status.ts). Do not repeat the parent folder in the leaf name (billing/billing-status.ts→billing/routes/status.ts). - Import direction: routes → schema + services; services must not import routes. Cross-feature deps go through services/shared packages, not route→route imports.
- Mount feature trees from the app entry (or a parent feature’s mount table).
Details, anti-patterns, and examples: rules.md, tree.md, examples.md.
Progressive disclosure
| Need | Read |
| Canonical trees + naming | references/tree.md |
| Enforce rules + anti-patterns | references/rules.md |
| Scaffold / review checklists | references/checklist.md |
| Good vs bad layouts | references/examples.md |
| Optional stack overlays | Extensions below |
Extensions
Load an extension only when the matching stack is present (or the user asks). Extensions add rules; they do not replace the core tree.
| When | Extension |
| Effect services / Layers / tagged errors | with-effect.md |
createEnv / packages must not read process.env | with-env.md |
Session auth mount + { auth: true } macro | with-session-auth.md |
| Capabilities / grants / identity permissions | with-capability-authz.md |
| Bearer API keys on a jobs/public API | with-api-key-auth.md |
| Drizzle schema package + DB in services | with-drizzle.md |
| OpenAPI derived from route schemas | with-openapi.md |
| Request logs + OTEL + Effect tracer | with-observability.md |
| Stable public error body + edge mapping | with-http-errors.md |
Domain in packages/*, HTTP in app modules | with-domain-packages.md |
| Shared vs app-local Elysia plugins | with-shared-plugins.md |
| In-process cron ticks | with-cron.md |
| Provider webhooks | with-webhooks.md |
| Internal shared-secret routes | with-service-auth.md |
Vitest — Elysia handle / what to test | with-vitest.md |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

