hai-kit

Centralize auth, guards, and Zod-validated contract routing for SvelteKit applications.

3|7|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/hai-series/hai-framework --skill hai-kit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hai-kit
Source: https://github.com/hai-series/hai-framework/tree/main/packages/cli/templates/skills/hai-kit
Command: npx skills add https://github.com/hai-series/hai-framework --skill hai-kit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

hai-kit consolidates request handling, security boundaries, and contract-driven endpoints for SvelteKit into a single, consistent namespace, reducing boilerplate and errors across projects.

Core Features & Use Cases

  • Centralizes request entry points (kit.createHandle / kit.sequence) and security guards (kit.guard.*) to standardize API behavior.
  • Enables type-safe, contract-driven endpoints via kit.fromContract with auto Zod validation, improving developer confidence and runtime safety.
  • Provides reusable API utilities (kit.handler, kit.response, kit.validate) and Bearer Token authentication to streamline secure API development across SSR and CSR.
  • Use Case: Build a multi-endpoint admin interface with uniform auth, rate limiting, CORS, and consistent responses.

Quick Start

Create a SvelteKit handle using kit.createHandle with auth, rateLimit, and cors options, then compose routes with kit.fromContract and kit.handler.

Frequently Asked Questions about hai-kit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I centralize authentication and request handling in SvelteKit?

Centralize authentication and request handling in SvelteKit by using a unified handle function with security guards to standardize API behavior and reduce boilerplate. This approach leverages Bearer Token authentication and kit APIs for end-to-end safety.

What's the best way to create type-safe API endpoints in SvelteKit?

Create type-safe API endpoints in SvelteKit using contract-driven routing with Zod schemas for auto validation. This method improves developer confidence and runtime safety by ensuring consistent API behaviors across your application.

Can I use Bearer Token authentication for both SSR and CSR in SvelteKit?

Yes, Bearer Token authentication supports both SSR and CSR in SvelteKit. Reusable API utilities like handler, response, and validate streamline secure API development across server-side and client-side rendering environments.

Does SvelteKit support contract-driven routing with auto validation?

SvelteKit supports contract-driven routing with auto validation through kit.fromContract. This feature enables type-safe endpoints by leveraging Zod schemas, ensuring runtime safety and consistent responses across your application.

How do I set up a multi-endpoint admin interface with uniform auth in SvelteKit?

Set up a multi-endpoint admin interface in SvelteKit by creating a handle with auth, rate limiting, and CORS options. Compose routes using contract-driven handlers to ensure uniform authentication, security boundaries, and consistent responses.

Why are my SvelteKit API behaviors inconsistent across different endpoints?

SvelteKit API behaviors become inconsistent when auth, guards, and responses are scattered. Consolidate request handling, security boundaries, and contract-driven endpoints into a single namespace to reduce boilerplate and errors.