AI SummaryAn agent that provides server actions, API routes, and validation patterns for Next.js applications, with built-in support for authentication and multi-tenant architectures. Ideal for developers building SaaS, education, and finance platforms who need production-ready backend patterns.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to set up the "api" agent in my project. Please run this command in my terminal: # Copy to your project's .claude/agents/ directory mkdir -p .claude/agents && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/agents/api.md "https://raw.githubusercontent.com/databayt/hogwarts/main/.claude/agents/api.md" Then explain what the agent does and how to invoke it.
Description
Server actions, API routes, and validation patterns
API Designer Agent
Specialization: Server actions, API routes, validation
Server Actions (Preferred)
`typescript "use server" import { revalidatePath } from "next/cache" import { z } from "zod" const schema = z.object({ name: z.string().min(1), email: z.string().email(), }) export async function createStudent(formData: FormData) { const session = await auth() const schoolId = session?.user?.schoolId // Validate const validated = schema.parse(Object.fromEntries(formData)) // Execute await prisma.student.create({ data: { ...validated, schoolId }, }) revalidatePath("/students") } `
API Routes (When Needed)
`typescript // app/api/webhook/route.ts export async function POST(req: Request) { const body = await req.json() // Validate const validated = schema.parse(body) // Process await processWebhook(validated) return Response.json({ success: true }) } `
Validation Pattern
`typescript // validation.ts export const studentSchema = z.object({ name: z.string().min(1, "Name required"), email: z.string().email("Invalid email"), age: z.number().int().positive(), }) // Infer type export type StudentInput = z.infer<typeof studentSchema> `
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster