claude-agent-sdk typescript package does not recognise the custom slash commands

Resolved 💬 4 comments Opened Sep 30, 2025 by ajasingh Closed Jan 9, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I have upgrade my code from claude-code sdk to claude-agent-sdk and the claude-agent-sdk does not recognise the custom slash commands

--Not working
import { query } from "@anthropic-ai/claude-agent-sdk";

// Use a custom command
for await (const message of query({
prompt: "/security aiSDKOpenAIAgent.js",
options: { maxTurns: 30 }
})) {
console.log(message);
}

This code used to work earlier but is not working any more.

I have correct folder setup even the cli is able to recognize the custom command and also able to run the output from claude code cli works correctly

What Should Happen?

The new sdk should recognise the custom slash commands

Error Messages/Logs

{
  type: 'result',
  subtype: 'success',
  is_error: false,
  duration_ms: 144,
  duration_api_ms: 0,
  num_turns: 1,
  result: '',
  session_id: '7e25149a-3c9d-401b-8861-56d8e52c2820',
  total_cost_usd: 0,
  usage: {
    input_tokens: 0,
    cache_creation_input_tokens: 0,
    cache_read_input_tokens: 0,
    output_tokens: 0,
    server_tool_use: { web_search_requests: 0 },
    service_tier: 'standard',
    cache_creation: { ephemeral_1h_input_tokens: 0, ephemeral_5m_input_tokens: 0 }
  },
  modelUsage: {},
  permission_denials: [],
  uuid: 'c309b23c-26c3-45e6-bdb5-57dda29c04f8'
}

Steps to Reproduce

Run the code provided

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

"@anthropic-ai/claude-agent-sdk": "^0.1.1",

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗