Feature Request: Add model selection support for custom commands (similar to subagents)
Feature Request: Add model selection support for custom commands (similar to subagents)
Summary
With the recent addition of model customization support for subagents, I'd like to request similar functionality for custom commands (slash commands in .claude/commands/). This would allow users to specify which Claude model should be used when executing specific custom commands, enabling more cost-effective and performance-optimized workflows.
Background
According to the recent changelog, subagents now support model customization:
"Agents: Added model customization support - you can now specify which model an agent should use"
This is a fantastic addition that addresses the need for granular model control expressed in several issues (#2532, #1457, #4377, #4807). However, custom commands currently don't have similar functionality.
Problem
Currently, all custom commands use the same model that's set globally via /model or the default model configuration. This creates several limitations:
- Cost inefficiency: Simple utility commands that could work well with Sonnet are forced to use Opus if that's the global setting
- Performance mismatch: Complex analytical commands might need Opus but are stuck with Sonnet if that's the global preference
- Workflow fragmentation: Users must manually switch models before running specific commands, breaking flow
- Team consistency: Shared custom commands in
.claude/commands/can't enforce their optimal model requirements
Proposed Solution
Add an optional model parameter to custom command configuration, similar to how subagents now work. This could be implemented in several ways:
Option 1: Frontmatter in Markdown files
---
name: code-review
description: Perform detailed code review with best practices
model: opus
---
You are a senior code reviewer. Analyze the provided code for...
Option 2: Special comment syntax
<!-- model: sonnet -->
# Quick Documentation Generator
You are a documentation specialist. Generate concise docs for...
Option 3: TOML-style configuration (similar to Issue #4370)
[metadata]
model = "opus"
description = "Complex system architecture analysis"
[command]
prompt = """
You are a system architect...
"""
Use Cases
Cost Optimization
/quick-docs→ Sonnet (fast, cost-effective for simple tasks)/architecture-review→ Opus (complex analysis requiring deep reasoning)/code-format→ Sonnet/Haiku (simple formatting tasks)
Performance Optimization
/debug-complex→ Opus (needs deep problem-solving)/generate-tests→ Sonnet (structured, predictable output)/explain-code→ Sonnet (good at explanations, cost-effective)
Team Workflows
# Team can create specialized commands with guaranteed model usage
/security-audit # Always uses Opus for thorough security analysis
/quick-refactor # Always uses Sonnet for speed and cost efficiency
/deep-analysis # Always uses Opus for complex problem-solving
Implementation Suggestions
- Fallback behavior: If no model is specified, use the current global model setting
- Model validation: Validate that specified models are available and accessible
- Override capability: Allow temporary override with syntax like
/command --model=sonnet - Documentation: Update custom command docs to show model selection examples
- Consistency: Use the same model names/syntax as subagents for consistency
Benefits
- Cost Control: Users can optimize costs by using appropriate models for each task type
- Performance: Match model capabilities to command requirements
- Team Efficiency: Shared commands automatically use their optimal models
- User Experience: Eliminates need to manually switch models before running commands
- Consistency: Aligns with the new subagent model selection functionality
Related Issues
- #2532 - Model Selection of Sub Agents
- #1457 - Feature Request: Instruct Model use for Subagents
- #4377 - Feature Request: Add Optional Model Parameter to Sub-Agents
- #4807 - New Rate Limits Require Granular Model Selection for Cost-Effective Usage
- #4370 - Feature Request: Formalize Custom Slash Commands with Structured Definitions
Priority
With the upcoming rate limits mentioned in #4807, granular model control becomes increasingly important for professional Claude Code usage. Having this functionality for custom commands would complement the existing subagent model selection and provide users with comprehensive control over their model usage patterns.
---
This feature would make custom commands much more powerful and align them with the excellent model selection capabilities now available for subagents.
This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗