Server Actions
Next.js Server Actions guide for defining, validating, and revalidating data mutations in the App Router.
- CCM score
- 57 of 100
- skills.sh installs
- 204
- GitHub stars
- 3.8K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers defining Server Actions inline in Server Components or in separate
'use server'files, plus form handling with validation - Explains state and feedback hooks
useFormStateanduseFormStatus, along with optimistic updates viauseOptimistic - Documents cache revalidation with
revalidatePathandrevalidateTag, plus redirects and error handling after actions - Includes a security section on input validation, authentication checks, and ownership checks before deleting records
Install
$ npx -y skills add davepoon/buildwithclaude --skill server-actions -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Next.js Server Actions
Overview
Server Actions are asynchronous functions that execute on the server. They can be called from Client and Server Components for data mutations, form submissions, and other server-side operations.
Defining Server Actions
In Server Components
Use the 'use server' directive inside an async function:
// app/page.tsx (Server Component)
export default function Page() {
async function createPost(formData: FormData) {
'use server'
const title = formData.get('title') as string
await db.post.create({ data: { title } })
}
return (
<form action={createPost}>
<input name="title" />
<button type="submit">Create</button>
</form>
)
}
In Separate Files
Mark the entire file with 'use server':
// app/actions.ts
'use server'
export async function createPost(formData: FormData) {
const title = formData.get('title') as string
await db.post.create({ data: { title } })
}
export async function deletePost(id: string) {
await db.post.delete({ where: { id } })
}
Form Handling
Basic Form
// app/actions.ts
'use server'
Details
- Repository
- github.com/davepoon/buildwithclaude
- Categories
- Frontend & UI Code, Backend & APIs
- First seen
- Jun 3, 2026
Questions
What does the server-actions skill help with in Next.js?
The server-actions skill guides data mutations and form submissions in the Next.js App Router. It covers defining Server Actions with the 'use server' directive, form handling with validation, useFormState and useFormStatus, revalidation with revalidatePath and revalidateTag, redirects, optimistic updates and error handling.
How do I install the server-actions skill?
Run npx -y skills add davepoon/buildwithclaude --skill server-actions -y in your project. Once installed, the agent can answer questions on Next.js Server Actions and form handling.
Who is the server-actions skill for?
It is for developers building with Next.js App Router who need to handle mutations and form submissions. It triggers on questions about useFormState, useFormStatus, revalidatePath and revalidateTag.
Where does server-actions stand in its category?
It sits in the Frontend & UI Code category, where web-design-guidelines and design-taste-frontend are among the other skills listed. It focuses on server-side mutation patterns rather than general frontend design guidance.
Does the server-actions skill cover security?
Yes, the skill includes security considerations such as validating input, checking authentication and authorization before a mutation, and sanitizing output. It shows an example that verifies the session and post ownership before deleting.
More from davepoon/buildwithclaude
All 2Similar to Server Actions
More Frontend & UI Codenextjs-corebobmatnyc/claude-mpm-skills375 installsApp Router patterns for Server Components, Server Actions, route handlers, and explicit caching with revalidation.
nextjs-best-practicessickn33/agentic-awesome-skills7.6K installsNext.js App Router principles covering Server vs Client Components, data fetching, routing, caching, and Server Actions.
nextjs-app-routergiuseppe-trisciuoglio/developer-kit4.2K installsModern App Router guide for Next.js 16+ covering Server Components, Server Actions, caching, and routing conventions.
react-patternsgiuseppe-trisciuoglio/developer-kit5.1K installsComprehensive React 19 patterns for Server Components, Server Actions, and concurrent features in Next.js.
safe-action-advancednext-safe-action/skills1.3K installsAdvanced next-safe-action features covering bind arguments, metadata, framework errors, type utilities, and server callbacks.
nexthairyf/skills864 installsNext.js framework guide covering App Router, Server Components, data fetching, caching, and Server Actions for full-stack React.