create-server-action

Create secure Next.js Server Actions with authentication, Zod validation, and Drizzle ORM operations.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/keidsondesigner/nextjs-bewear-ecommerce --skill create-server-action-keidsondesigner
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-server-action
Source: https://github.com/keidsondesigner/nextjs-bewear-ecommerce/tree/main/.claude/skills/create-server-action
Command: npx skills add https://github.com/keidsondesigner/nextjs-bewear-ecommerce --skill create-server-action-keidsondesigner

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cria Server Actions seguras com autenticação, validação Zod e operações de banco de dados usando Drizzle ORM. Use quando precisar criar ou modificar Server Actions seguindo padrões de segurança Bewear.

Core Features & Use Cases

  • Two-file template: Sempre crie dois arquivos na pasta src/actions/nome-action/: index.ts (Server Action) e schema.ts (Validação Zod).
  • Security-first: Verificação de sessão/autenticação obrigatória antes de qualquer operação.
  • DB operations: Integração com Drizzle ORM para consultas, inserções e atualizações.
  • Cache revalidation: Revalidação de cache após mutações quando necessário.

Quick Start

Crie uma nova action em src/actions/<nome-action>/ com o template de dois arquivos e implemente uma Server Action simples com validação e operação de DB.

Frequently Asked Questions about create-server-action

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create secure Next.js Server Actions with authentication and database operations?

Secure Next.js Server Actions require a mandatory session check before executing database operations. You can automate this by structuring a two-file template with Zod validation in schema.ts and Drizzle ORM queries in index.ts.

What is the best way to validate Server Action inputs in Next.js using Zod?

Validating Server Action inputs with Zod involves defining schemas in a dedicated schema.ts file. This separates validation logic from your server action, ensuring data integrity before executing Drizzle ORM database mutations.

Do I need to use Drizzle ORM to build Server Actions with this two-file structure?

Yes, the two-file Server Action structure is designed specifically for Drizzle ORM database interactions. It standardizes how you execute secure queries, insertions, and updates alongside mandatory session authentication.

How do I revalidate cache after performing database mutations in Next.js Server Actions?

Cache revalidation after database mutations in Next.js Server Actions is handled within your action logic. Once Drizzle ORM completes the data update, you trigger revalidation to ensure subsequent fetches reflect the latest database state.

Why does my Next.js Server Action fail without a session check?

Server Actions fail without a session check because the security-first pattern mandates authentication before any operation. Enforcing this mandatory session verification prevents unauthorized access to your Drizzle ORM database interactions.