Skip to content

query() does not resolve user-installed skills (slash commands) #765

@jeremy-newhouse

Description

@jeremy-newhouse

Description

When passing a prompt that starts with / (e.g. /eck:new-project) to query(), the SDK returns "Unknown skill" immediately ($0.00 cost, 2ms) instead of resolving the skill from ~/.claude/skills/ or project-level .claude/skills/.

The same skill works correctly when invoked via claude --print -p '/eck:new-project' directly.

Steps to Reproduce

from claude_agent_sdk import ClaudeAgentOptions, query, ResultMessage

async def test():
    options = ClaudeAgentOptions(
        cwd='/home/tester',
        permission_mode='bypassPermissions',
        cli_path='/home/tester/.local/bin/claude',
    )
    async for msg in query(prompt='/eck:new-project', options=options):
        if isinstance(msg, ResultMessage):
            print(msg.result)  # "Unknown skill: eck:new-project"
            print(msg.total_cost_usd)  # 0.0

Expected Behavior

The SDK should resolve the skill from ~/.claude/skills/eck-new-project/SKILL.md, expand it, and execute the skill instructions — matching the behavior of claude --print -p '/eck:new-project'.

Workaround

Read the SKILL.md file manually and inject the content as system_prompt:

with open(os.path.expanduser('~/.claude/skills/eck-new-project/SKILL.md')) as f:
    skill_content = f.read()
options.system_prompt = f"Execute the following skill:\n\n{skill_content}"
query(prompt="Execute the skill workflow now.", options=options)

Environment

  • claude-agent-sdk: 0.1.51
  • Claude CLI: 2.1.86
  • Python: 3.12
  • OS: Linux (Docker)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions