-
Notifications
You must be signed in to change notification settings - Fork 194
Description
Feature Request: Support for Custom Commands from ~/.claude/commands/
Problem Statement
Currently, GitHub Copilot CLI only loads custom instructions from CLAUDE.md
files in the current working directory and its parent directories. This limits the ability to create reusable, context-specific command templates that can be invoked across different projects.
Proposed Solution
Add support for loading custom command files from a standardized location like ~/.claude/commands/
(or ~/.config/copilot-cli/commands/
). These command files would act as specialized "expert mode" contexts that can be invoked when needed.
Example Use Case
A user working with multiple microservices in a large codebase could create a command file like ~/.claude/commands/<command>.md
that contains:
- Codebase-specific context and constraints
- Common investigation workflows
- Tool authentication references
- Sub-agent orchestration patterns
- Known gotchas and patterns
The user could then invoke this with something like /<command> <task>
or by having Copilot CLI automatically detect when this context is needed.
Benefits
- Reusability: Write once, use across all projects in the same ecosystem
- Organization: Keep project-specific
CLAUDE.md
lean while maintaining rich contextual commands - Shareability: Teams can share standardized command templates
- Separation of Concerns:
CLAUDE.md
= project/directory-specific context~/.claude/commands/
= reusable expert mode templates
Proposed Implementation
Option 1: Explicit Invocation
User types a command like /<command> investigate memory leak
which:
- Loads
~/.claude/commands/<command>.md
- Appends task arguments (
$ARGUMENTS = "investigate memory leak"
) - Activates that context for the conversation
Option 2: Auto-detection
Copilot CLI scans for .md
files in ~/.claude/commands/
at startup and:
- Lists available commands in help text
- Allows user to reference them explicitly
- Potentially suggests relevant commands based on current directory context
Option 3: Configuration File
Add a ~/.config/copilot-cli/config.yml
that specifies:
commands:
path: ~/.claude/commands
auto_load: false # or true to load all at startup
Example Command File Structure
# Expert Mode: [Name]
Context and specialized knowledge...
## Sub-Agents
Links to other specialized agents...
## Workflows
Step-by-step investigation patterns...
---
**Task:** $ARGUMENTS
[Instructions to apply the above expertise to complete the task]
Alternative Considerations
- Security: Ensure command files can't execute arbitrary code, only provide context
- Naming: Support both
/command-name
slash syntax and natural language detection - Composition: Allow commands to reference or chain other commands
- Discoverability:
copilot --list-commands
to show available custom commands
Related Tools
This pattern is inspired by:
- Cursor AI's agent framework
- Claude.ai Projects with custom instructions
- VSCode's task system
- Shell rc files and profile loading patterns
Would love to hear the team's thoughts on this approach!