Skip to content
Development
Skill

/add-function-examples

Guide for adding new AI function examples, for testing specific features against the actual provider APIs.

From plugin
ai
28k13 skills

Claude Code

$ npx -y skills add vercel/ai --skill add-function-examples --agent claude-code

SKILL.md

add-function-examples.SKILL.md
name: add-function-examples
description: Guide for adding new AI function examples, for testing specific features against the actual provider APIs.
metadata:
  internal: true

Adding Function Examples

Review the changes in the current branch, and identify new or modified behavior that would benefit from a reusable example in the `examples/ai-functions` directory. These examples are used for testing specific features against the actual provider APIs, and can also serve as documentation for users.

For bug reproductions, follow the [bug-fix workflow in AGENTS.md](../../AGENTS.md#bug-fixes): reproduce the failure end-to-end with a temporary script outside the checkout, then rerun it to verify the fix. Build and use the checkout's local packages for both runs. Publish reproduction-only code **only in the PR description's End-to-End Verification section**, in a collapsible `<details>` block with the complete runnable script, commands, and observed before/after results, following `.github/pull_request_template.md`. **Never commit reproduction-only files**, including under `examples/ai-functions` or elsewhere in the repository. Regression tests and reusable examples that demonstrate supported usage (including fixed behavior) still belong in the repository.

Place reusable examples under `examples/ai-functions/src/<function>/<provider>/`, such as `examples/ai-functions/src/stream-text/openai/tool-call.ts`. Use `basic.ts` for the provider entry example and descriptive `kebab-case.ts` names for additional examples. Do not create flat provider files such as `src/stream-text/openai.ts`.

Determine for which kind of model and top-level function the example should be added. For a language model, the example should be added in two variants, one for `generateText` and one for `streamText`. For any other models kinds, add the example for the relevant top-level function (e.g. `generateImage`, `generateSpeech`).

After creating the example, run `pnpm type-check:full`; fix any errors encountered.

Read more
@vercel
Ships withai

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

Stars on GitHub

Momentum

stars in total
27.7k
Star history of vercel/ai on GitHub, a chart by star-history.com

Other skills on ai.

add-harness-package

add-harness-package

Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent…

@vercel@vercelInstall Skill
add-provider-package

add-provider-package

Guide for adding first-party AI provider packages to the AI SDK. Use when creating a provider package under packages/ to…

@vercel@vercelInstall Skill
adr-skill

adr-skill

Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose,…

@vercel@vercelInstall Skill
develop-ai-functions-example

develop-ai-functions-e…

Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to…

@vercel@vercelInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about add-function-examples.

Which coding agents can use add-function-examples?
add-function-examples installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.