What problem does it solve?
This Skill standardizes the development of Next.js Server Actions, eliminating common pitfalls and ensuring consistent patterns for authentication, validation, error handling, caching, and client-side consumption.
Core Features & Use Cases
- Automated Convention Enforcement: Ensures server actions use appropriate clients (
authActionClient, adminActionClient), validate input with Zod, and handle errors consistently.
- Integrated Caching & Sentry: Automatically includes cache invalidation after mutations and sets Sentry context for robust monitoring.
- Client-Side Consumption Patterns: Guides the use of the
useServerAction hook for consistent loading states, toast messages, and result access.
- Use Case: When creating a server action to update a user's profile, this Skill ensures the action uses
authActionClient, validates input via Zod, sets Sentry context, delegates logic to a facade, invalidates the user profile cache, and returns a consistent response shape.
Quick Start
Create a new Next.js server action to handle user profile updates, ensuring it uses authActionClient, validates input with Zod, and invalidates the cache upon success.