[FEATURE] Support dynamic autocomplete options for slash commands (e.g., GitHub issue picker)
Feature Request
Problem
Custom slash commands (skills) currently have no way to provide dynamic autocomplete options based on external data sources. For example, when working on a project, I frequently need to reference GitHub issues by #number. Currently I have to:
- Run
gh issue listin a separate terminal or ask Claude to list issues - Manually type the issue number from memory
There's no way to get an interactive, filterable list of issues directly in the Claude Code input prompt.
Desired Behavior
Allow slash commands to declare a dynamic data source for autocomplete. When the user invokes the command, Claude Code fetches the options and presents them as a filterable selection list:
/issue <- triggers dynamic fetch of open issues
<- shows filterable list:
#150 - Obj-C API bundle support
#149 - Fix AI response text leaking
#147 - Revamp Chat panel UI
<- user filters by typing, selects with arrow keys
<- selected issue reference is inserted into the input
Suggested Approach
Extend skill frontmatter with a dynamicOptions field that specifies a shell command to generate options:
---
name: issue
description: Pick a GitHub issue to reference
dynamicOptions:
command: gh issue list --state open --sort created --json number,title --jq '.[] | "#\(.number) \(.title)"'
insertFormat: "#${number}" # what gets inserted after selection
---
Key design points:
- The shell command runs on invocation and returns a newline-separated list
- The list is presented as a filterable selection (similar to the existing
/menu) - After selection, the chosen value is inserted into the prompt input
- Results are sorted by the command output order (allowing the data source to control sorting)
Why This Matters
- Workflow efficiency: Developers referencing issues, branches, or other project artifacts shouldn't need to context-switch to find identifiers
- Composability: This pattern generalizes beyond GitHub issues — it could power branch pickers, test suite selectors, environment choosers, etc.
- Builds on existing work: Related to #28195 (static subcommand autocomplete), this extends the concept to dynamic, external data sources
Use Cases
| Command | Data source | Purpose |
|---------|-------------|---------|
| /issue | gh issue list | Pick a GitHub issue |
| /branch | git branch | Pick a git branch |
| /test | test file listing | Pick a test to run |
| /env | environment config | Pick a deployment target |
Current Workarounds
- Ask Claude to run
gh issue list— adds a full round-trip and clutters the conversation - Use an external terminal with
gh + fzf— requires context-switching away from Claude Code - Memorize issue numbers — error-prone
Environment
- Claude Code CLI
- macOS
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗