Skip to contents

Load an Agent Skill from a local directory for use in the current session.

Usage

claude_skill_local(skill_path)

Arguments

skill_path

Character. Path to skill directory (must contain SKILL.md).

Value

A skill specification for use with claude_new().

Details

Skill structure:

my_skill/
+-- SKILL.md      # Required: YAML frontmatter + instructions
+-- templates/    # Optional: template files
+-- scripts/      # Optional: helper scripts

SKILL.md format (agentskills.io spec):

---
name: my_skill
description: What this skill does
---

Instructions for Claude...

This function reads the skill locally and embeds it in the request. Use claude_skill_upload() to persist skills on Anthropic's servers.

API Reference: https://platform.claude.com/docs/en/build-with-claude/skills-guide

Examples

if (FALSE) { # \dontrun{
# Create skill directory
skill_dir <- tempfile("skill_")
fs::dir_create(skill_dir)
writeLines(c(
  "---",
  "name: greeting",
  "description: Greet users professionally",
  "---",
  "",
  "Always greet users with 'Welcome to Artalytics!'"
), fs::path(skill_dir, "SKILL.md"))

# Load and use
chat <- claude_new(
  skills = list(claude_skill_local(skill_dir)),
  tools = list(claude_code_exec()),
  beta = c(beta_headers$BETA_SKILLS, beta_headers$BETA_CODE_EXEC_BASH)
)
chat$chat("Please greet me")
} # }