AP

api-design

Guidelines for designing robust, type-safe API boundaries and messaging protocols.

Install

mkdir -p .claude/skills/api-design-kabaka && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10809" && unzip -o skill.zip -d .claude/skills/api-design-kabaka && rm skill.zip

Installs to .claude/skills/api-design-kabaka

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Internal API contract design, type-safe interfaces, and worker/WASM message protocols.
86 charsno explicit “when” trigger
Advanced

Key capabilities

  • Define type-safe interfaces
  • Design worker message protocols
  • Structure WASM interop boundaries
  • Implement storage service layers

How it works

It applies principles like minimal surface exposure and discriminated unions to create reliable communication boundaries between system modules.

Inputs & outputs

You give it
Module interface requirements
You get back
Type-safe API contract definition

When to use api-design

  • Design worker message protocol
  • Define type-safe API contract
  • Structure wasm interop

About this skill

API Design

Use this skill when defining interfaces between modules, worker message protocols, or WASM interop boundaries.

Principles

  • Minimal surface: expose only what consumers need.
  • Type-safe boundaries: no any at API boundaries. Use discriminated unions for messages.
  • Immutable data: prefer readonly types at boundaries.
  • Explicit errors: use Result types or discriminated unions for expected failures.
  • Serializable messages: worker/AudioWorklet messages must be structured-clone-safe.

Worker Message Protocol

Messages between main thread and workers/AudioWorklet use a discriminated union:

type MainToWorker =
  | { type: 'load'; spcData: ArrayBuffer }
  | { type: 'play'; startSample?: number }
  | { type: 'pause' }
  | { type: 'set-voice-mask'; mask: number }
  | { type: 'set-speed'; factor: number };

type WorkerToMain =
  | { type: 'ready' }
  | { type: 'position'; sample: number }
  | { type: 'error'; message: string; code: string }
  | { type: 'metadata'; tags: SpcMetadata };
  • Every message has a type discriminator.
  • Protocol versioning: include a version field in the initial handshake.
  • Use Transferable for large buffers (ArrayBuffer) to avoid copies.

WASM Interop

  • Export only the functions JS needs to call.
  • Use typed views (Float32Array, Int16Array) over WASM linear memory.
  • Document memory layout: who allocates, who frees, what alignment.
  • Keep the interop layer thin — logic lives in WASM or JS, not in the bridge.

Storage API

  • IndexedDB access goes through a typed service layer.
  • Operations return Promise<Result<T, StorageError>> or equivalent.
  • Schema version is explicit. Migrations run on open.
  • Transactions are scoped to the minimum necessary stores.

Rules

  • Define interfaces before implementation.
  • Changes to public APIs require review from the api-designer.
  • Breaking changes to message protocols require a version bump and migration path.

When not to use it

  • When defining simple, non-shared logic
  • When performance is not a concern for interop

Limitations

  • Requires review from api-designer for public API changes

How it compares

It enforces strict type safety and explicit error handling at boundaries rather than relying on loose object passing.

Compared to similar skills

api-design side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
api-design (this skill)04moNo flagsAdvanced
mcp-builder1363moReviewAdvanced
nodejs-backend-patterns122moNo flagsIntermediate
juicebox-reference-architecture027dReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

mcp-builder

anthropics

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

136215

nodejs-backend-patterns

wshobson

Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

1246

juicebox-reference-architecture

jeremylongshore

Implement Juicebox reference architecture. Use when designing system architecture, planning integrations, or implementing enterprise-grade Juicebox solutions. Trigger with phrases like "juicebox architecture", "juicebox design", "juicebox system design", "juicebox enterprise".

01

perplexity-reference-architecture

jeremylongshore

Implement Perplexity reference architecture with best-practice project layout. Use when designing new Perplexity integrations, reviewing project structure, or establishing architecture standards for Perplexity applications. Trigger with phrases like "perplexity architecture", "perplexity best practices", "perplexity project structure", "how to organize perplexity", "perplexity layout".

10

vendor-implementation

No-Trade-No-Life

基于Hyperliquid成功实现经验,为新交易所供应商提供Yuan框架集成指南。使用此技能当需要为新的交易所创建供应商实现,包括项目结构设计、API集成、核心服务实现和最佳实践。适用于交易所API集成、金融系统开发、微服务架构设计。

01

instantly-reference-architecture

jeremylongshore

Implement Instantly reference architecture with best-practice project layout. Use when designing new Instantly integrations, reviewing project structure, or establishing architecture standards for Instantly applications. Trigger with phrases like "instantly architecture", "instantly best practices", "instantly project structure", "how to organize instantly", "instantly layout".

00

Search skills

Search the agent skills registry