Skip to content
Agent

api

by databayt

AI Summary

An 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

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 1mo ago
Active
AdoptionUnder 100 stars
10 ★ · Niche
DocsMissing or thin
Undocumented

GitHub Signals

Stars10
Forks8
Issues27
Updated1mo ago
View on GitHub
No License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Claude Code