next-action-handler

next-action-handler is a skill for Claude Code, Codex from mohamed-hossam1/nextjs-skills. It costs 49 tokens per session (1,759 once invoked), scanned A, original, MIT.

A setup skill for server actions in Next.js applications. It combines authentication, input validation, structured errors, and logging around those actions.

In plain words
What is it for?
Use it when adding or configuring next-action-handler, next-safe-action, action clients, validation errors, server-error handling, authentication errors, or pino logging.
Why use it?
It gives server-side actions a consistent way to check users, validate data, report failures, and record what happened.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or configuring next-action-handler, next-safe-action, action clients, validation errors, server-error handling, authentication errors, or pino logging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohamed-hossam1/nextjs-skills/next-action-handler
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohamed-hossam1/nextjs-skills --skill next-action-handler
Clone the repo
git clone --depth 1 https://github.com/mohamed-hossam1/nextjs-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for next-action-handler

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohamed-hossam1/nextjs-skills/next-action-handler/github.svg)](https://agentmods.dev/skills/mohamed-hossam1/nextjs-skills/next-action-handler)
Your own site
<a href="https://agentmods.dev/skills/mohamed-hossam1/nextjs-skills/next-action-handler"><img src="https://agentmods.dev/badge/skills/mohamed-hossam1/nextjs-skills/next-action-handler/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for next-action-handler

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohamed-hossam1/nextjs-skills/next-action-handler"><img src="https://agentmods.dev/badge/skills/mohamed-hossam1/nextjs-skills/next-action-handler.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.01759
Opus 5.5 $0.00020 $0.00704
Sonnet 5.5 $0.00010 $0.00352
Haiku 4.5 $0.00005 $0.00176

Measured 1mo ago against content hash ac428059f2c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

next-action-handler scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/next-action-handler/SKILL.md · 219 lines

How it starts

The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.

next-action-handler Skill

What It Does

next-action-handler installs a server action layer built on next-safe-action, better-auth, pino, and zod. It standardizes errors, logging, and auth context.

Installation

If you want a local dev dependency, install it first. Otherwise skip to Usage.

npm install -D next-action-handler

Usage

From the project root, run the installer:

npx next-action-handler@latest add

@latest forces npx to use the newest published version. The installer applies the full handler setup in one pass, with no component selection.

Install path detection order:

  1. lib/ -> lib/next-action-handler/
  2. app/lib/ -> app/lib/next-action-handler/
  3. Otherwise create lib/next-action-handler/

Dependencies installed: better-auth, next-safe-action, pino, pino-pretty, server-only, zod.

Required: auth-helpers.ts

safe-action.ts imports requireUser from ../auth-helpers. Create it before using authedActionClient.

// Good: required for authedActionClient
import { headers } from "next/headers";
import { auth } from "./auth";
import { UnauthorizedError } from "./next-action-handler/error/errors";

export async function requireUser() {
  const session = await auth.api.getSession({ headers: await headers() });
  if (!session?.user) throw new UnauthorizedError("You must be logged in");
  return session.user;
}

Action Clients and Metadata

Every action must call .metadata({ actionName }). The metadata schema requires it and the logger uses it.

// Good: metadata actionName is required
import { z } from "zod";
import {
  actionClient,
  authedActionClient,
} from "@/lib/next-action-handler/safe-action";
import { db } from "@/lib/db";

export const submitContactForm = actionClient
  .metadata({ actionName: "submitContactForm" })
  .inputSchema(
    z.object({ email: z.string().email(), message: z.string().min(1) }),
  )
  .action(async ({ parsedInput }) => {
    return { success: true, email: parsedInput.email };
  });

export const updateProfile = authedActionClient
  .metadata({ actionName: "updateProfile" })
  .inputSchema(z.object({ displayName: z.string().min(1) }))
  .action(async ({ parsedInput, ctx }) => {
    await db.users.update({
      id: ctx.user.id,
      displayName: parsedInput.displayName,
    });
    return { updated: true };
  });

Read the full file on GitHub · 219 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 219 lines · 49 tokens per session scan A ac428059f2c6

Subscribe to this mod's changes

next-action-handler is a skill published in the GitHub repository mohamed-hossam1/nextjs-skills (10 stars, last pushed 4mo ago), licensed MIT. It adds 49 tokens to every session and 1,759 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

neuron-laravel-integration

Integrate Neuron AI agents into a Laravel 13 app the framework-native way — setup checklist (App\Neuron layout, config/services.php keys, one migration, NeuronServiceProvider, bootstrap/app.php exception mapping, neuron:evaluate), container-built agents bound per thread with for(), thread authorization, JSON and…

neuron-core/neuron-ai · 236 tokens

neuron-agent

Create, configure, and extend Neuron AI agents in PHP using providers, tools, chat history, memory, and custom workflow nodes. Use for Neuron Agent implementation, configuration, conversation lifecycle, and input/output extensions.

neuron-core/neuron-ai · 48 tokens

github-oauth-nango-integration

Use when implementing GitHub OAuth + GitHub App authentication with Nango - provides two-connection pattern for user login and repo access with webhook handling.

AgentWorkforce/relay · 37 tokens

agentcore-register

Given an MCP server URL, probe the server via curl to discover its metadata and tools, then generate a markdown file with copy-pasteable content for each field in the Amazon Bedrock AgentCore "Create record" form.

agentic-community/mcp-gateway-registry · 49 tokens

semantix

Install and use the semantix memory kernel as a middleware in your agent: extract user preferences / workflows / experience from past sessions, retrieve and inject them on demand. One binary + your agent's own tools.

Gnosil/semantix · 47 tokens

semantix-guide

Troubleshoot and configure Semantix capabilities: Skills (project/custom/global/builtin priority, discovery dirs), Commands (override order, /dir:file naming), Hooks (11 events, automatic project loading, matchers, timeouts), MCP (semantix-agent.toml + .mcp.json + plugin packages, autostart), plugin packages…

Gnosil/semantix · 115 tokens