$npx -y skills add vercel/chat --skill add-adapterAdd a vendor-official or community adapter to the Chat SDK catalog and docs — adapters.json registry, chat/adapters catalog entry, the docs MDX page, meta.json, integration-test lists, and a changeset. Use when a developer wants to add, list, register, or submit a third-party (ve
| 1 | # Add a catalog adapter (vendor-official or community) |
| 2 | |
| 3 | Use this to list a **third-party** adapter in the Chat SDK catalog and docs. It is not for building a first-party `packages/adapter-*` package. |
| 4 | |
| 5 | ## Gather the source — never invent details |
| 6 | |
| 7 | Ask the user for: |
| 8 | |
| 9 | 1. Their adapter's **GitHub repository URL**. |
| 10 | 2. Their **docs or README**. |
| 11 | |
| 12 | Read both. Everything you write into the catalog and docs must come **directly** from those sources or from the user. Do not assume or guess any information: |
| 13 | |
| 14 | - **`packageName`** — read it from the repo's `package.json`, verbatim. |
| 15 | - **Factory export** (e.g. `createFooAdapter`) — read it from the package's exports/source. Do not guess it from the display name. |
| 16 | - **`type`** (`platform` or `state`), **env vars**, and the **feature matrix** — base these on what the code and README actually document. |
| 17 | - **Install and usage snippets** — take them from the README; do not write example code the adapter may not support. |
| 18 | |
| 19 | If the repo or README does not make something clear, **stop and ask the user** rather than filling it in. When in doubt, ask. |
| 20 | |
| 21 | Choose the `slug` (kebab-case) and confirm it is not already taken: `ls apps/docs/content/adapters/*/`. |
| 22 | |
| 23 | ## Pick the tier |
| 24 | |
| 25 | - **community** — listed in the docs only. No `chat/adapters` catalog entry, no changeset. |
| 26 | - **vendor-official** — a maintained/blessed adapter. Everything community has, plus a `chat/adapters` catalog entry, a matching `create-chat-sdk` scaffold-spec entry, and a changeset. Frontmatter adds `vendorOfficial: true` and `author`. |
| 27 | |
| 28 | ## Files to change |
| 29 | |
| 30 | `<tier>` is `vendor-official` or `community`. |
| 31 | |
| 32 | 1. **`apps/docs/content/adapters/<tier>/<slug>.mdx`** — the docs page. Start from [assets/adapter.mdx](assets/adapter.mdx). The filename basename must equal the `slug` frontmatter field, and the page must render `<FeatureSupport />`. |
| 33 | 2. **`apps/docs/content/adapters/<tier>/meta.json`** — add `"<slug>"` to the `pages` array. |
| 34 | 3. **`apps/docs/adapters.json`** — add a registry entry: `name`, `slug`, `type`, `community: true`, `description`, `packageName`, `author`, `readme` (the GitHub URL). Add `vendorOfficial: true` for vendor-official. |
| 35 | 4. **`packages/integration-tests/src/docs-adapters.test.ts`** — add `"<slug>"` to the hardcoded expected list for its tier. |
| 36 | 5. **`packages/integration-tests/src/documentation-test-utils.ts`** — add the `packageName` to `VALID_DOC_PACKAGES`, plus every import specifier used in the MDX code blocks (subpaths count separately). |
| 37 | |
| 38 | **Vendor-official also:** |
| 39 | |
| 40 | 6. **`packages/chat/src/adapters/index.ts`** — add an `ADAPTERS` entry with `group: "vendor-official"`. Reuse the `env`/`secretEnv`/`urlEnv` helpers; use `env: { notes: "…" }` when there are no env vars. See `packages/chat/src/adapters/AGENTS.md`. |
| 41 | 7. **`packages/create-chat-sdk/src/catalog/scaffold-spec.ts`** — add a matching `"<slug>": { invocation: … }` entry, modeled on a similar adapter. This is a required registration step, not a behavior change: the object is `satisfies Record<AdapterSlug, …>`, so every catalog slug must have one or `create-chat-sdk` fails to type-check. |
| 42 | 8. **`.changeset/<slug>-adapter.md`** — `"chat": patch` + `"create-chat-sdk": patch`, one line describing the addition. |
| 43 | |
| 44 | ## Invariants the tests enforce |
| 45 | |
| 46 | - **Registry ↔ catalog parity.** `Object.keys(ADAPTERS)` must equal the adapters.json slugs where `!community || vendorOfficial`. So vendor-official **must** be in `chat/adapters`; community-only **must not** be. This is why community adapters skip steps 6–8. |
| 47 | - **peerDeps ↔ PackageInstall.** The catalog entry's `peerDeps` (sorted) must exactly equal the extra packages in the MDX `<PackageInstall package="…" />`, after removing the adapter's own `packageName`, `chat`, and any `@chat-adapter/state-*`. Easiest: `peerDeps: []`, install only `<packageName> chat` (plus a state adapter) in `PackageInstall`, and keep any other imports in fenced code blocks. |
| 48 | - **Fields match.** `packageName`, `type`, `community`, and `vendorOfficial` must match between the MDX frontmatter and the adapters.json entry. |
| 49 | - **Required frontmatter:** `title`, `description`, `packageName`, `slug`, `tagline`, `type` (`platform` | `state`), `mdxBody: true`, `community: true` (plus `vendorOfficial: true` and `author` for vendor-official). |
| 50 | - **Imports.** Every import in an MDX code block must be listed in `VALID_DOC_PACKAGES`. |
| 51 | |
| 52 | ## Validate |
| 53 | |
| 54 | ```bash |
| 55 | pnpm --filter chat build # regenerate the catalog the tests import |
| 56 | pnpm --filter @chat-a |