next-safe-action

AI Skills

next-safe-action provides a set of skills — structured knowledge files optimized for AI coding agents. When installed, these skills give your AI agent deep context about next-safe-action's API, patterns, and anti-patterns, enabling it to write better code with the library.

Installation

Skills are installed via the skills CLI. Run from your project root:

npx skills add next-safe-action/next-safe-action

This downloads the skills into your project where AI agents can discover and use them automatically.

Available Skills

SkillDescription
safe-action-clientClient creation, action definition, Standard Schema validation (Zod, Yup, Valibot), server error handling
safe-action-middlewareAuthentication, authorization, logging, rate limiting, context extension, createMiddleware()
safe-action-hooksuseAction, useOptimisticAction, status lifecycle, callbacks, execute vs executeAsync
safe-action-formsReact Hook Form adapter, native form submission, file uploads, bind arguments with forms
safe-action-validation-errorsreturnValidationErrors, formatted vs flattened shapes, custom error shapes, throwValidationErrors
safe-action-advancedBind arguments, metadata schemas, framework errors (redirect/notFound/forbidden/unauthorized), type utilities
safe-action-testingVitest patterns for testing actions, middleware, hooks, validation errors, and framework errors

How Skills Work

Skills are markdown files that AI agents load when they detect a relevant task. Each skill contains:

  • Correct API usage with complete, copy-paste-ready code examples
  • Anti-patterns showing common mistakes and how to fix them
  • Type information so the agent generates properly typed code
  • Sub-topic files for deep dives into specific features

Unlike documentation (designed for humans to browse), skills are structured for AI agents to quickly find the right pattern and generate accurate code.

Supported Agents

Skills work with any AI coding agent that supports the skills.sh format, including:

Visit skills.sh to learn more about the skills ecosystem.

On this page