Index of every page on this site: llms.txt
All skills
vercel avatar

/add-function-examples

@a8f0e9d official
by vercelvercel/ai28k stars
5,666
Run it yourself

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

Use this Skill: https://skilld.dev/gh/vercel/ai/add-function-examples

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈32 tokens for metadata: the name and description. ≈459 when used: this file.

Description uses 1.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈130 characters, or 1.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

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: 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; fix any errors encountered.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7mo3 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill provides clear guidelines for developers to add AI function examples for testing and documentation purposes. It follows standard development practices, such as running type checks, and does not exhibit any security concerns.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

Signed by skilld at a8f0e9d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated yesterday
metadata
{
  "internal": true
}

README badge

README badge for vercel/ai/add-function-examples

Creates and maintains AI function examples in the Vercel AI SDK repository to test new features against actual provider APIs. Guides developers to add example variants for generateText, streamText, generateImage, and other top-level functions, then validate with type-checking.

Generated from the current SKILL.md.

What is this skill for?
This skill guides adding new AI function examples to the vercel/ai library's examples/ai-functions directory for testing features against actual provider APIs.
Which functions should I create examples for?
For language models, create two variants: one for generateText and one for streamText. For other model kinds, add examples for the relevant top-level function like generateImage or generateSpeech.
Do I need to run type checking after adding examples?
Yes. Run pnpm type-check:full after creating the example and fix any errors that appear.

Generated from the current SKILL.md. These answers refresh after source changes.