ai-sdk-skills
v0.1.1
Published
AI SDK tools for finding and loading SKILL.md content from the open skills ecosystem
Maintainers
Readme
ai-sdk-skills
AI SDK tools for discovering and loading SKILL.md content from the open skills ecosystem.
What this package provides
findSkillsTool: find and rank skill candidates (preconfigorsearchmode)readSkillTool: resolve and load a skill'sSKILL.mdinto model-ready context
Install
pnpm add ai-sdk-skills ai zodQuick start
import { generateText, stepCountIs } from 'ai';
import { initSkillsTools } from 'ai-sdk-skills';
const { tools } = initSkillsTools({
find: {
defaultMode: 'search',
rankingStrategy: 'hybrid',
preconfiguredSkills: [
{ name: 'playwright', source: 'vercel-labs/agent-skills' },
{ name: 'prisma-expert', source: 'vercel-labs/agent-skills' },
],
},
read: { maxChars: 16000 },
});
await generateText({
model: 'anthropic/claude-sonnet-4.5',
messages,
tools,
stopWhen: stepCountIs(6),
});Configuration reference
findSkillsTool
mode:"preconfig" | "search"query?: text query used in search/rankinglimit?:1..25
find config highlights:
defaultMode,allowedModessearchLimit,minConfidence,closeScoreDeltarankingStrategy:deterministic | hybrid | aiskillsApiBaseUrl,fetchFnpreconfiguredSkills,aiRankercache(enabled,ttlMs, optional customstore)debug(truefor console debug or custom logger)metricshooks (onSearchComplete,onError)rankingWeightsfor deterministic scoring weights
readSkillTool
source?,skillName?,slug?,preferredPath?,maxChars?
read config highlights:
maxChars,maxCandidatesToReadgithubToken,fetchFnpreconfiguredSkillscache,debug,metricslocalSkillsPathfor offline/local SKILL.md loading
Examples
See examples/:
basic.tsadvanced-ai-ranker.tscustom-fetch.tstoken-auth.tserror-handling.ts
Troubleshooting
GitHub API rate limits
- Unauthenticated requests are limited.
- Set
githubTokeninreadconfig for higher limits.
Invalid source format
sourcemust beowner/repo(for examplevercel-labs/agent-skills).
Search returns no candidates
- Ensure query length is at least 2 characters.
- Lower
minConfidenceor usepreconfigmode with known skills.
FAQ
Does this support offline reads?
Yes. Set read.localSkillsPath to a directory containing <skill>/SKILL.md.
Can I customize ranking?
Yes. Use rankingStrategy: "ai" or "hybrid" with an aiRanker.
You can also tune deterministic ranking with rankingWeights.
Can I load metadata only before full content?
Yes. Call readSkillTool with previewOnly: true to get metadata and estimated size.
Is this package ESM/CJS compatible?
Yes. The package exports both ESM and CJS builds from dist/.
Development
pnpm install
pnpm type-check
pnpm build
pnpm testDocs site
A one-page documentation site is available in docs/index.html.
