Skip to main content

create-supabase-middleware

Use when creating a new middleware for `@supabase/middleware` — either a built-in inside the middleware repo itself, or a standalone package that anyone can publish. Trigger when the user asks to write, scaffold, or add a middleware; describes a per-request cross-cutting concern they want to reuse ("I want to rate limit", "add request logging", "check an API key on every request"); calls `defineMiddleware`; or adds a new directory under `src/middleware/`. Also trigger when a plan proposes a new middleware, before any file is written.

소스 정보

저장소
supabase/middleware
최근 소스 활동
2026년 8월 12일 13:45
감지된 SKILL.md 언어
영어
스타
58
포크
2

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
create-supabase-middleware
description
Use when creating a new middleware for `@supabase/middleware` — either a built-in inside the middleware repo itself, or a standalone package that anyone can publish. Trigger when the user asks to write, scaffold, or add a middleware; describes a per-request cross-cutting concern they want to reuse ("I want to rate limit", "add request logging", "check an API key on every request"); calls `defineMiddleware`; or adds a new directory under `src/middleware/`. Also trigger when a plan proposes a new middleware, before any file is written.
# Creating a middleware Before scaffolding anything, check the concern is actually middleware-shaped: - **Response-only** — headers, envelopes, error formatting — belongs in the handler, which owns the response. Not a middleware. - **Used once, in one handler** — inline it. A middleware earns its keep by being composed across handlers. Then pick the target by reading the nearest `package.json`: | `name` is | You are writing | Follow | | ---------------------- | -------------------- | ------------------------------------------------------------------------------------- | | `@supabase/middleware` | a built-in | `src/middleware/README.md` — layout, then the three subpath-wiring files | | anything else | a standalone package | `docs/authoring-guide.md` — the full path, from `defineMiddleware` through publishing | Both paths use the same `defineMiddleware` primitive; the difference is only whose package it lives in and whether a subpath export has to be wired up. **Read the guide before writing code, and follow its `## Rules` section** — eight MUST/NEVER items covering one-key-per-middleware, `getEnv` over `process.env`/`Deno.env`, declaring prerequisites in `In`, `yield`ing at most once, and returning a `Response` to short-circuit rather than throwing. Its code blocks labeled with a path are complete files: write them to disk as given rather than adapting them from memory. Unlabeled blocks are fragments that elide with `{ ... }`. Never write those verbatim. Paths are repo-relative. When `@supabase/middleware` is installed as a dependency, prefix them with `node_modules/@supabase/middleware/`.
GitHub에서 보기