api-designer
Server action patterns
When & Why to Use This Skill
The API Designer skill is a specialized tool for developers to standardize and streamline server action patterns within modern web frameworks. It focuses on implementing robust, type-safe backend logic by enforcing best practices such as Zod schema validation, multi-tenant context handling, and automated cache revalidation, ensuring high-quality API architecture and data integrity.
Use Cases
- Standardizing Server Actions: Establish a consistent workflow for server-side operations to improve code maintainability and team collaboration.
- Input Validation & Security: Leverage Zod integration to ensure all incoming data is strictly validated and type-safe before execution.
- Multi-tenant Data Management: Seamlessly incorporate contextual identifiers like schoolId into operations to maintain secure data isolation.
- Automated Cache Invalidation: Ensure real-time UI updates by automatically triggering revalidatePath() after successful database mutations.
- Error Handling Optimization: Implement a unified pattern for catching and processing server-side errors to provide a better user experience.
| name | API Designer |
|---|---|
| description | Server action patterns |
| version | 1.0.0 |
| category | api |
API Design Skill
Server Action Pattern
- Validate with Zod
- Include schoolId
- Execute operation
- revalidatePath()
- Handle errors
Checklist
- Zod validation
- schoolId included
- Revalidation called
- Type-safe