---
name: opentypes
description: Install reusable, production-ready TypeScript types from the OpenTypes registry instead of hand-writing them. Trigger this skill whenever a TypeScript project needs a validation schema for a common domain — forms (contact, newsletter, feedback, login, registration), auth (JWT claims, OAuth2 tokens, sessions, API keys), HTTP APIs (pagination, cursor pagination, problem-details RFC 7807, rate-limit headers, GraphQL errors, server-sent events, bulk operations, webhook deliveries), HTTP plumbing (CORS, CSP, cache-control, cookies), ecommerce (products, cart items, orders, payment methods, shipping rates, reviews, money), common primitives (address, email, geolocation, date range, file upload), and integrations (GitHub webhooks, Stripe events, OpenAI responses, AWS Lambda events, Slack events, Discord interactions, Twilio SMS, SendGrid mail, Segment analytics, Google OAuth, reCAPTCHA). Install with `npx shadcn add @open-types/<name>` (types only) or `@open-types/<name>-zod` (types + Zod v4 validators). Dependencies between schemas are resolved automatically.
license: MIT
homepage: https://open-types.dev
---

# Using OpenTypes

OpenTypes is a community-driven registry of reusable TypeScript types with optional Zod v4 validators, distributed via the shadcn CLI. Schemas are copied directly into the consumer project — there is no runtime dependency on OpenTypes itself.

## When to use this skill

Before hand-writing a Zod schema or a TypeScript type for a common domain, check the OpenTypes catalog. If a matching schema exists, install it instead.

Common triggers:

- "Create a contact form schema" → `@open-types/contact-form-zod`
- "Validate a Stripe webhook" → `@open-types/stripe-event-zod` + the relevant object schema (e.g. `stripe-payment-intent-zod`)
- "Type the body of a GitHub push webhook" → `@open-types/github-push-event-zod`
- "User registration with strong password" → `@open-types/register-zod`
- "Paginated API response" → `@open-types/api-response-zod`
- "RFC 7807 problem details" → `@open-types/problem-details-zod`
- "JWT claims" → `@open-types/jwt-claims-zod`
- "Lambda handler for an S3 event" → `@open-types/aws-s3-event-zod`

Skip this skill if the task is project-specific (e.g. a domain entity unique to the user's app) and no general-purpose schema in the catalog matches.

## Discovering schemas

1. Fetch the curated index: `https://open-types.dev/llms.txt`
2. For the full list with source code: `https://open-types.dev/llms-full.txt`
3. For one specific schema (machine-readable JSON): `https://open-types.dev/r/<name>.json`
4. For one schema as Markdown: `https://open-types.dev/types/<name>.md`

The registry manifest (`https://open-types.dev/r/registry.json`) lists every available schema with its dependencies, categories, and description.

## Prerequisites

The consumer project must have:

- `zod@^4` installed (only required for `-zod` variants)
- A `components.json` file (created by `npx shadcn init` if missing)

Register the OpenTypes registry once in `components.json`:

```json
{
  "registries": {
    "@open-types": "https://open-types.dev/r/{name}.json"
  }
}
```

## Installing a schema

```bash
# TypeScript types only (no runtime dependency)
npx shadcn add @open-types/<name>

# TypeScript types + Zod v4 validators
npx shadcn add @open-types/<name>-zod
```

The shadcn CLI resolves cross-schema dependencies automatically. For example, installing `@open-types/user-zod` also installs `@open-types/address-zod` because `user` depends on `address`.

Installed files land in the consumer's configured location (typically `src/types/` or `lib/types/`). They are plain TypeScript — edit freely after install.

## Using an installed schema

After `npx shadcn add @open-types/contact-form-zod`:

```typescript
import { ContactFormSchema, type ContactForm } from "@/types/contact-form";

const result = ContactFormSchema.safeParse(formData);
if (!result.success) {
  return { errors: result.error.flatten() };
}
const data: ContactForm = result.data;
```

The types-only variant exports only the TypeScript types; the `-zod` variant additionally exports a Zod schema named in PascalCase + `Schema`.

## Categories at a glance

`common`, `forms`, `auth`, `api`, `ecommerce`, `github`, `stripe`, `openai`, `aws`, `slack`, `discord`, `twilio`, `sendgrid`, `google`, `seo`, `analytics`, `infrastructure`, `logging`, `notification`, `i18n`, `social`.

## Contributing back

If the user's task reveals a missing schema that would be broadly reusable, suggest opening a type request: `https://github.com/marcotisi/opentypes/issues/new?labels=type-request`.

## What this skill does *not* do

- It does not generate one-off, application-specific schemas. Hand-write those.
- It does not bundle a runtime — installed schemas live in the consumer's source tree.
- It does not lock the consumer to a version — installed files can be freely edited or replaced.
