Claude-skill-registry-data managing-server-actions
Defines the standard pattern for Next.js 15 Server Actions to handle mutations securely. Use for form submissions and data updates.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry-data
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry-data "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/managing-server-actions" ~/.claude/skills/majiayu000-claude-skill-registry-data-managing-server-actions && rm -rf "$T"
manifest:
data/managing-server-actions/SKILL.mdsource content
Server Actions and Mutations
When to use this skill
- When handling form submissions (
).'use server' - When mutating data in Appwrite from the frontend.
- When you need to revalidate the cache after an update.
Workflow
- Create actions in
or directly in the component file.app/actions/ - Use
at the top of the function or file.'use server' - Implement
for error handling.try-catch - Call
to refresh the UI.revalidatePath()
Code Template (Next.js 15)
'use server' import { revalidatePath } from 'next/cache'; import { BookingService } from '@/services/bookings'; export async function createBookingAction(formData: FormData) { try { const tourId = formData.get('tourId') as string; // Logic to create booking... await BookingService.create({ ... }); revalidatePath('/dashboard/bookings'); return { success: true }; } catch (error) { return { success: false, error: 'Failed to create booking' }; } }
Instructions
- Security: Always validate user session/permissions inside the Server Action.
- Data Refresh: Use
for the specific route orrevalidatePath
for broader invalidation.revalidateTag