⌨️CLAUDE_PROJECT_DIR
Also known as ${CLAUDE_PROJECT_DIR}
The path to the top folder of a project, for hook scripts.
Think of it like
It is like your home address. It works from any street.
Example
Lucy's hook broke each time Claude moved into a subfolder. She starts the path with this variable. Now it finds the script every time.
Why it matters
A relative path depends on where Claude is. This one does not.
Definition
Example code
json
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check.sh"
}Common mistake
Key takeaways
- 1Project root. Where it started.
- 2For script paths. In hooks.
- 3Quote it. Spaces break it.