Feature Request: Pass Previous Claude Response to Commands
Summary
Add support for referencing the previous Claude response as an argument in custom slash commands, enabling seamless workflow automation where the output of one interaction becomes the input for the next command.
Problem Description
Currently, custom slash commands can only accept user-provided arguments through $ARGUMENTS. This creates friction in common development workflows where users want to use Claude's response from a discussion or analysis as input to a subsequent command. Users must manually copy-paste Claude's responses, which is error-prone and breaks the flow of interaction.
Proposed Solution
Introduce a new variable #answer (or similar naming like #last-response, #previous) that can be used in custom slash commands to automatically pass the previous Claude response as an argument.
Syntax Example
/command #answer
This would pass the complete previous Claude response to the command, similar to how $ARGUMENTS currently works for user-provided arguments.
Use Cases
1. Specification Development → Issue Creation
# Workflow:
# 1. User discusses requirements with Claude
# 2. Claude provides detailed specification
# 3. User runs: /create-issue #answer
# 4. Command uses the specification to create a properly formatted GitHub issue
2. Code Review → Implementation
# Workflow:
# 1. User requests code review
# 2. Claude provides detailed feedback and improvement suggestions
# 3. User runs: /implement #answer
# 4. Command implements the suggested improvements
3. Investigation → Documentation
# Workflow:
# 1. User asks Claude to investigate a technical topic
# 2. Claude provides comprehensive analysis
# 3. User runs: /create-doc #answer
# 4. Command formats the analysis into proper documentation
Benefits
- Seamless Workflow: Eliminates manual copy-paste operations
- Reduced Errors: No risk of copying partial or incorrect content
- Better Context Utilization: Leverages Claude's detailed responses directly
- Improved Productivity: Streamlines common development patterns
- Natural Integration: Builds on existing
$ARGUMENTSpattern users already understand
Technical Considerations
Implementation Options
#answer- References the immediately previous Claude response#last-response- Alternative naming for clarity#previous- Shorter alternative
Future Extensions (Optional)
#answer-2,#answer-3- Reference responses further back#answer:partial- Extract specific sections of responses- Combined usage:
/command "custom text" #answer- Mix custom arguments with previous response
Current Workaround
Users currently must:
- Manually select and copy Claude's response
- Paste it as an argument:
/command "pasted content here" - Risk copying incomplete or incorrectly formatted content
Environment
This feature request applies to all platforms where Claude Code operates:
- Platform: All (macOS, Linux, Windows)
- Claude CLI version: All current versions
- Terminal: All supported terminals
Additional Context
This feature would complement the existing $ARGUMENTS functionality and make Claude Code more powerful for automation workflows. It aligns with the tool's goal of streamlining development tasks through natural language commands while maintaining the flexibility of custom slash commands.
The proposed syntax follows the existing pattern of special variables in commands, making it intuitive for users already familiar with $ARGUMENTS.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗