SpyBara
Go Premium

agent-sdk/skills.md 2026-04-15 18:20 UTC to 2026-04-16 21:13 UTC

13 added, 12 removed.

2026
Wed 29 21:21 Tue 28 21:21 Mon 27 21:20 Sun 26 04:08 Sat 25 21:10 Fri 24 18:11 Thu 23 18:19 Wed 22 21:15 Tue 21 21:14 Mon 20 21:14 Sat 18 18:09 Fri 17 21:13 Thu 16 21:13 Wed 15 18:20 Tue 14 21:14 Mon 13 21:14 Sat 11 00:11 Fri 10 21:09 Thu 9 21:14 Wed 8 21:13 Tue 7 21:14 Sat 4 18:05 Fri 3 21:07 Thu 2 21:08 Wed 1 21:12

Agent Skills in the SDK

Extend Claude with specialized capabilities using Agent Skills in the Claude Agent SDK

Overview

Agent Skills extend Claude with specialized capabilities that Claude autonomously invokes when relevant. Skills are packaged as SKILL.md files containing instructions, descriptions, and optional supporting resources.

For comprehensive information about Skills, including benefits, architecture, and authoring guidelines, see the Agent Skills overview.

How Skills Work with the SDK

When using the Claude Agent SDK, Skills are:

  1. Defined as filesystem artifacts: Created as SKILL.md files in specific directories (.claude/skills/)
  2. Loaded from filesystem: Skills are loaded from filesystem locations governed by settingSources (TypeScript) or setting_sources (Python)
  3. Automatically discovered: Once filesystem settings are loaded, Skill metadata is discovered at startup from user and project directories; full content loaded when triggered
  4. Model-invoked: Claude autonomously chooses when to use them based on context
  5. Enabled via allowed_tools: Add "Skill" to your allowed_tools to enable Skills

Unlike subagents (which can be defined programmatically), Skills must be created as filesystem artifacts. The SDK does not provide a programmatic API for registering Skills.

Using Skills with the SDK

To use Skills with the SDK, you need to:

  1. Include "Skill" in your allowed_tools configuration
  2. Configure settingSources/setting_sources to load Skills from the filesystem

Once configured, Claude automatically discovers Skills from the specified directories and invokes them when relevant to the user's request.

import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions


async def main():
options = ClaudeAgentOptions(
cwd="/path/to/project",  # Project with .claude/skills/
setting_sources=["user", "project"],  # Load Skills from filesystem
allowed_tools=["Skill", "Read", "Write", "Bash"],  # Enable Skill tool
)

async for message in query(
prompt="Help me process this PDF document", options=options
):
print(message)


asyncio.run(main())

Skill Locations

Skills are loaded from filesystem directories based on your settingSources/setting_sources configuration:

  • Project Skills (.claude/skills/): Shared with your team via git - loaded when setting_sources includes "project"
  • User Skills (~/.claude/skills/): Personal Skills across all projects - loaded when setting_sources includes "user"
  • Plugin Skills: Bundled with installed Claude Code plugins

Creating Skills

Skills are defined as directories containing a SKILL.md file with YAML frontmatter and Markdown content. The description field determines when Claude invokes your Skill.

Example directory structure:

.claude/skills/processing-pdfs/
└── SKILL.md

For complete guidance on creating Skills, including SKILL.md structure, multi-file Skills, and examples, see:

Tool Restrictions

To control tool access for Skills in SDK applications, use allowedTools to pre-approve specific tools. Without a canUseTool callback, anything not in the list is denied:

options = ClaudeAgentOptions(
setting_sources=["user", "project"],  # Load Skills from filesystem
allowed_tools=["Skill", "Read", "Grep", "Glob"],
)

async for message in query(prompt="Analyze the codebase structure", options=options):
print(message)

Discovering Available Skills

To see which Skills are available in your SDK application, simply ask Claude:

options = ClaudeAgentOptions(
setting_sources=["user", "project"],  # Load Skills from filesystem
allowed_tools=["Skill"],
)

async for message in query(prompt="What Skills are available?", options=options):
print(message)

Claude will list the available Skills based on your current working directory and installed plugins.

Testing Skills

Test Skills by asking questions that match their descriptions:

options = ClaudeAgentOptions(
cwd="/path/to/project",
setting_sources=["user", "project"],  # Load Skills from filesystem
allowed_tools=["Skill", "Read", "Bash"],
)

async for message in query(prompt="Extract text from invoice.pdf", options=options):
print(message)

Claude automatically invokes the relevant Skill if the description matches your request.

Troubleshooting

Skills Not Found

Check settingSources configuration: Skills are discovered through the user and project setting sources. If you set settingSources/setting_sources explicitly and omit those sources, skills are not loaded:

# Skills not loaded: setting_sources excludes user and project
options = ClaudeAgentOptions(setting_sources=[], allowed_tools=["Skill"])

# Skills loaded: user and project sources included
options = ClaudeAgentOptions(
setting_sources=["user", "project"],
allowed_tools=["Skill"],
)

For more details on settingSources/setting_sources, see the TypeScript SDK reference or Python SDK reference.

Check working directory: The SDK loads Skills relative to the cwd option. Ensure it points to a directory containing .claude/skills/:

# Ensure your cwd points to the directory containing .claude/skills/
options = ClaudeAgentOptions(
cwd="/path/to/project",  # Must contain .claude/skills/
setting_sources=["user", "project"],  # Loads skills from these sources
allowed_tools=["Skill"],
)

See the "Using Skills with the SDK" section above for the complete pattern.

Verify filesystem location:

# Check project Skills
ls .claude/skills/*/SKILL.md

# Check personal Skills
ls ~/.claude/skills/*/SKILL.md

Skill Not Being Used

Check the Skill tool is enabled: Confirm "Skill" is in your allowedTools.

Check the description: Ensure it's specific and includes relevant keywords. See Agent Skills Best Practices for guidance on writing effective descriptions.

Additional Troubleshooting

For general Skills troubleshooting (YAML syntax, debugging, etc.), see the Claude Code Skills troubleshooting section.

Skills Guides

SDK Resources