Install claudesidian shell command to launch Claude Code from anywhere. Use when the user wants to install a shell alias/launcher for their vault, or asks to set up the claudesidian command.
69
83%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Creates a shell alias/function that allows you to run claudesidian from
anywhere to open your vault in Claude Code.
Install a shell command that:
Similar to having a quick launcher for your vault.
The command will be an alias that:
cd /path/to/your/vaultclaude --resume 2>/dev/null|| claude(cd "/path/to/vault" && (claude --resume 2>/dev/null || claude))Important: The path must be properly escaped to handle spaces and special characters.
This automatically enters resume mode if there's an existing session, or starts a new one if not.
Add the alias to the appropriate config file:
~/.bashrc or ~/.bash_profile~/.zshrc~/.config/fish/config.fishDetects the user's default shell, with support for command-line override:
# Check if shell specified as argument (/install-claudesidian-command zsh)
if [ -n "$1" ]; then
# User provided shell type as argument
SHELL_TYPE="$1"
else
# Auto-detect from $SHELL (user's default shell, not current shell)
SHELL_TYPE=$(basename "$SHELL")
fi
# Validate shell type and set appropriate config file
case "$SHELL_TYPE" in
zsh)
CONFIG_FILE="$HOME/.zshrc"
;;
bash)
# Prefer .bashrc on Linux, .bash_profile on macOS
if [ -f "$HOME/.bashrc" ]; then
CONFIG_FILE="$HOME/.bashrc"
else
CONFIG_FILE="$HOME/.bash_profile"
fi
;;
fish)
CONFIG_FILE="$HOME/.config/fish/config.fish"
;;
*)
echo "❌ Unsupported shell: $SHELL_TYPE"
echo " Supported shells: bash, zsh, fish"
echo " Usage: /install-claudesidian-command [bash|zsh|fish]"
exit 1
;;
esac
echo "🐚 Installing for: $SHELL_TYPE"
echo "📝 Config file: $CONFIG_FILE"Key improvements:
$SHELL to detect default shell (not $ZSH_VERSION/$BASH_VERSION
which detect current session)Detect shell: Use argument if provided, otherwise auto-detect from
$SHELL
Get vault path: Use pwd to get current directory
Escape the path: Properly escape quotes and special characters for shell safety
# Escape backslashes FIRST (so we don't double-escape ones we add later)
ESCAPED_PATH="${VAULT_PATH//\\/\\\\}"
# Then escape double quotes
ESCAPED_PATH="${ESCAPED_PATH//\"/\\\"}"Check if already installed: Search config file for existing
claudesidian alias/function
# Check for existing alias/function
if grep -q "alias claudesidian\|function claudesidian" "$CONFIG_FILE"; then
echo "⚠️ Found existing claudesidian command:"
grep -A 3 "claudesidian" "$CONFIG_FILE"
echo ""
read -p "Replace it? (yes/no): " replace_answer
if [[ ! "$replace_answer" =~ ^[Yy] ]]; then
echo "Installation cancelled. Existing command preserved."
exit 0
fi
# Mark for replacement (will remove before adding new one)
REPLACING=true
fiGet user confirmation: Show what will be added and get final confirmation
Create backup: Only if proceeding with modification
# Create backup with timestamp
BACKUP_FILE="$CONFIG_FILE.backup-$(date +%Y%m%d-%H%M%S)"
cp "$CONFIG_FILE" "$BACKUP_FILE"
echo "💾 Backup created: $BACKUP_FILE"Build the safe alias/function command: Use the escaped path from step 3
# CRITICAL: Use $ESCAPED_PATH in the command (not raw $VAULT_PATH)
if [ "$SHELL_TYPE" = "fish" ]; then
# Fish uses function syntax, not alias
COMMAND_TEXT="function claudesidian
cd \"$ESCAPED_PATH\" && (claude --resume 2>/dev/null; or claude)
cd -
end"
else
# Bash/Zsh use alias syntax
# IMPORTANT: Use double quotes around $ESCAPED_PATH to preserve escaping
COMMAND_TEXT="alias claudesidian='(cd \"$ESCAPED_PATH\" && (claude --resume 2>/dev/null || claude))'"
fiRemove old command if replacing:
if [ "$REPLACING" = true ]; then
# Bash/Zsh: alias is a single line — delete just that line
sed -i.tmp '/^alias claudesidian/d' "$CONFIG_FILE"
# Fish: function spans multiple lines — delete from `function claudesidian`
# to the matching `end`
sed -i.tmp '/^function claudesidian/,/^end$/d' "$CONFIG_FILE"
rm -f "$CONFIG_FILE.tmp"
fiWhy two separate sed calls: A combined range like
/alias claudesidian\|function claudesidian/,/^end$/d would, for the alias
case, keep eating lines until it found the next ^end$ somewhere else in
the file (or EOF). That could nuke unrelated config below. Single-line
delete for the alias, range delete for the function — never combine them.
Add command to config file: Append using the escaped command text
echo "$COMMAND_TEXT" >> "$CONFIG_FILE"Show success message: With instructions to reload shell
Bash/Zsh Example (with spaces in path to demonstrate escaping):
🔧 Installing claudesidian command...
📁 Vault path: /home/user/My Obsidian Vault
🐚 Shell detected: zsh
📝 Config file: /home/user/.zshrc
💾 Backup created: /home/user/.zshrc.backup-20250107-143025
✅ Installed! Added to /home/user/.zshrc:
alias claudesidian='(cd "/home/user/My Obsidian Vault" && (claude --resume 2>/dev/null || claude))'
🔄 To activate, run:
source ~/.zshrc
Or start a new terminal session.
✨ Test it: Type 'claudesidian' from any directory!Fish Shell Example:
🔧 Installing claudesidian command...
📁 Vault path: /home/user/My Obsidian Vault
🐚 Shell detected: fish
📝 Config file: /home/user/.config/fish/config.fish
💾 Backup created: /home/user/.config/fish/config.fish.backup-20250107-143025
✅ Installed! Added to /home/user/.config/fish/config.fish:
function claudesidian
cd "/home/user/My Obsidian Vault" && (claude --resume 2>/dev/null; or claude)
cd -
end
🔄 To activate, run:
source ~/.config/fish/config.fish
Or start a new terminal session.
✨ Test it: Type 'claudesidian' from any directory!The implementation properly handles paths with:
/Users/noah/My Vault/Users/noah/vault's backupPaths are double-quoted and any embedded quotes/backslashes are escaped.
Fish shell uses different syntax than Bash/Zsh:
Bash/Zsh (alias):
alias claudesidian='(cd "/path" && command)'Fish (function):
function claudesidian
cd "/path" && (command; or fallback)
cd -
endKey differences:
function keyword instead of alias for complex commands; or instead of || for fallback logiccd - to return to previous directory (instead of subshell)The installation automatically detects Fish and uses the correct syntax.
This command modifies your shell configuration file (a sensitive operation). Safety measures:
If anything goes wrong, restore from: $CONFIG_FILE.backup-YYYYMMDD-HHMMSS
() (or cd - in Fish) so it returns to your
original directory afterYYYYMMDD-HHMMSS)Install for your default shell (auto-detected):
/install-claudesidian-commandInstall for specific shell (override auto-detection):
/install-claudesidian-command zsh
/install-claudesidian-command bash
/install-claudesidian-command fishWhen to specify shell:
Bash/Zsh (alias with subshell):
alias claudesidian='(cd "/path/to/vault" && (claude --resume 2>/dev/null || claude))'(cd "/path/to/vault" && ...) - Subshell that changes directory temporarily
(path is double-quoted for safety)claude --resume 2>/dev/null - Tries to resume existing session, suppresses
error|| claude - If resume fails (no session), starts new sessionFish (function with cd -):
function claudesidian
cd "/path/to/vault" && (claude --resume 2>/dev/null; or claude)
cd -
endcd "/path/to/vault" - Changes to vault directory (path is double-quoted for
safety)claude --resume 2>/dev/null - Tries to resume existing session, suppresses
error; or claude - If resume fails (no session), starts new session (Fish
syntax)cd - - Returns to previous directory after Claude exits6c56f35
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.