summaryrefslogtreecommitdiff
path: root/.claude/commands/create-server-action.md
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 17:06:49 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 17:06:49 +0900
commitadf5e96542ebd65c7d13ca5e9825071183b3ef13 (patch)
tree699800730cc9f68ab775bea5722ba55cf08b304a /.claude/commands/create-server-action.md
parentb8dc7344ff99eb23d5f003795f17cdba3b89c40b (diff)
fix: lint fixes for integration tests and backtester noqa annotations
Diffstat (limited to '.claude/commands/create-server-action.md')
-rw-r--r--.claude/commands/create-server-action.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/.claude/commands/create-server-action.md b/.claude/commands/create-server-action.md
new file mode 100644
index 0000000..0e28d2b
--- /dev/null
+++ b/.claude/commands/create-server-action.md
@@ -0,0 +1,27 @@
+---
+allowed-tools: Write, Read, MultiEdit
+argument-hint: "<action-name> [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.