AI SDK Documentation
This skill should be used when working with Vercel AI SDK, AI Gateway, streamText, generateText, generateObject, streamObject, tool calling, or AI SDK providers. Also relevant for "ai-sdk", "@ai-sdk/*" packages, or questions about AI SDK patterns, configuration, and best practice
Install
npx skills add https://github.com/malob/nix-config/tree/master/configs/claude/plugins/ai-sdk/skills/ai-sdk-docs
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install malob-nix-config@llmmart
git clone https://github.com/malob/nix-config.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole malob/nix-config collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
AI SDK Documentation Skill
This skill provides tools for accessing Vercel AI SDK documentation and AI Gateway model information. Use the bundled scripts to discover available documentation pages and fetch their full content.
Overview
The Vercel AI SDK documentation lives at ai-sdk.dev and covers:
- Core SDK (
aipackage) - generating text, streaming, tool calling, embeddings - UI integrations - React hooks, streaming UI components
- RSC - React Server Components integration
- Providers - Configuration for OpenAI, Anthropic, Google, and 30+ other providers
- AI Gateway - Vercel's multi-provider routing service
The documentation is large (600+ pages) and frequently updated. Rather than relying on stale knowledge, always use the scripts to fetch current documentation.
Scripts
All scripts are located in ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/.
list-docs.sh
Discover available documentation pages.
Usage:
# List all pages grouped by category
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh
# List pages in a specific category
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh docs
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh cookbook
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh providers
Categories:
docs- Core documentation (concepts, guides, API reference)cookbook- Code examples by framework (Next.js, Node.js, etc.)providers- Provider-specific setup and configurationelements- UI component library documentationtools-registry- Third-party tool integrations
When to use: Run this first to discover what pages exist. Do not assume documentation structure.
fetch-doc.sh
Fetch the full markdown content of a specific documentation page.
Usage:
# Fetch a documentation page
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /docs/ai-sdk-core/generating-text
# Fetch a cookbook example
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /cookbook/next/generating-structured-data
# Fetch provider documentation
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /providers/ai-sdk-providers/openai
Input: A documentation path (e.g., /docs/ai-sdk-core/tools-and-tool-calling)
Output: Full markdown content of the page
When to use: After identifying relevant pages with list-docs.sh, fetch the ones that look most relevant to the task.
query-models.sh
Query the AI Gateway models API for available models and their capabilities.
Usage:
# List all models with their provider
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh list
# List all providers
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh providers
# List all capability tags
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh tags
# List models from a specific provider
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --provider anthropic
# List models with a specific capability
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --tag vision
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --tag tool-use
# Get full details for a specific model
${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --details openai/gpt-4o
Model details include: context window, max tokens, pricing, capability tags (vision, tool-use, reasoning, etc.)
When to use: When needing to know what models are available, compare model capabilities, or check pricing/context limits.
Workflow Guidelines
Finding Documentation
- Start with discovery: Run
list-docs.shto see available pages - Identify relevant pages: Look for pages whose paths match the topic
- Fetch content: Use
fetch-doc.shto get full content of relevant pages - Read multiple pages if needed: Topics often span multiple pages (e.g., a concept page + API reference page)
Important Notes
- Always fetch current docs: Do not rely on potentially outdated knowledge. Use the scripts to get current documentation.
- If a page doesn't appear in
list-docs.shoutput, it doesn't exist. - Some pages may not have .md versions: The script will indicate when this happens.
- Documentation is comprehensive: The AI SDK docs include guides, API references, examples, and troubleshooting. Check multiple sections for complete information.
AI Gateway
The AI Gateway is Vercel's unified API for accessing multiple AI providers. Key points:
- Single API endpoint, multiple providers
- Use
query-models.shto see all available models - Models are identified as
provider/model-name(e.g.,anthropic/claude-sonnet-4) - Provider-specific documentation is under
/providers/
Files (nix-config)
-
scripts
-
fetch-doc.sh 1.5 KB
#!/bin/bash # fetch-doc.sh - Fetch a specific AI SDK documentation page as markdown # Usage: fetch-doc.sh <path> # Example: fetch-doc.sh /docs/ai-sdk-core/streaming set -euo pipefail if [[ $# -lt 1 ]]; then echo "Usage: fetch-doc.sh <path>" echo "Example: fetch-doc.sh /docs/ai-sdk-core/streaming" exit 1 fi DOC_PATH="$1" BASE_URL="https://ai-sdk.dev" # Remove leading slash if present for consistency DOC_PATH="${DOC_PATH#/}" # Try fetching the .md version MD_URL="${BASE_URL}/${DOC_PATH}.md" response=$(curl -s -w "\n%{http_code}" "$MD_URL") http_code=$(echo "$response" | tail -n1) content=$(echo "$response" | sed '$d') if [[ "$http_code" == "200" ]]; then echo "$content" else # .md version failed, try without .md extension (some pages may not support it) FALLBACK_URL="${BASE_URL}/${DOC_PATH}" fallback_response=$(curl -s -w "\n%{http_code}" "$FALLBACK_URL") fallback_code=$(echo "$fallback_response" | tail -n1) if [[ "$fallback_code" == "200" ]]; then echo "# Note: .md version not available, fetched HTML page instead" echo "# You may want to use a different approach for this page" echo "# URL: $FALLBACK_URL" echo "" # Just note that it's HTML - dumping raw HTML isn't useful echo "This page doesn't have a .md version available." echo "Visit: $FALLBACK_URL" else echo "Error: Could not fetch document at $DOC_PATH" echo "Tried: $MD_URL (HTTP $http_code)" echo "Tried: $FALLBACK_URL (HTTP $fallback_code)" exit 1 fi fi -
list-docs.sh 1.4 KB
#!/bin/bash # list-docs.sh - List all AI SDK documentation pages from the sitemap # Usage: list-docs.sh [category] # Categories: docs, cookbook, providers, elements, tools-registry # If no category provided, lists all pages grouped by category set -euo pipefail SITEMAP_URL="https://ai-sdk.dev/sitemap.xml" FILTER_CATEGORY="${1:-}" # Fetch sitemap and extract URLs (portable sed instead of grep -P) urls=$(curl -s "$SITEMAP_URL" | sed -n 's/.*<loc>\([^<]*\)<\/loc>.*/\1/p' | sort) if [[ -n "$FILTER_CATEGORY" ]]; then # Filter to specific category echo "$urls" | grep "^https://ai-sdk.dev/${FILTER_CATEGORY}" | sed 's|https://ai-sdk.dev||' else # Group by category categories=("docs" "cookbook" "providers" "elements" "tools-registry") for category in "${categories[@]}"; do matches=$(echo "$urls" | grep "^https://ai-sdk.dev/${category}" | sed 's|https://ai-sdk.dev||' || true) if [[ -n "$matches" ]]; then count=$(echo "$matches" | wc -l | tr -d ' ') echo "=== /${category} (${count} pages) ===" echo "$matches" echo "" fi done # Root level pages (not in any category) root_pages=$(echo "$urls" | grep -E "^https://ai-sdk.dev/[^/]*$" | sed 's|https://ai-sdk.dev||' || true) if [[ -n "$root_pages" ]]; then count=$(echo "$root_pages" | wc -l | tr -d ' ') echo "=== / (root - ${count} pages) ===" echo "$root_pages" fi fi -
query-models.sh 2.2 KB
#!/bin/bash # query-models.sh - Query Vercel AI Gateway models # Usage: # query-models.sh list - List all model IDs with provider # query-models.sh providers - List all providers # query-models.sh tags - List all unique tags # query-models.sh --provider NAME - List models from a specific provider # query-models.sh --tag TAG - List models with a specific tag # query-models.sh --details ID - Show full details for a model set -euo pipefail MODELS_URL="https://ai-gateway.vercel.sh/v1/models" ACTION="${1:-list}" # Fetch models data models_json=$(curl -s "$MODELS_URL") case "$ACTION" in list) # List all models with provider echo "$models_json" | jq -r '.data[] | "\(.id) (\(.owned_by))"' | sort ;; providers) # List unique providers echo "$models_json" | jq -r '.data[].owned_by' | sort -u ;; tags) # List unique tags echo "$models_json" | jq -r '.data[].tags[]?' | sort -u ;; --provider) if [[ $# -lt 2 ]]; then echo "Usage: query-models.sh --provider NAME" exit 1 fi PROVIDER="$2" echo "$models_json" | jq -r --arg p "$PROVIDER" '.data[] | select(.owned_by == $p) | "\(.id)"' | sort ;; --tag) if [[ $# -lt 2 ]]; then echo "Usage: query-models.sh --tag TAG" exit 1 fi TAG="$2" echo "$models_json" | jq -r --arg t "$TAG" '.data[] | select(.tags[]? == $t) | "\(.id) (\(.owned_by))"' | sort ;; --details) if [[ $# -lt 2 ]]; then echo "Usage: query-models.sh --details MODEL_ID" exit 1 fi MODEL_ID="$2" echo "$models_json" | jq --arg id "$MODEL_ID" '.data[] | select(.id == $id)' ;; *) echo "Unknown action: $ACTION" echo "Usage:" echo " query-models.sh list - List all model IDs with provider" echo " query-models.sh providers - List all providers" echo " query-models.sh tags - List all unique tags" echo " query-models.sh --provider NAME - List models from a specific provider" echo " query-models.sh --tag TAG - List models with a specific tag" echo " query-models.sh --details ID - Show full details for a model" exit 1 ;; esac
-
-
SKILL.md 5 KB
--- name: AI SDK Documentation description: This skill should be used when working with Vercel AI SDK, AI Gateway, streamText, generateText, generateObject, streamObject, tool calling, or AI SDK providers. Also relevant for "ai-sdk", "@ai-sdk/*" packages, or questions about AI SDK patterns, configuration, and best practices. --- # AI SDK Documentation Skill This skill provides tools for accessing Vercel AI SDK documentation and AI Gateway model information. Use the bundled scripts to discover available documentation pages and fetch their full content. ## Overview The Vercel AI SDK documentation lives at `ai-sdk.dev` and covers: - **Core SDK** (`ai` package) - generating text, streaming, tool calling, embeddings - **UI integrations** - React hooks, streaming UI components - **RSC** - React Server Components integration - **Providers** - Configuration for OpenAI, Anthropic, Google, and 30+ other providers - **AI Gateway** - Vercel's multi-provider routing service The documentation is large (600+ pages) and frequently updated. Rather than relying on stale knowledge, always use the scripts to fetch current documentation. ## Scripts All scripts are located in `${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/`. ### list-docs.sh Discover available documentation pages. **Usage:** ```bash # List all pages grouped by category ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh # List pages in a specific category ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh docs ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh cookbook ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/list-docs.sh providers ``` **Categories:** - `docs` - Core documentation (concepts, guides, API reference) - `cookbook` - Code examples by framework (Next.js, Node.js, etc.) - `providers` - Provider-specific setup and configuration - `elements` - UI component library documentation - `tools-registry` - Third-party tool integrations **When to use:** Run this first to discover what pages exist. Do not assume documentation structure. ### fetch-doc.sh Fetch the full markdown content of a specific documentation page. **Usage:** ```bash # Fetch a documentation page ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /docs/ai-sdk-core/generating-text # Fetch a cookbook example ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /cookbook/next/generating-structured-data # Fetch provider documentation ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/fetch-doc.sh /providers/ai-sdk-providers/openai ``` **Input:** A documentation path (e.g., `/docs/ai-sdk-core/tools-and-tool-calling`) **Output:** Full markdown content of the page **When to use:** After identifying relevant pages with `list-docs.sh`, fetch the ones that look most relevant to the task. ### query-models.sh Query the AI Gateway models API for available models and their capabilities. **Usage:** ```bash # List all models with their provider ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh list # List all providers ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh providers # List all capability tags ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh tags # List models from a specific provider ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --provider anthropic # List models with a specific capability ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --tag vision ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --tag tool-use # Get full details for a specific model ${CLAUDE_PLUGIN_ROOT}/skills/ai-sdk-docs/scripts/query-models.sh --details openai/gpt-4o ``` **Model details include:** context window, max tokens, pricing, capability tags (vision, tool-use, reasoning, etc.) **When to use:** When needing to know what models are available, compare model capabilities, or check pricing/context limits. ## Workflow Guidelines ### Finding Documentation 1. **Start with discovery**: Run `list-docs.sh` to see available pages 2. **Identify relevant pages**: Look for pages whose paths match the topic 3. **Fetch content**: Use `fetch-doc.sh` to get full content of relevant pages 4. **Read multiple pages if needed**: Topics often span multiple pages (e.g., a concept page + API reference page) ## Important Notes - **Always fetch current docs**: Do not rely on potentially outdated knowledge. Use the scripts to get current documentation. - If a page doesn't appear in `list-docs.sh` output, it doesn't exist. - **Some pages may not have .md versions**: The script will indicate when this happens. - **Documentation is comprehensive**: The AI SDK docs include guides, API references, examples, and troubleshooting. Check multiple sections for complete information. ## AI Gateway The AI Gateway is Vercel's unified API for accessing multiple AI providers. Key points: - Single API endpoint, multiple providers - Use `query-models.sh` to see all available models - Models are identified as `provider/model-name` (e.g., `anthropic/claude-sonnet-4`) - Provider-specific documentation is under `/providers/`
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.