Token导航 LogoToken导航

Agent Skill · 研究检索

elysiajs(elysiajs 文档)

elysiajs 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

elysiajs 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 1,147。

总安装 116,478周安装 4,964GitHub Stars 63下载 40,563核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:elysiajs(elysiajs 文档)
来源仓库:https://github.com/elysiajs/skills
仓库路径:skills/elysiajs
安装命令:
npx skills add https://github.com/elysiajs/skills --skill elysiajs
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/elysiajs/skills --skill elysiajs

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

为 Bun 构建的类型安全、高性能后端框架,具有 TypeScript 优先的路由和验证。

支持 HTTP 方法、路径/查询参数、请求正文、标头和 WebSocket 端点,并具有跨路由的完整类型推断 内置 TypeBox 验证,支持嵌套对象、数组、文件上传和响应模式;还兼容 Zod、Valibot 和 ArkType 基于特征的项目结构,包含控制器、服务和模型;包括用于横切关注点的守卫、宏和生命周期挂钩(onBeforeHandle、onError) 用于身份验证(JWT、Bearer)、CORS、OpenAPI 文档、静态文件、GraphQL 以及与 Drizzle ORM、Better Auth 和 Next.js 集成的官方插件 类型安全所需的方法链;通过本地/范围/全局生命周期级别进行封装;通过命名对插件进行重复数据删除支持

来源仓库内路径:skills/elysiajs

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/elysiajs/skills --skill elysiajs;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

elysiajs 怎么安装?

在终端执行 npx skills add https://github.com/elysiajs/skills --skill elysiajs。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

elysiajs 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

elysiajs 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

elysiajs 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

elysiajs 用的人多吗?

公开数据是累计安装 116,478 次,近一周安装 4,964 次,下载 40,563 次,GitHub 63 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

elysiajs 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
elysiajs

elysiajs 文档 · 本页

116,47863需要联网MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

ElysiaJS Development Skill

Always consult elysiajs.com/llms.txt for code examples and latest API.

Overview

ElysiaJS is a TypeScript framework for building Bun-first (but not limited to Bun) type-safe, high-performance backend servers. This skill provides comprehensive guidance for developing with Elysia, including routing, validation, authentication, plugins, integrations, and deployment.

When to Use This Skill

Trigger this skill when the user asks to:

  • Create or modify ElysiaJS routes, handlers, or servers
  • Setup validation with TypeBox or other schema libraries (Zod, Valibot)
  • Implement authentication (JWT, session-based, macros, guards)
  • Add plugins (CORS, OpenAPI, Static files, JWT)
  • Integrate with external services (Drizzle ORM, Better Auth, Next.js, Eden Treaty)
  • Setup WebSocket endpoints for real-time features
  • Create unit tests for Elysia instances
  • Deploy Elysia servers to production

Quick Start

Quick scaffold:

bun create elysia app

Basic Server

import { Elysia, t, status } from 'elysia'

const app = new Elysia()
  	.get('/', () => 'Hello World')
   	.post('/user', ({ body }) => body, {
    	body: t.Object({
      		name: t.String(),
        	age: t.Number()
     	})
    })
    .get('/id/:id', ({ params: { id } }) => {
   		if(id > 1_000_000) return status(404, 'Not Found')

     	return id
    }, {
    	params: t.Object({
     		id: t.Number({
       			minimum: 1
       		})
     	}),
     	response: {
      		200: t.Number(),
        	404: t.Literal('Not Found')
      	}
    })
    .listen(3000)

Basic Usage

HTTP Methods

import { Elysia } from 'elysia'

new Elysia()
  .get('/', 'GET')
  .post('/', 'POST')
  .put('/', 'PUT')
  .patch('/', 'PATCH')
  .delete('/', 'DELETE')
  .options('/', 'OPTIONS')
  .head('/', 'HEAD')

Path Parameters

.get('/user/:id', ({ params: { id } }) => id)
.get('/post/:id/:slug', ({ params }) => params)

Query Parameters

.get('/search', ({ query }) => query.q)
// GET /search?q=elysia → "elysia"

Request Body

.post('/user', ({ body }) => body)

Headers

.get('/', ({ headers }) => headers.authorization)

TypeBox Validation

Basic Types

import { Elysia, t } from 'elysia'

.post('/user', ({ body }) => body, {
  body: t.Object({
    name: t.String(),
    age: t.Number(),
    email: t.String({ format: 'email' }),
    website: t.Optional(t.String({ format: 'uri' }))
  })
})

Nested Objects

body: t.Object({
  user: t.Object({
    name: t.String(),
    address: t.Object({
      street: t.String(),
      city: t.String()
    })
  })
})

Arrays

body: t.Object({
  tags: t.Array(t.String()),
  users: t.Array(t.Object({
    id: t.String(),
    name: t.String()
  }))
})

File Upload

.post('/upload', ({ body }) => body.file, {
  body: t.Object({
    file: t.File({
      type: 'image',              // image/* mime types
      maxSize: '5m'               // 5 megabytes
    }),
    files: t.Files({              // Multiple files
      type: ['image/png', 'image/jpeg']
    })
  })
})

Response Validation

.get('/user/:id', ({ params: { id } }) => ({
  id,
  name: 'John',
  email: 'john@example.com'
}), {
  params: t.Object({
    id: t.Number()
  }),
  response: {
    200: t.Object({
      id: t.Number(),
      name: t.String(),
      email: t.String()
    }),
    404: t.String()
  }
})

Standard Schema (Zod, Valibot, ArkType)

Zod

import { z } from 'zod'

.post('/user', ({ body }) => body, {
  body: z.object({
    name: z.string(),
    age: z.number().min(0),
    email: z.string().email()
  })
})

Error Handling

.get('/user/:id', ({ params: { id }, status }) => {
  const user = findUser(id)

  if (!user) {
    return status(404, 'User not found')
  }

  return user
})

Guards (Apply to Multiple Routes)

.guard({
  params: t.Object({
    id: t.Number()
  })
}, app => app
  .get('/user/:id', ({ params: { id } }) => id)
  .delete('/user/:id', ({ params: { id } }) => id)
)

Macro

.macro({
  hi: (word: string) => ({
    beforeHandle() { console.log(word) }
  })
})
.get('/', () => 'hi', { hi: 'Elysia' })

Project Structure (Recommended)

Elysia takes an unopinionated approach but based on user request. But without any specific preference, we recommend a feature-based and domain driven folder structure where each feature has its own folder containing controllers, services, and models.

src/
├── index.ts              # Main server entry
├── modules/
│   ├── auth/
│   │   ├── index.ts      # Auth routes (Elysia instance)
│   │   ├── service.ts    # Business logic
│   │   └── model.ts      # TypeBox schemas/DTOs
│   └── user/
│       ├── index.ts
│       ├── service.ts
│       └── model.ts
└── plugins/
    └── custom.ts

public/                   # Static files (if using static plugin)
test/                     # Unit tests

Each file has its own responsibility as follows:

  • Controller (index.ts): Handle HTTP routing, request validation, and cookie.
  • Service (service.ts): Handle business logic, decoupled from Elysia controller if possible.
  • Model (model.ts): Define the data structure and validation for the request and response.

Best Practice

Elysia is unopinionated on design pattern, but if not provided, we can relies on MVC pattern pair with feature based folder structure.

  • Controller:

- Prefers Elysia as a controller for HTTP dependant controller - For non HTTP dependent, prefers service instead unless explicitly asked - Use onError to handle local custom errors - Register Model to Elysia instance via Elysia.models({...models}) and prefix model by namespace Elysia.prefix('model', 'Namespace.') - Prefers Reference Model by name provided by Elysia instead of using an actual Model.name`

  • Service:

- Prefers class (or abstract class if possible) - Prefers interface/type derive from Model - Return status (import {status} from 'elysia') for error - Prefers return Error instead of throw Error

  • Models:

- Always export validation model and type of validation model - Custom Error should be in contains in Model

Elysia Key Concept

Elysia has a every important concepts/rules to understand before use.

Encapsulation - Isolates by Default

Lifecycles (hooks, middleware) don't leak between instances unless scoped.

Scope levels:

  • local (default) - current instance + descendants
  • scoped - parent + current + descendants
  • global - all instances
.onBeforeHandle(() => {}) // only local instance
.onBeforeHandle({ as: 'global' }, () => {}) // exports to all

Method Chaining - Required for Types

Must chain. Each method returns new type reference.

❌ Don't:

const app = new Elysia()
app.state('build', 1) // loses type
app.get('/', ({ store }) => store.build) // build doesn't exists

✅ Do:

new Elysia()
  .state('build', 1)
  .get('/', ({ store }) => store.build)

Explicit Dependencies

Each instance independent. Declare what you use.

const auth = new Elysia()
	.decorate('Auth', Auth)
	.model(Auth.models)

new Elysia()
  .get('/', ({ Auth }) => Auth.getProfile()) // Auth doesn't exists

new Elysia()
  .use(auth) // must declare
  .get('/', ({ Auth }) => Auth.getProfile())

Global scope when:

  • No types added (cors, helmet)
  • Global lifecycle (logging, tracing)

Explicit when:

  • Adds types (state, models)
  • Business logic (auth, db)

Deduplication

Plugins re-execute unless named:

new Elysia() // rerun on `.use`
new Elysia({ name: 'ip' }) // runs once across all instances

Order Matters

Events apply to routes registered after them.

.onBeforeHandle(() => console.log('1'))
.get('/', () => 'hi') // has hook
.onBeforeHandle(() => console.log('2')) // doesn't affect '/'

Type Inference

Inline functions only for accurate types.

For controllers, destructure in inline wrapper:

.post('/', ({ body }) => Controller.greet(body), {
  body: t.Object({ name: t.String() })
})

Get type from schema:

type MyType = typeof MyType.static

Reference Model

Model can be reference by name, especially great for documenting an API

new Elysia()
	.model({
		book: t.Object({
			name: t.String()
		})
	})
	.post('/', ({ body }) => body.name, {
		body: 'book'
	})

Model can be renamed by using .prefix / .suffix

new Elysia()
	.model({
		book: t.Object({
			name: t.String()
		})
	})
	.prefix('model', 'Namespace')
	.post('/', ({ body }) => body.name, {
		body: 'Namespace.Book'
	})

Once prefix, model name will be capitalized by default.

Technical Terms

The following are technical terms that is use for Elysia:

  • OpenAPI Type Gen - function name fromTypes from @elysiajs/openapi for generating OpenAPI from types, see plugins/openapi.md
  • Eden, Eden Treaty - e2e type safe RPC client for share type from backend to frontend

Resources

Use the following references as needed.

It's recommended to checkout route.md for as it contains the most important foundation building blocks with examples.

plugin.md and validation.md is important as well but can be check as needed.

references/

Detailed documentation split by topic:

  • bun-fullstack-dev-server.md - Bun Fullstack Dev Server with HMR. React without bundler.
  • cookie.md - Detailed documentation on cookie
  • deployment.md - Production deployment guide / Docker
  • eden.md - e2e type safe RPC client for share type from backend to frontend
  • guard.md - Setting validation/lifecycle all at once
  • macro.md - Compose multiple schema/lifecycle as a reusable Elysia via key-value (recommended for complex setup, eg. authentication, authorization, Role-based Access Check)
  • plugin.md - Decouple part of Elysia into a standalone component
  • route.md - Elysia foundation building block: Routing, Handler and Context
  • testing.md - Unit tests with examples
  • validation.md - Setup input/output validation and list of all custom validation rules
  • websocket.md - Real-time features

plugins/

Detailed documentation, usage and configuration reference for official Elysia plugin:

  • bearer.md - Add bearer capability to Elysia (@elysiajs/bearer)
  • cors.md - Out of box configuration for CORS (@elysiajs/cors)
  • cron.md - Run cron job with access to Elysia context (@elysiajs/cron)
  • graphql-apollo.md - Integration GraphQL Apollo (@elysiajs/graphql-apollo)
  • graphql-yoga.md - Integration with GraphQL Yoga (@elysiajs/graphql-yoga)
  • html.md - HTML and JSX plugin setup and usage (@elysiajs/html)
  • jwt.md - JWT / JWK plugin (@elysiajs/jwt)
  • openapi.md - OpenAPI documentation and OpenAPI Type Gen / OpenAPI from types (@elysiajs/openapi)
  • opentelemetry.md - OpenTelemetry, instrumentation, and record span utilities (@elysiajs/opentelemetry)
  • server-timing.md - Server Timing metric for debug (@elysiajs/server-timing)
  • static.md - Serve static files/folders for Elysia Server (@elysiajs/static)

integrations/

Guide to integrate Elysia with external library/runtime:

  • ai-sdk.md - Using Vercel AI SDK with Elysia
  • astro.md - Elysia in Astro API route
  • better-auth.md - Integrate Elysia with better-auth
  • cloudflare-worker.md - Elysia on Cloudflare Worker adapter
  • deno.md - Elysia on Deno
  • drizzle.md - Integrate Elysia with Drizzle ORM
  • expo.md - Elysia in Expo API route
  • nextjs.md - Elysia in Nextjs API route
  • nodejs.md - Run Elysia on Node.js
  • nuxt.md - Elysia on API route
  • prisma.md - Integrate Elysia with Prisma
  • react-email.d - Create and Send Email with React and Elysia
  • sveltekit.md - Run Elysia on Svelte Kit API route
  • tanstack-start.md - Run Elysia on Tanstack Start / React Query
  • vercel.md - Deploy Elysia to Vercel

examples/ (optional)

  • basic.ts - Basic Elysia example
  • body-parser.ts - Custom body parser example via .onParse
  • complex.ts - Comprehensive usage of Elysia server
  • cookie.ts - Setting cookie
  • error.ts - Error handling
  • file.ts - Returning local file from server
  • guard.ts - Setting mulitple validation schema and lifecycle
  • map-response.ts - Custom response mapper
  • redirect.ts - Redirect response
  • rename.ts - Rename context's property
  • schema.ts - Setup validation
  • state.ts - Setup global state
  • upload-file.ts - File upload with validation
  • websocket.ts - Web Socket for realtime communication

patterns/ (optional)

  • patterns/mvc.md - Detail guideline for using Elysia with MVC patterns

平台分布

Claude Code

31.23%
按下载量换算12,668

OpenCode

22.74%
按下载量换算9,224

Cursor

15.69%
按下载量换算6,364

Antigravity

11.46%
按下载量换算4,649

Gemini CLI

7.57%
按下载量换算3,071

Codex

3.25%
按下载量换算1,318

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills