configuring-zsh
Original:🇺🇸 English
Translated
Chooses the zsh startup file (.zshenv, .zprofile, .zshrc, .zlogin, or a custom plugin under ZSH_CUSTOM) for a configuration change and edits the dotfiles repo source behind the symlink. Use when the user says "update the zsh config", or when adding or moving environment variables, PATH entries, aliases, functions, setopt or zstyle options, or completions in zsh config.
7installs
Sourcebostonaholic/skills
Added on
NPX Install
npx skill4agent add bostonaholic/skills configuring-zshTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Configuring zsh
Edit the source, not the symlink
- Startup files usually live in a dotfiles repo and are symlinked into (or
$HOME).$ZDOTDIR - Write to the repo file, not the link: many editors and write tools replace a symlink with a regular file.
- Register a new startup file wherever the repo creates its links, and ask before running its installer.
- If the repo links a into
<name>.plugin.zsh, follow the oh-my-zsh plugin layout.${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/<name>/
Choose the startup file
- :
.zprofile, tool init that sets it (PATH), variables for programs (eval "$(brew shellenv)"). NotEDITOR: macOS.zshenvmoves its entries behind the system paths. Notpath_helper: it never runs for programs started outside an interactive shell..zshrc - : variables every shell needs, including scripts (
.zshenv, guard flags). Keep it fast and silent.ZDOTDIR - :
.zshrc,setopt, prompt, framework and plugin list;zstyleadditions beforeFPATH(with oh-my-zsh, before sourcingcompinit); aliases, functions, theiroh-my-zsh.sh, and interactive variables (compdef) afterLESS, or in the custom plugin file.compinit
Before adding an alias or function, check that an enabled plugin does not
already define it: .
zsh -ic 'whence -v <name>'Aliases that shadow commands
- An alias that replaces a standard command (,
ls,cat,grep,rm) breaks scripts and agents that shell out through this config.cd - Agent harnesses may replay aliases captured from an interactive shell, so an interactivity check alone does not protect them.
- If the config already has a guard for shadowing aliases, put the new alias behind it.
- Otherwise ask the user before adding one, and suggest a guard that also
checks agent markers such as .
CLAUDECODE - Aliases with new names (,
lg) need no guard.gti
Validate
- for each edited file.
zsh -n <file> - Confirm the change with for
zsh -c,.zshenvforzsh -lc,.zprofileforzsh -icor a plugin..zshrc - For a guarded alias, read every marker the guard tests, then confirm the
definition prints with all of them unset
(, one
env -u CLAUDECODE -u AI_AGENT zsh -ic 'alias <name>'per marker) and is gone with one set (-u).CLAUDECODE=1 zsh -ic 'alias <name>'