Omniscio

OmniscioGuidesAgent SDK skills

Claude Agent SDK skills: loading, scoping and dispatching

Skills are a part of Claude Code's configuration the SDK cannot register in code. You create them as files, and the session discovers them from the directories its setting sources cover.

This page owns skills and slash commands inside an Agent SDK session. The SDK overview owns the first agent, permissions owns the rules a skill's tool calls pass through, and the Claude Code skills guide owns authoring a skill in depth.

Sources read November 26, 2026. By the Omniscio team. Updated .

How skills reach a session

A skill is a directory holding a SKILL.md file: instructions, a description, and optional supporting resources. In the SDK, skills are:

  • Filesystem artifacts. Each one is a SKILL.md under .claude/skills/<name>/.
  • Loaded from filesystem. The directories that load are governed by settingSources in TypeScript or setting_sources in Python.
  • Discovered at startup. Once filesystem settings load, the SDK reads skill metadata, and loads the full content when Claude invokes the skill.
  • Model-invoked or user-invoked. Claude chooses one by context, or you dispatch it with /<name>.
  • Scoped by the skills option. Discovered skills are enabled by default; a list, "all" or [] changes that.

Unlike subagents, which you can define in the agents option, a skill is a file on disk rather than an entry in code.

With default query() options the SDK loads the user and project sources, so skills in ~/.claude/skills/, <cwd>/.claude/skills/, and each .claude/skills/ in a parent directory up to the repository root are available. The project source also covers each directory you pass in additionalDirectories (TypeScript) or add_dirs (Python). If you set settingSources explicitly, include 'project' and 'user' to keep those skills.

Choose which skills Claude may invoke

Set the skills option on query(). When it is omitted, discovered skills are enabled and the Skill tool is available, matching the CLI. Pass "all" for every discovered skill, a list of names to allow only those, or [] to allow none.

const options = { skills: ["pdf", "docx"] };
options = ClaudeAgentOptions(skills=["pdf", "docx"])

When you set skills, the SDK adds the enabled skills to allowedTools automatically. If you also pass an explicit tools list, include "Skill" in it, or Claude has no way to invoke one.

The list takes exact names. Your own skill is its directory name; a plugin skill takes the plugin name and the skill name joined by a colon; and a skill from an added directory that clashes with another takes a prefixed name, such as web:verify for a verify skill in the web directory. That prefixed name requires Claude Code v2.1.309 or later. Claude does not see an unlisted skill and the Skill tool rejects it, though its files stay on disk and remain readable. The list does not restrict subagents, and it does not stop a direct dispatch.

Confirm the skills loaded

Near the start of the stream, the SDK yields a system message with subtype init. Its skills array lists the user-invocable skills you defined with a description or a when_to_use field (extra context for when Claude should invoke the skill), along with the skills bundled with Claude Code. A skill with user-invocable: false in its frontmatter still loads and stays available to Claude, but it does not appear in the array. The array lists the same skills whether or not they are in your skills list, so it confirms loading rather than scoping.

To confirm the allowlist took effect, have Claude try a skill you left out. The Skill tool rejects it with Skill <name> is not in this session's skills allowlist.

Dispatch a command by name

A command is anything you run by sending /<name> in a prompt. The entries differ in what backs them: built-in commands such as /compact, bundled skills such as /code-review, your own user-invocable skills, and the older flat files under .claude/commands/.

The init message's slash_commands field lists the commands available in the session. Commands that need an interactive terminal, such as /theme and /terminal-setup, do not appear there.

const q = query({ prompt: "/security-check", options: { maxTurns: 10 } });

Sending /<name> runs a user-invocable skill even when your skills list omits it. Commands that act on conversation history, such as /compact, need prior messages to work with. From v2.1.274, a name that matches nothing does not fail the query: Claude Code sends the prompt as an ordinary message with a note that the command did not run, so the query spends a model turn. Before that release it returned Unknown command: /<name> without a model turn.

/clear resets the conversation to an empty context while the previous conversation stays on disk, reachable through its session ID. In one-shot query() calls each call already starts empty, so start a new query instead.

Create a skill

Create a directory with a SKILL.md file inside it. Its YAML frontmatter carries a name and a description, and the description decides when Claude invokes it.

.claude/skills/security-check/
└── SKILL.md
---
name: security-check
description: Run a security vulnerability scan
---

Analyze the codebase for security vulnerabilities including:
- SQL injection risks
- XSS vulnerabilities
- Exposed credentials
- Insecure configurations

Save it at one of the two common levels: .claude/skills/ for the current project, or ~/.claude/skills/ for every project. Once the file exists, Claude invokes it when a request matches the description, and /security-check runs it directly.

Existing files under .claude/commands/ keep working: a command file at .claude/commands/deploy.md creates /deploy and behaves like a skill at .claude/skills/deploy/SKILL.md.

Pre-approve the tools a skill needs

A skill runs with the session's tools. In an SDK session you can pre-approve the tools for a project or personal skill with the skill's allowed-tools frontmatter, or with the allowedTools option in your query configuration. If your organization sets allowManagedPermissionRulesOnly, Claude Code ignores both.

options = ClaudeAgentOptions(
    setting_sources=["user", "project"],
    skills="all",
    allowed_tools=["Read", "Grep", "Glob"],
)

That list pre-approves the named tools rather than restricting the others. In the stream, the skill invocation appears as a Skill tool use followed by the tool calls it makes.

When a skill does not load or does not run

Skills not found

Check the setting sources first: if you set settingSources or setting_sources explicitly and left out user and project, the SDK does not load skills at all. Then check cwd: skills load from .claude/skills/ in cwd and every parent directory up to the repository root. Finally check the files with ls .claude/skills/*/SKILL.md and ls ~/.claude/skills/*/SKILL.md.

Skill not being used

If you passed a skills list, confirm the name is in it. When Claude tries an unlisted skill, the Skill tool returns Skill <name> is not in this session's skills allowlist. A vague description is the other common cause: it decides when Claude picks the skill.

The SDK rejects the list

An empty name, a name with parentheses, commas or control characters, one padded with whitespace, or a wildcard such as a bare * or a :* suffix makes query() reject the list before the session starts. TypeScript throws an Error and Python raises ValueError, each naming the rule the entry broke. The check arrived in TypeScript Agent SDK 0.3.221 and Python Agent SDK 0.2.129.

Sources

Every claim on this page rests on Anthropic's Agent SDK skills page, read on the date beside it.

  • Extend agents with skills, for how skills load, the skills option, the init message, commands, authoring, pre-approving tools and the three troubleshooting cases. Read November 26, 2026.

No SDK session was run for this page. Every option name and message is transcribed from that page. Version floors name either the Claude Code CLI's v2.1.x release or the Agent SDK package's 0.3.x (TypeScript) / 0.2.x (Python) version, as Anthropic names them.

Common questions

Why are my skills not loading in the Agent SDK?

Skills load through the user and project setting sources. If you set settingSources explicitly and leave those out, nothing loads. Also check that cwd points at or below the directory holding .claude/skills/, and that each skill is a directory with a SKILL.md file.

What does the skills option do?

It controls which discovered skills Claude may invoke. Omit it and every discovered skill is enabled; pass "all" for the same; pass a list of exact names to allow only those; pass [] to allow none. Setting it also adds the enabled skills to allowedTools.

Can I run a skill directly instead of waiting for Claude to choose?

Yes. Send the skill's slash command in the prompt, exactly as in Claude Code. Dispatch does not depend on the skills option: a user-invocable skill runs even when your skills list omits it.

Why does the SDK reject my skills list?

The list takes exact skill names only. An empty name, a name with parentheses, commas or control characters, one padded with whitespace, or a wildcard such as a bare * or a :* suffix makes query() reject the list before the session starts. The check arrived in TypeScript Agent SDK 0.3.221 and Python Agent SDK 0.2.129. List each skill by its exact name.

Do skills use the same tools as the session?

Yes. A skill runs with the session's tools and its permission rules. Pre-approve the tools a skill needs with allowedTools or the skill's allowed-tools frontmatter, or each call runs through the normal permission flow.

Every session, one window

Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.