/harness-claude:next-server-actionsfrom harness-claude
Mutates server-side data directly from Next.js components using async functions with progressive enhancement, form validation, and cache revalidation.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:next-server-actions still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Mutate server-side data directly from components using async functions — no API route required
'use server' at the top of an async function or at the top of a module containing only server functions.<form action={myAction}> for progressive enhancement — the form works without JavaScript.useFormStatus() from react-dom inside a child component to access pending state during form submission.useFormState() (renamed to useActionState() in React 19) to capture the return value of a Server Action and display validation errors.revalidatePath() or revalidateTag() after mutations to purge stale cached data.// app/actions/create-post.ts
'use server';
import { z } from 'zod';
import { revalidatePath } from 'next/cache';
const schema = z.object({ title: z.string().min(1).max(200) });
export async function createPost(prevState: unknown, formData: FormData) {
const parsed = schema.safeParse({ title: formData.get('title') });
if (!parsed.success) {
return { errors: parsed.error.flatten().fieldErrors };
}
await db.post.create({ data: { title: parsed.data.title } });
revalidatePath('/posts');
return { errors: null };
}
// app/posts/new/page.tsx
'use client';
import { useFormState, useFormStatus } from 'react-dom';
import { createPost } from '@/app/actions/create-post';
function SubmitButton() {
const { pending } = useFormStatus();
return <button disabled={pending}>{pending ? 'Saving...' : 'Save'}</button>;
}
export default function NewPostPage() {
const [state, action] = useFormState(createPost, null);
return (
<form action={action}>
<input name="title" />
{state?.errors?.title && <p>{state.errors.title}</p>}
<SubmitButton />
</form>
);
}
Server Actions compile to POST requests under the hood — Next.js generates a unique action ID and routes the request to the server function at runtime. This means they work in environments without JavaScript (progressive enhancement) and do not require a separate API endpoint.
Progressive enhancement: When a <form action={serverAction}> is rendered, the native HTML form submission triggers the Server Action even if client-side JS has not loaded. Enhance the experience with useFormStatus only after hydration.
Revalidation: After a mutation, the Data Cache and Full Route Cache entries for affected paths remain stale until explicitly invalidated. Call revalidatePath('/path') to purge by route or revalidateTag('tag') to purge by cache tag — both are imported from next/cache.
Error handling: Throwing inside a Server Action propagates the error to the nearest React error boundary. For user-facing validation errors, return a structured error object from the action instead of throwing.
Security: Server Actions are POST endpoints — they are subject to CSRF by nature (cookies are sent automatically by browsers). Next.js includes built-in CSRF protection via origin checking in Server Actions. Do not disable this protection.
React 19 rename: useFormState is renamed to useActionState in React 19 and moved from react-dom to react. Both work in Next.js 14/15 — prefer useActionState in new code.
https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job