From 3fbb9a18372f2b6a675dd6c039ba52be76f3eeb4 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Fri, 16 Jan 2026 08:30:14 +0900 Subject: updates --- .../.claude/commands/create-server-action.md | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 frameworks/nextjs-15/.claude/commands/create-server-action.md (limited to 'frameworks/nextjs-15/.claude/commands/create-server-action.md') diff --git a/frameworks/nextjs-15/.claude/commands/create-server-action.md b/frameworks/nextjs-15/.claude/commands/create-server-action.md new file mode 100644 index 0000000..0e28d2b --- /dev/null +++ b/frameworks/nextjs-15/.claude/commands/create-server-action.md @@ -0,0 +1,27 @@ +--- +allowed-tools: Write, Read, MultiEdit +argument-hint: " [model/entity]" +description: Create a type-safe Server Action with validation and error handling +--- + +Create a Next.js 15 Server Action named "$ARGUMENTS" with: + +1. Proper 'use server' directive +2. Zod schema for input validation +3. Error handling and try-catch blocks +4. Type-safe return values +5. Authentication check (if applicable) +6. Rate limiting setup +7. Database operation (if entity provided) +8. Cache revalidation (revalidatePath/revalidateTag) +9. Proper TypeScript types throughout +10. Example usage in a form component + +The Server Action should follow security best practices: + +- Input validation and sanitization +- CSRF protection considerations +- Proper error messages (don't leak sensitive info) +- Audit logging for important operations + +Include both the server action file and an example client component that uses it with useActionState. -- cgit v1.2.3