[FEATURE] Support Project-level prompt template variables for more reusable prompts, agents, and commands
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 have started assembling a collection of re-usable prompts, commands, and agents that I use for my own projects. When writing the prompts for these tools, sometimes I need to refer to things like paths, project ids, or domains that themselves are project specific. However, adding project-specific strings means I may need to maintain project-specific copies of each of my prompts. Arguments (for slash commands) can help resolve this problem, but it's a bit clunky when the argument value only changes when the project itself changes.
A concrete examples is my reference to a /tmp directory for new git worktrees. Because I may have multiple projects running this slash command at the same time, I would love to specify /tmp/${project.name} as the prefix rather than just /tmp.
Proposed Solution
Support "variables" declared in configuration files. These variables will become available as template variables anywhere prompts can be written for Claude code (such as user input, agent definition, or slash command definition)
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
.claude/settings.local.json
{
"env": {},
"vars": {
"project_name" : "claude-code-rocks",
"unicorn_status" : "obvious"
}
"permissions": {
"allow": [
"Bash(mvn clean:*)",
"Bash(mvn test:*)",
],
"deny": []
},
"enabledMcpjsonServers": [
"github",
"playwright",
"mysql"
]
}
prompt:
Create a new git worktree in the path /tmp/{{project_name}} for this work. This will now work because Anthropic's unicorn status is {{unicorn_status}}
Additional Context
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗