Agent skill
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 this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/managing-server-actions
SKILL.md
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
app/actions/or directly in the component file. - Use
'use server'at the top of the function or file. - Implement
try-catchfor error handling. - Call
revalidatePath()to refresh the UI.
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
revalidatePathfor the specific route orrevalidateTagfor broader invalidation.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?