buchananwill/ue-claude-scaffold/api-response-format

Claude Code and agent skill by buchananwill/ue-claude-scaffold

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Consistent API response shapes, input validation schemas, and server action return types for TypeScript backends.

Install

npx vskill@latest install buchananwill/ue-claude-scaffold/api-response-format

SKILL.md

The same SKILL.md was published earlier as buchananwill/ue-claude-scaffold/api-response-format.

API Response Format

Consistent shapes for API responses, validated inputs, and server action returns.

When to Activate

  • Defining API route response types
  • Writing server actions
  • Validating request inputs with Zod
  • Returning errors from endpoints

Response Envelope

typescript
type ApiResponse<T> =
| { success: true; data: T }
| { success: false; error: string; code?: string }
// With pagination
type PaginatedResponse<T> = ApiResponse<T> & {
meta?: { total: number; page: number; limit: number }
}

Server Action Return Shape

typescript
'use server'
import { z } from 'zod'
const schema = z.object({
name: z.string().min(1).max(100),
})
export async function createProject(formData: FormData) {
const parsed = schema.safeParse({ name: formData.get('name') })
if (!parsed.success) {
return { success: false, error: parsed.error.flatten() }
}
// ... perform action
if (error) return { success: false, error: 'Failed to create project' }
return { success: true, data }
}

Input Validation Pattern

Always validate at system boundaries using Zod:

typescript
import { z } from 'zod'
const CreateItemSchema = z.object({
name: z.string().min(1).max(200),
description: z.string().min(1).max(2000),
endDate: z.string().datetime(),
categories: z.array(z.string()).min(1),
})
export async function POST(request: Request) {
const body = await request.json()
const result = CreateItemSchema.safeParse(body)
if (!result.success) {
return Response.json(
{ success: false, error: 'Validation failed', details: result.error.errors },
{ status: 400 }
)
}
// Proceed with result.data (fully typed)
}

Error Response Rules

  • Generic messages to clients ('An error occurred'), detailed errors to server logs
  • Never expose stack traces, internal paths, or SQL errors to the client
  • Use code field for machine-readable error classification when needed

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
7-day trend score
10

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/buchananwill/ue-claude-scaffold/api-response-format/badge)](https://verified-skill.com/skills/buchananwill/ue-claude-scaffold/api-response-format)

Something wrong with this skill or its page? Tell us.