add-function-examples
Guide for adding new AI function examples, for testing specific features against the actual provider APIs.
Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent runtime to HarnessV1.
$ npx -y skills add vercel/ai --skill add-harness-package --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/add-harness-packageContext preview
The summary Claude sees to decide when to auto-load this skill.
Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent runtime to HarnessV1.
name: add-harness-package description: Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent runtime to HarnessV1. metadata: internal: true
This guide covers creating a new `@ai-sdk/harness-<name>` package for an agent harness.
A harness can be **host-driven**, where the runtime runs in the host process and uses the sandbox remotely, or **bridge-backed**, where a small bridge runs inside the sandbox because the runtime needs local access to the sandbox filesystem or process environment. Prefer host-driven when the runtime supports it.
See https://github.com/vercel/ai/pull/16255/changes for a complete example of adding a new harness.
The AI SDK uses a layered harness architecture following the adapter pattern:
1. **Harness specification** (`@ai-sdk/harness`): Defines interfaces like `HarnessV1` and `HarnessV1Session` 2. **Utilities** (`@ai-sdk/harness/utils`): Shared code for implementing harnesses 3. **Harness implementations** (`@ai-sdk/harness-<name>`): Concrete adapters for harnesses 4. **Harness agent** (`@ai-sdk/harness/agent`): The high-level user-facing `HarnessAgent` API
Create `packages/harness-<name>` with this baseline structure:
packages/harness-<name>/ ├── src/ │ ├── index.ts │ ├── <name>-harness.ts │ ├── <name>-harness.test.ts │ └── <name>-auth.ts # if the runtime needs auth resolution ├── package.json ├── tsconfig.json ├── tsconfig.build.json ├── tsup.config.ts ├── turbo.json ├── vitest.node.config.js └── README.md
If the runtime must execute inside the sandbox, add bridge files as well:
src/
├── <name>-bridge-protocol.ts
├── <name>-bridge-protocol.test.ts
└── bridge/
├── index.ts
├── package.json
└── pnpm-lock.yamlAdd a `CHANGELOG.md` containing just the package heading (`# @ai-sdk/harness-<name>`). Every package is required to have one.
Use existing harness packages as the source of truth for scripts, exports, repository metadata, and publish settings.
Required package basics:
For bridge packages, add any bridge asset copy step required for files under `src/bridge/`.
Bridge dependency rules (bridge-backed harnesses):
Copy the nearest existing harness package config files and adjust paths/package names:
Harness packages currently use Node tests only unless the implementation has a specific reason to add another runtime.
Export a factory from `<name>-harness.ts` and re-export it from `src/index.ts`.
Use the architecture doc for contract details. At implementation time, verify:
The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and agents
Repo: vercel/ai
Guide for adding new AI function examples, for testing specific features against the actual provider APIs.
Guide for adding first-party AI provider packages to the AI SDK. Use when creating a provider package under packages/ to integrate an external AI service.
Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose, write, update, accept/reject,…
Capture API response test fixture.
Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to validate provider support,…
List the contents of an npm package tarball before publishing. Use when the user wants to see what files are included in an npm bundle, verify package…