[FEATURE] /alias command
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I often wish I could compose slash commands, "@" references, etc... into simpler key inputs, create aliases for commands or directories, and otherwise simplify my use of Claude Code using short aliases that expand out to text I configure.
Proposed Solution
I propose an /alias command that modifies ~/.claude/aliases or .claude/aliases with configurable user aliases that when typed and followed by a whitespace character (tab, space, enter) expands into the configured text in the input element.
/alias add @foo @src/lib/foo
/alias edit /c /compact [...]
/alias list
/alias rm /c
/alias edit (external editor)
vi ~/.claude/aliases
vi ./.claude/aliases
Alias expansion in prompt inputs would solve a number of use cases that I have seen requested regarding alias support for commands, directories, or slash commands. They would also serve as a simpler alternative to simple slash commands or agent prompts for many use cases that would avoid context pollution while offering the same result to users.
Alternative Solutions
Type a lot more, create slash commands or agents that pollute context.
Priority
High - Significant impact on productivity
Feature Category
Interactive mode (TUI)
Use Case Example
Add a file/directory reference alias:
/alias add @foo @src/lib/foo
Add a slash command or action alias:
/alias edit /c /compact [...] $1 [...]:
List aliases:
/alias list
Remove an alias:
/alias rm /c
Edit aliases in an external editor:
/alias edit (external editor)
(global or project scoped)
vi ~/.claude/aliases
vi ./.claude/aliases
Additional Context
Bash aliases but for Claude Code
Found some related issues that may overlap with this request:
- #2149 (closed) - Requested a similar macro/alias system for text snippets
- #14065 - Requests alias labels specifically for Additional Directories, which overlaps with the directory aliasing aspect of this feature
- #12375 - Requests tool alias configuration, which shares the aliasing concept but for CLI tool substitution
These issues show there's demand for various types of aliasing functionality. This /alias command request appears to be the most comprehensive solution that could address multiple use cases.
🤖 Generated with Claude Code
This would provide the functionality requested in #14065 #2149 and perhaps with some syntactical sugar could also deliver on #12375
For aliases to commands that Claude might run, perhaps /alias !fd find, (to deliver on the request from #12375)
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.
I am still interested in this feature.
interested as well;
example:
/compact_for_next_task <next_task> -----> "/compact keep strictly minimal context to perform the next task : <next_task>"
Are there any updates? I would love this feature too.