[Feature] Expose custom slash commands as tools
Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 9 comments · opened Aug 12, 2025 · closed Jan 14, 2026
💡 Likely answer: A maintainer (dicksontsai, collaborator)
responded on this thread — see the highlighted reply below.
Better integration across subagents and anything that is scoped to tools. Makes code more DRY since we can have user facing commands that subagents can also use as tools.
9 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is similar but this is not about mcp serve but more about giving subagents access to slash commands through the mcp tools. In the end the implementation may address both but as stated I would say this is different.
Currently I find myself starting off with a custom slash command and then turning that into an agent later and removing the slash command and instead referencing the agent. The reason this happens is because I have a lot of orchestration where slash commands would be useful but the sub-agents won't run them. I have had some success referencing them with full paths and bypassing permissions (@ reference doesn't work, especially for user scoped commands) but this is not consistent or maintainable.
Here is a breakdown of the workflow before and after implementing this feature, using a practical example.
Scenario: Your team has a standard way to create new React components. The process involves creating three files: a component file (
.tsx), a test file (.spec.tsx), and a Storybook file (.stories.tsx).---
Before: Disconnected and Repetitive Workflow
In the old workflow, user-facing commands and agent capabilities were entirely separate, forcing you to duplicate the same logic in two different places.
1. For the User: Create a Slash Command
To make this easy for developers, you create a project-level slash command:
.claude/commands/new-component.md.The user can simply type:
> /new-component UserProfileThe
new-component.mdfile contains a detailed prompt that tells Claude how to perform the scaffolding task:This works great for manual, user-driven actions.
2. For the AI Agent: Duplicate the Logic
Now, you want to create a subagent called
feature-builder-agentthat can automatically build out features, including creating new components.The Problem: The subagent cannot use the
/new-componentcommand. It's not a "tool." To give the agent this skill, you must copy and paste the entire prompt fromnew-component.mdinto the subagent's system prompt.The agent's definition file,
.claude/agents/feature-builder-agent.md, would look like this:The developer would then invoke it like this:
> use the feature-builder-agent to create a new UserProfile componentPain Points of the "Before" Workflow
new-component.mdandfeature-builder-agent.md).---
After: Modular and DRY (Don't Repeat Yourself) Workflow
With the new feature, the slash command itself becomes a reusable tool. The logic is defined only once.
1. For the User and Agent: Define the Tool Once
You create the same slash command as before:
.claude/commands/new-component.md. This file is now the single source of truth for this workflow.The user's workflow is unchanged and just as simple:
> /new-component UserProfile2. For the AI Agent: Grant Access to the Tool
Now, to give the
feature-builder-agentthe same skill, you no longer copy the prompt. You simply grant it permission to use the slash command as a tool.The agent's definition file,
.claude/agents/feature-builder-agent.md, is now much cleaner and more modular:When the developer runs
> use the feature-builder-agent to create a new UserProfile component, the subagent understands that it has a specialized tool,slash__new-component, which it will invoke with"UserProfile"as the argument.Key Benefits of the "After" Workflow
new-component.mdfile, and both the user's manual command and the agent's programmatic tool are updated simultaneously.toolslist in the frontmatter.This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Auto-close bots are harmful to community contributions:
See also this post.
I understand it is annoying to have open issues going nowhere. One solution for this is to label short-lived and long-lived issues differently to distinguish them. Another is assigning issues to different milestones. This makes it clear to users which issues are likely to be fixed sooner rather than later.
I want to bump this because I would like CC to be able to invoke
/compactas a tool when instructions in a skill or command deem it appropriate to do so.Closing because Skill tool (previously SlashCommand tool) implements this functionality
Invoking
/compactis a separate feature request. This feature request is specifically asking about _custom_ slash commands.This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.