agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/elysia-architecture/SKILL.md

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

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
  1. Distinctive:

    If the target repo already documents architecture (e.g.

    line 25
  2. Very specific:

    No route factories / shared HTTP wrappers: Do not invent makeSyncGet, mapXToHttp, or utils/*-http.ts that wrap handlers.

    line 53
  3. Very specific:

    Do not grow utils/ for HTTP: Prefer schema/, services/domain, or inlined route edges.

    line 55

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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)

PieceDefault
RuntimeBun (Node/adapters OK if the app already uses them)
HTTPElysia feature plugins under src/modules/<feature>/
Module layoutroutes/ + schema/ + domain logic folder
TestsVitest 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

  1. Scaffold — new feature module from checklist.md + tree.md.
  2. Apply — place new endpoints/schemas/services in the canonical spots.
  3. Review — compare the tree to rules.md; propose moves; do not invent a parallel layout.

Hard rules (core)

  1. Feature = src/modules/<feature>/. Group by domain (billing, users), not by technical layer at the app root.
  2. 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.
  3. routes/index.ts is a mount table only — .use(child) (+ prefix). No handlers, no domain logic, no shared mappers.
  4. Schemas live under schema/ (body, response, query, params as needed). Do not dump DTOs into route files or invent parallel hand-written response interfaces when schemas already define the contract.
  5. Routes stay thin. HTTP concerns (auth guards, status mapping, request/response) in the route file; business rules in services (or plain domain modules).
  6. No route factories / shared HTTP wrappers. Do not invent makeSyncGet, mapXToHttp, or utils/*-http.ts that wrap handlers. Inline the edge in each route file.
  7. Map failures at the HTTP edge only. Public bodies stay small (e.g. { error: string } + status). Do not leak internal causes.
  8. Do not grow utils/ for HTTP. Prefer schema/, services/domain, or inlined route edges.
  9. 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).
  10. Import direction: routes → schema + services; services must not import routes. Cross-feature deps go through services/shared packages, not route→route imports.
  11. 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

NeedRead
Canonical trees + namingreferences/tree.md
Enforce rules + anti-patternsreferences/rules.md
Scaffold / review checklistsreferences/checklist.md
Good vs bad layoutsreferences/examples.md
Optional stack overlaysExtensions 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.

WhenExtension
Effect services / Layers / tagged errorswith-effect.md
createEnv / packages must not read process.envwith-env.md
Session auth mount + { auth: true } macrowith-session-auth.md
Capabilities / grants / identity permissionswith-capability-authz.md
Bearer API keys on a jobs/public APIwith-api-key-auth.md
Drizzle schema package + DB in serviceswith-drizzle.md
OpenAPI derived from route schemaswith-openapi.md
Request logs + OTEL + Effect tracerwith-observability.md
Stable public error body + edge mappingwith-http-errors.md
Domain in packages/*, HTTP in app moduleswith-domain-packages.md
Shared vs app-local Elysia pluginswith-shared-plugins.md
In-process cron tickswith-cron.md
Provider webhookswith-webhooks.md
Internal shared-secret routeswith-service-auth.md
Vitest — Elysia handle / what to testwith-vitest.md

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.