elysia

elysia is a cursor rule for Cursor from kerlos/elysia-mcp. It costs 0 tokens per session (9,444 once invoked), scanned A, original, MIT.

A set of Elysia.js rules for checking HTTP request and response data, including bodies, URL parameters, headers, cookies, and responses. It also supports generating OpenAPI documentation from these schemas.

In plain words
What is it for?
Use it when defining Elysia.js endpoints that need input checks, response checks, authentication-related routes, or automatically generated OpenAPI documentation.
Why use it?
It helps catch incorrectly shaped data at the API boundary and keeps the API description aligned with the validation rules.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { supabase } from '../../libs'.

Good fit Use it when defining Elysia.js endpoints that need input checks, response checks, authentication-related routes, or automatically generated OpenAPI documentation.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/kerlos/elysia-mcp
agentmods
npx agentmods add rules/kerlos/elysia-mcp/elysia

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for elysia

README.md
[![agentmods](https://agentmods.dev/badge/rules/kerlos/elysia-mcp/elysia.svg)](https://agentmods.dev/rules/kerlos/elysia-mcp/elysia)
Your own site
<a href="https://agentmods.dev/rules/kerlos/elysia-mcp/elysia"><img src="https://agentmods.dev/badge/rules/kerlos/elysia-mcp/elysia.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 9,444 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.09444
Opus 5 $0.00000 $0.04722
Sonnet 5 $0.00000 $0.01889
Haiku 4.5 $0.00000 $0.00944

Measured 7d ago against content hash 4069d9b33030, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

elysia scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/elysia.mdc · 1,385 lines

How it starts

The opening of the file, as written. The whole thing — 1,385 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TITLE: Elysia Supported Schema Validation Types DESCRIPTION: Elysia provides declarative schema support for various parts of an HTTP request and response, enabling robust validation and automatic OpenAPI generation. SOURCE: https://github.com/elysiajs/documentation/blob/main/docs/essential/validation.md#_snippet_3

LANGUAGE: APIDOC CODE:

Schema Types:
  Body: Validate an incoming HTTP Message
  Query: Query string or URL parameter
  Params: Path parameters
  Headers: Headers of the request
  Cookie: Cookie of the request
  Response: Response of the request

TITLE: Elysia.js User Authentication and Session Management Service DESCRIPTION: Provides a comprehensive user authentication service built with Elysia.js. It defines in-memory state for users and sessions, models for sign-in credentials and cookies, a custom macro for authentication checks, and routes for user sign-up, sign-in, and sign-out, including password hashing and session token management. SOURCE: https://github.com/elysiajs/documentation/blob/main/docs/tutorial.md#_snippet_41

LANGUAGE: typescript CODE:

// @errors: 2538
import { Elysia, t } from 'elysia'

export const userService = new Elysia({ name: 'user/service' })
    .state({
        user: {} as Record<string, string>,
        session: {} as Record<number, string>
    })
    .model({
        signIn: t.Object({
            username: t.String({ minLength: 1 }),
            password: t.String({ minLength: 8 })
        }),
        session: t.Cookie(
            {
                token: t.Number()
            },
            {
                secrets: 'seia'
            }
        ),
        optionalSession: t.Cookie(
            {
                token: t.Optional(t.Number())
            },
            {
                secrets: 'seia'
            }
        )
    })
    .macro({
        isSignIn(enabled: boolean) {
            if (!enabled) return

            return {
                beforeHandle({
                    status,
                    cookie: { token },
                    store: { session }
                }) {
                    if (!token.value)
                        return status(401, {
                            success: false,
                            message: 'Unauthorized'
                        })

                    const username = session[token.value as unknown as number]

                    if (!username)
                        return status(401, {
                            success: false,
                            message: 'Unauthorized'
                        })
                }
            }
        }
    })

export const getUserId = new Elysia()
    .use(userService)
    .guard({
        isSignIn: true,
        cookie: 'session'
    })
    .resolve(({ store: { session }, cookie: { token } }) => ({
        username: session[token.value]
    }))
    .as('scoped')

export const user = new Elysia({ prefix: '/user' })
    .use(userService)
    .put(
        '/sign-up',
        async ({ body: { username, password }, store, status }) => {
            if (store.user[username])
                return status(400, {
                    success: false,
                    message: 'User already exists'
                })

            store.user[username] = await Bun.password.hash(password)

            return {
                success: true,
                message: 'User created'
            }
        },
        {
            body: 'signIn'
        }
    )
    .post(
        '/sign-in',
        async ({
            store: { user, session },
            status,
            body: { username, password },
            cookie: { token }
        }) => {
            if (
                !user[username] ||
                !(await Bun.password.verify(password, user[username]))
            )
                return status(400, {
                    success: false,
                    message: 'Invalid username or password'
                })

            const key = crypto.getRandomValues(new Uint32Array(1))[0]
            session[key] = username
            token.value = key

            return {
                success: true,
                message: `Signed in as ${username}`
            }
        },
        {
            body: 'signIn',
            cookie: 'optionalSession'
        }
    )
    .get(
        '/sign-out',
        ({ cookie: { token } }) => {
            token.remove()

            return {
                success: true,
                message: 'Signed out'
            }
        },
        {
            cookie: 'optionalSession'
        }
    )
    .use(getUserId)
    .get('/profile', ({ username }) => ({
        success: true,

Read the full file on GitHub · 1,385 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 1,385 lines · 0 tokens per session scan A 4069d9b33030

Subscribe to this mod's changes

elysia is a cursor rule published in the GitHub repository kerlos/elysia-mcp (47 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 9,444 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.