server-api

server-api is a skill for Claude Code, Codex from YuDefine/nuxt-supabase-starter. It costs 51 tokens per session (1,133 once invoked), scanned A, original, MIT.

Guidance for designing server-side API routes in a Nuxt application, including validation, permissions, database writes, and response formats.

In plain words
What is it for?
Use it when creating files in server/api, building endpoints with defineEventHandler, or defining request and response schemas.
Why use it?
It keeps sensitive write operations and business rules on the server instead of exposing them directly in the browser.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/yudefine/nuxt-supabase-starter/server-api
Any agent
npx skills add YuDefine/nuxt-supabase-starter --skill server-api
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

Made for: Claude Code, Codex.

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 server-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/server-api.svg)](https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/server-api)
Your own site
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/server-api"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/server-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,133 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00051 $0.01133
Opus 5 $0.00026 $0.00566
Sonnet 5 $0.00010 $0.00227
Haiku 4.5 $0.00005 $0.00113

Measured 4d ago against content hash ed4a0d9e1360, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

server-api 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 4d 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.

template/.claude/skills/server-api/SKILL.md · 114 lines

How it starts

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

Server API 設計規範

Client 端只能 READ

Client 端(app/ 目錄)只能透過 useSupabaseClient<Database>() 執行 .select() 查詢。

禁止在 client 端使用: .insert() / .update() / .delete() / .upsert()

所有寫入操作必須透過 Server API(/api/v1/*):

// ❌ 錯誤 — client 端直接寫入
const client = useSupabaseClient<Database>();
await client.from("posts").insert({ title: "Hello" });

// ✅ 正確 — 透過 Server API
await $fetch("/api/v1/posts", {
  method: "POST",
  body: { title: "Hello" },
});

原因:

  • Server API 統一承接驗證、權限、商業邏輯與 request-scoped DB access
  • 統一在 server 端做驗證、權限檢查、業務邏輯
  • Client 端的 Supabase client 使用 anon key,寫入受 RLS 限制且無法做複雜驗證

契約來源

新增 API 時,request/response schema 請定義在 shared/schemas/,並由同一個模組導出衍生型別。

  • shared/schemas/*.ts:Zod schema + 衍生型別
  • shared/types/*.ts:相容轉發或 UI/view-model 型別,不是新的 request/response 真相來源

目錄結構

server/api/
├── v1/                       # 版本化業務 API
│   └── resources/
│       ├── index.get.ts      # GET /api/v1/resources(列表)
│       ├── index.post.ts     # POST /api/v1/resources(新增)
│       └── [id]/
│           ├── index.get.ts     # GET /api/v1/resources/:id
│           ├── index.patch.ts   # PATCH /api/v1/resources/:id
│           └── index.delete.ts  # DELETE /api/v1/resources/:id
├── auth/                     # 認證 API
└── admin/                    # 管理員 API

命名規範

  • 檔案名稱index.<method>.ts 格式
  • 路徑參數:有意義的名稱([resourceId] 優於 [id]
  • API 版本/api/v1/ 前綴

權限檢查

import { requireRole } from "~~/server/utils/supabase";

const user = await requireRole(event, ["admin", "manager"]);

// 角色階層:admin → manager → staff

回應格式

類型 格式
列表 { data: items, pagination: { page, pageSize, total, totalPages } }
單筆 { data: item }
新增 status 201 + { data: newItem }
刪除 { data: { id, deleted_at, hard_deleted } }

Read the full file on GitHub · 114 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 114 lines · 51 tokens per session scan A ed4a0d9e1360

Subscribe to this mod's changes

server-api is a skill published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It adds 51 tokens to every session and 1,133 once invoked, about $0.0003 per session on Opus 5. 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.

Related

Other skills, from other repositories

telemetry-standards

PostHog event tracking standards for Supabase Studio. Use when adding useTrack() calls, defining events in packages/common/telemetry-constants.ts, implementing tracking for a new feature, or reviewing PRs for telemetry compliance. Covers event naming, property conventions, approved patterns, and implementation guide.

supabase/supabase · 66 tokens

software-test-creation

Write failing tests for a TDD slice based on acceptance criteria and codebase conventions. Use when the "red" phase of red-green-refactor requires tests that define expected behavior before implementation exists. Discovers codebase test conventions first, writes test files that compile or parse but fail because the…

stencila/stencila · 82 tokens

prd-v09-launch-metrics

Define success criteria and tracking setup for launch during PRD v0.9 Go-to-Market. Triggers on requests to define launch metrics, set up tracking, or when user asks "how do we measure launch success?", "launch KPIs", "tracking setup", "success criteria", "analytics", "launch goals". Outputs KPI- entries specialized…

mattgierhart/PRD-driven-context-engineering · 81 tokens

prd-v06-architecture-design

Define how system components connect, establishing boundaries, patterns, and integration approaches during PRD v0.6 Architecture. Triggers on requests to design architecture, create system design, define component relationships, or when user asks "design architecture", "system design", "how do components connect?"…

mattgierhart/PRD-driven-context-engineering · 115 tokens

prd-v06-technical-specification

Define implementation contracts (APIs and data models) that developers will build against during PRD v0.6 Architecture. Triggers on requests to define APIs, design database schema, create data models, or when user asks "define APIs", "data model", "database schema", "API contracts", "technical spec", "endpoint…

mattgierhart/PRD-driven-context-engineering · 128 tokens

prd-v07-test-planning

Define test cases BEFORE implementation, ensuring every API, business rule, and user journey has verifiable acceptance criteria during PRD v0.7 Build Execution. Triggers on requests to define tests, plan test coverage, create test cases, or when user asks "define tests", "test planning", "what to test?", "test cases"…

mattgierhart/PRD-driven-context-engineering · 125 tokens