Add a zsh alias / function to ~/.zshrc idempotently. Supports ASCII
names (zxsd, gs) and 中文 function names (中信书店).
Part of lovstudio skills — by lovstudio.ai
git clone https://github.com/lovstudio/zsh-alias-skill ~/.claude/skills/lovstudio-zsh-aliasRequires: Python 3.8+ (stdlib only). zsh.
Add a 中文 trigger that runs claude with a prompt, plus an English shortcut:
python3 ~/.claude/skills/lovstudio-zsh-alias/scripts/add_alias.py \
--name 中信书店 \
--also-as zxsd \
--cmd 'claude "用一句温暖、具体、不肉麻的话让我开心,20字以内"' \
--comment '中信书店 → 启动 claude 说一句开心话'
source ~/.zshrcThen either 中信书店<Enter> or zxsd<Enter> triggers it.
Add a simple ASCII alias:
python3 .../add_alias.py --name gs --cmd 'git status' --simpleRemove an entry:
python3 .../add_alias.py --name 中信书店 --cmd unused --removeEach entry is wrapped in sentinel markers. Re-running with the same
--name updates in place — no duplicates:
# >>> lovstudio:zsh-alias >>> 中信书店
# 中信书店 → 启动 claude 说一句开心话
中信书店() { claude "..." }
zxsd() { 中信书店 "$@" }
# <<< lovstudio:zsh-alias <<< 中信书店
zsh supports CJK function names natively, no quoting tricks needed.
| Option | Default | Description |
|---|---|---|
--name |
(required) | Trigger name; ASCII or 中文 |
--cmd |
(required) | Shell command to run |
--also-as |
none | Extra alias names (repeatable) |
--comment |
empty | Comment line above the block |
--simple |
off | alias= form (ASCII only) |
--rcfile |
~/.zshrc |
Target rc file |
--dry-run |
off | Print, don't write |
--remove |
off | Remove the entry for --name |
Shell aliases require pressing Enter. If you want a trigger that fires the moment you finish typing a word (no Enter), you need an input-method shortcut or Hammerspoon — not this skill.
MIT