ai-sdk-provider-claude-code 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -278,6 +278,37 @@ console.log(result.object); // Guaranteed to match schema
278
278
  - Use realistic image payloads—very small placeholders may result in the model asking for a different image.
279
279
  - `examples/images.ts` accepts a local image path and converts it to a data URL on the fly: `npx tsx examples/images.ts /absolute/path/to/image.png`.
280
280
 
281
+ ## Skills Support
282
+
283
+ Claude Code supports **Skills** - custom tools and capabilities defined in your user or project settings. To enable skills, configure both `settingSources` and `allowedTools`:
284
+
285
+ ```typescript
286
+ import { claudeCode } from 'ai-sdk-provider-claude-code';
287
+ import { streamText } from 'ai';
288
+
289
+ const result = await streamText({
290
+ model: claudeCode('sonnet', {
291
+ settingSources: ['user', 'project'],
292
+ allowedTools: ['Skill', 'Read', 'Write', 'Bash'],
293
+ }),
294
+ prompt: 'Use my /custom-skill to help with this task',
295
+ });
296
+ ```
297
+
298
+ **Requirements:**
299
+
300
+ - `settingSources` - Where to load skills from (`'user'`, `'project'`, `'local'`)
301
+ - `allowedTools` must include `'Skill'` to invoke skills
302
+
303
+ **Where to define Skills:**
304
+
305
+ - User: `~/.claude/skills/your-skill/SKILL.md`
306
+ - Project: `.claude/skills/your-skill/SKILL.md`
307
+
308
+ **Validation:** If you add `'Skill'` to `allowedTools` but forget to set `settingSources`, a validation warning will alert you that skills won't load.
309
+
310
+ See [examples/skills-management.ts](examples/skills-management.ts) for more examples.
311
+
281
312
  ## Limitations
282
313
 
283
314
  - Requires Node.js ≥ 18
package/dist/index.cjs CHANGED
@@ -587,6 +587,11 @@ function validateSettings(settings) {
587
587
  if (validSettings.disallowedTools) {
588
588
  validateToolNames(validSettings.disallowedTools, "disallowed");
589
589
  }
590
+ if (validSettings.allowedTools?.includes("Skill") && !validSettings.settingSources) {
591
+ warnings.push(
592
+ "allowedTools includes 'Skill' but settingSources is not set. Skills require settingSources (e.g., ['user', 'project']) to load skill definitions."
593
+ );
594
+ }
590
595
  return { valid: true, warnings, errors };
591
596
  } catch (error) {
592
597
  errors.push(`Validation error: ${error instanceof Error ? error.message : String(error)}`);