[FEATURE] Ability to run slash command in CLAUDE.md
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
Claude does not always follow instructions in the CLAUDE.md file (loading skills, incorporating validation into all workflows, etc...).
Claude hooks do not allow running custom slash commands within Claude.
I always have to remind Claude to run the critical workflow from the CLAUDE.md file so that it has the context it needs to proceed.
Example of the start of every Claude session I run:
> Have you run the critical workflow within CLAUDE.md?
● No, I haven't. Let me run the critical workflow now:
⎿ Allowed 1 tools for this command
● Read(.claude/hooks/auto-validate.md)
⎿ Read 233 lines
> /setup-claude is running…
> The "git-management-skill" skill is running
⎿ Allowed 1 tools for this command
● I'm running the critical workflow. Let me wait for the /setup-claude command to complete so it can prompt you about
which project to work on.
The git-management-skill has loaded and I can see from your current branch
(cnatis/feature/my-awesome-feature-phase1) that you're working on a feature task with phases.
The skills are now loaded.
Once /setup-claude completes, I'll:
- Confirm the project you're working on (appears to be plx-web based on your branch and file changes)
- Load that project's CLAUDE.md
- Load the project resources
- Be ready to help with your work
Proposed Solution
I'd like for Claude to run slash commands in the CLAUDE.md file so that I do not have to remember to tell Claude to load critical context before working.
This should run on every new session, and when context is cleared (whenever CLAUDE.md is loaded).
Example CLAUDE.md file:
# Required Instructions
- Always be very concise!
## Workflow
- **CRITICAL**: Run SlashCommand(/setup-claude) command
- **CRITICAL**: Load the skill tool for all the skills listed in this file under the `Skills` heading
- **CRITICAL**: After completing significant work, automatically run validation (see Auto-Validation Hook below)
## Instructions
1. Run SlashCommand(/setup-claude) command to understand what project(s) we are working in
2. Make sure that all Skills under the `Reference -> Skills` heading below have been loaded
3. Read the auto validation hook under the `Reference -> Auto-Validation Hook` heading
4. Ensure that project resources have been loaded for the project(s) we are working in see `Reference -> Workspace Structure` to understand
Alternative Solutions
I have tried to use hooks, but they cannot run slash commands.
I have tried to have CLAUDE.md run the slash command, but it never does.
Current workaround is to remind Claude to run the critical workflow at the start of every session and whenever context is cleared.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
- I am working in a Claude workspace that shares a common Claude configuration across multiple sub repositories
- I start a new Claude session
- Claude instantly asks me for context (because thats what my slash command does), so that I can tell it what sub repository I am working in, so that it can load resources from that sub repository (each sub repository contains the same resource folder structure)
Additional Context
_No response_
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Feature Analysis: Auto-Execute Slash Commands in CLAUDE.md
This is a well-thought-out feature request. Here's the technical approach and implementation path.
Problem Validation
Pain point confirmed: Users must manually run setup commands every session.
Current workarounds:
Proposed Solution:
AutoExecBlockIn CLAUDE.md:
Parsing logic:
Execution flow:
Security Considerations
Risk: Malicious CLAUDE.md could auto-execute harmful commands
Mitigation 1: Whitelist
Mitigation 2: User Confirmation
Mitigation 3: Project Trust System
Alternative: Hook-Based Approach
Add new hook: SessionStart
Implementation:
Configuration Options
UI Feedback
When autoexec runs:
Related Feature: AutoLoad Resources
Extend to auto-load files:
Why this is powerful: Eliminates "context loading fatigue" entirely.
Implementation Priority
Phase 1: Basic autoexec with confirmation (1 week)
Phase 2: Project trust system (1 week)
Phase 3: Hook integration (1 week)
Phase 4: AutoLoad resources (2 weeks)
---
Verdict: This is a HIGH value feature for power users.
Suggest: Implement Phase 1 (basic autoexec) first, gather feedback, iterate.
https://github.com/anthropics/claude-code/issues/10808 is most similar to a solution that will work for my problem
@JuanCS-Dev please provide a feature analysis on https://github.com/anthropics/claude-code/issues/10808 since it will solve my problem and does not currently have a feature analysis
@cnatis Done
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.