api-endpoint-creation

Next.js 15+ API endpoint creation patterns with Supabase and workspace validation

25 stars

Best use case

api-endpoint-creation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Next.js 15+ API endpoint creation patterns with Supabase and workspace validation

Teams using api-endpoint-creation should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-endpoint-creation/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/aiskillstore/marketplace/cleanexpo/api-endpoint-creation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-endpoint-creation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-endpoint-creation Compares

Feature / Agentapi-endpoint-creationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Next.js 15+ API endpoint creation patterns with Supabase and workspace validation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# API Endpoint Creation Skill
## Next.js 15+ API Route Patterns

**When to Use**: Creating new API endpoints in src/app/api/

---

## Standard Pattern

```typescript
import { NextRequest } from 'next/server';
import { getSupabaseServer } from '@/lib/supabase';
import { validateUserAndWorkspace } from '@/lib/api-helpers';
import { successResponse, errorResponse } from '@/lib/api-helpers';
import { withErrorBoundary } from '@/lib/error-boundary';

export const GET = withErrorBoundary(async (req: NextRequest) => {
  // 1. Extract workspace_id from query params
  const workspaceId = req.nextUrl.searchParams.get("workspaceId");
  if (!workspaceId) {
    return errorResponse("workspaceId required", 400);
  }

  // 2. Validate user has access to workspace
  await validateUserAndWorkspace(req, workspaceId);

  // 3. Get Supabase client (server-side)
  const supabase = getSupabaseServer();

  // 4. Query with workspace_id filter (MANDATORY)
  const { data, error } = await supabase
    .from("your_table")
    .select("*")
    .eq("workspace_id", workspaceId);

  if (error) {
    return errorResponse(error.message, 500);
  }

  // 5. Return success response
  return successResponse(data);
});
```

---

## POST Endpoint Pattern

```typescript
export const POST = withErrorBoundary(async (req: NextRequest) => {
  const workspaceId = req.nextUrl.searchParams.get("workspaceId");
  if (!workspaceId) {
    return errorResponse("workspaceId required", 400);
  }

  const user = await validateUserAndWorkspace(req, workspaceId);
  const supabase = getSupabaseServer();

  // Parse request body
  const body = await req.json();
  const { name, data } = body;

  // Validation
  if (!name) {
    return errorResponse("name required", 400);
  }

  // Insert with workspace_id
  const { data: result, error } = await supabase
    .from("your_table")
    .insert({
      workspace_id: workspaceId,
      name,
      data,
      created_by: user.id
    })
    .select()
    .single();

  if (error) {
    return errorResponse(error.message, 500);
  }

  return successResponse(result, 201);
});
```

---

## Required Imports

```typescript
import { NextRequest } from 'next/server';
import { getSupabaseServer } from '@/lib/supabase';
import { validateUserAndWorkspace } from '@/lib/api-helpers';
import { successResponse, errorResponse } from '@/lib/api-helpers';
import { withErrorBoundary } from '@/lib/error-boundary';
```

---

## Checklist

- [ ] Use withErrorBoundary wrapper
- [ ] Validate workspace_id from query params
- [ ] Call validateUserAndWorkspace
- [ ] Use getSupabaseServer() for DB access
- [ ] Filter ALL queries by workspace_id
- [ ] Return successResponse or errorResponse
- [ ] Handle errors properly
- [ ] Add TypeScript types

---

**Standard**: Every API route MUST validate workspace and filter by workspace_id

Related Skills

vertex-ai-endpoint-config

25
from ComeOnOliver/skillshub

Vertex Ai Endpoint Config - Auto-activating skill for GCP Skills. Triggers on: vertex ai endpoint config, vertex ai endpoint config Part of the GCP Skills skill category.

sagemaker-endpoint-deployer

25
from ComeOnOliver/skillshub

Sagemaker Endpoint Deployer - Auto-activating skill for ML Deployment. Triggers on: sagemaker endpoint deployer, sagemaker endpoint deployer Part of the ML Deployment skill category.

rest-endpoint-designer

25
from ComeOnOliver/skillshub

Rest Endpoint Designer - Auto-activating skill for API Development. Triggers on: rest endpoint designer, rest endpoint designer Part of the API Development skill category.

fastapi-ml-endpoint

25
from ComeOnOliver/skillshub

Fastapi Ml Endpoint - Auto-activating skill for ML Deployment. Triggers on: fastapi ml endpoint, fastapi ml endpoint Part of the ML Deployment skill category.

ai-podcast-creation

25
from ComeOnOliver/skillshub

Create AI-powered podcasts with text-to-speech, music, and audio editing. Tools: Kokoro TTS, DIA TTS, Chatterbox, AI music generation, media merger. Capabilities: multi-voice conversations, background music, intro/outro, full episodes. Use for: podcast production, audiobooks, voice content, audio newsletters. Triggers: podcast, ai podcast, text to speech podcast, audio content, voice over, ai audiobook, multi voice, conversation ai, notebooklm alternative, audio generation, podcast automation, ai narrator, voice content, audio newsletter, podcast maker

mcp-tool-creation

25
from ComeOnOliver/skillshub

Master creating MCP tools with type-safe parameters, automatic schema generation, and best practices

vm-template-creation

25
from ComeOnOliver/skillshub

Create, configure, and manage VM templates in Proxmox. Build reusable VM images for rapid deployment of standardized environments, including Kubernetes clusters and managed applications.

ui-component-creation

25
from ComeOnOliver/skillshub

Creates UI components using shadcn/ui and design system patterns

new-agent-creation

25
from ComeOnOliver/skillshub

Provides step-by-step templates and guidance for creating new AI agents in Unite-Hub with proper registration, testing, and governance

github-pr-creation

25
from ComeOnOliver/skillshub

MUST use this skill when user asks to create PR, open pull request, submit for review, or mentions "PR 생성/만들기". This skill OVERRIDES default PR creation behavior. Analyzes commits, validates task completion, generates Conventional Commits title and description, suggests labels.

add-endpoint

25
from ComeOnOliver/skillshub

Add new HTTP endpoints to Catalyst-Relay server. Use when creating routes, API endpoints, or HTTP handlers.

SKILL: Endpoint Detection and Response

25
from ComeOnOliver/skillshub

## Metadata