kb-api

Official

Design safe Next.js server actions and APIs.

AuthorTimeKast
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It prevents inconsistent API behavior in Next.js 16+ by standardizing how server actions and route handlers handle validation, authorization, revalidation, and error responses.

Core Features & Use Cases

  • ActionResult<T> Contract: Uses a discriminated union to reliably separate success data from user-facing error strings for cleaner consumer branching.
  • Portable CRUD Action Signatures: Defines consistent getEntities, getEntityById, createEntity, updateEntity, and deleteEntity semantics that work across projects.
  • Boundary-First Validation: Enforces Zod safeParse exactly once at the action or route boundary to establish a clear trust boundary.
  • Success-Only Cache Invalidation: Applies revalidatePath only after a real mutation succeeds, and never on read-only actions.
  • Next.js 16+ Correctness for params/searchParams: Treats params and searchParams as Promises and parses them safely with await.

Quick Start

Implement your server action or route handler using the ActionResult<T> pattern, validate inputs with Zod safeParse at the boundary, and call revalidatePath only on the success path after the mutation completes.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: kb-api
Download link: https://github.com/TimeKast/AgendaInteligente/archive/main.zip#kb-api

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.