|
5 | 5 | from collections.abc import Awaitable, Callable |
6 | 6 | from dataclasses import dataclass, field |
7 | 7 | from pathlib import Path |
8 | | -from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias |
| 8 | +from typing import TYPE_CHECKING, Any, Final, Literal, Protocol, TypeAlias |
9 | 9 |
|
10 | 10 | if sys.version_info >= (3, 11): |
11 | 11 | from typing import NotRequired, Required, TypedDict |
|
31 | 31 |
|
32 | 32 | # Agent definitions |
33 | 33 | SettingSource = Literal["user", "project", "local"] |
| 34 | + |
| 35 | +# The ClaudeAgentOptions.skills value meaning "every discovered skill". |
| 36 | +_SKILLS_ALL: Final = "all" |
34 | 37 | EffortLevel: TypeAlias = Literal["low", "medium", "high", "xhigh", "max"] |
35 | 38 |
|
36 | 39 |
|
@@ -1745,7 +1748,7 @@ def _warn_if_can_use_tool_shadowed(options: "ClaudeAgentOptions") -> None: |
1745 | 1748 | # allowed_tools, so it shadows the callback just like a hand-written entry. |
1746 | 1749 | # skills=[names] appends Skill(name) specifiers, which do not. |
1747 | 1750 | allowed_tools = options.allowed_tools |
1748 | | - if options.skills == "all" and "Skill" not in allowed_tools: |
| 1751 | + if options.skills == _SKILLS_ALL and "Skill" not in allowed_tools: |
1749 | 1752 | allowed_tools = [*allowed_tools, "Skill"] |
1750 | 1753 | message = _get_can_use_tool_shadowed_warning(options.permission_mode, allowed_tools) |
1751 | 1754 | if message is not None: |
@@ -2009,6 +2012,8 @@ class ClaudeAgentOptions: |
2009 | 2012 | - ``"all"``: enable every discovered skill. |
2010 | 2013 | - ``list[str]``: enable only the listed skills. Names match the SKILL.md |
2011 | 2014 | ``name`` / directory name, or ``plugin:skill`` for plugin-qualified skills. |
| 2015 | + Names must be exact: wildcards, delimiters, and surrounding whitespace |
| 2016 | + raise at ``connect()``. |
2012 | 2017 |
|
2013 | 2018 | This is a **context filter**, not a sandbox: unlisted skills are hidden |
2014 | 2019 | from the model's listing and rejected by the Skill tool, but their files |
|
0 commit comments