AGENT SKILL

zsh-dev

Use when writing a Zsh script or rc file, or translating bash to zsh: unmatched globs are fatal, no word splitting, 1-indexed arrays, =word expansion, parameter expansion flags, glob qualifiers, zmodload, and keeping compinit interactive. Triggers: writing a zsh script, zsh vs bash, zsh strict mode, zsh arrays, ${(L)var}, glob qualifiers, extended_glob, zmodload, zshrc, compinit. Bash is shell-dev, fish is fish-dev.

License 许可
GPL-3.0
最近更新
2026-11-13
Stars
★ 0
Forks
0

01 前言 Front Matter

name
zsh-dev
description
Use when writing a Zsh script or rc file, or translating bash to zsh: unmatched globs are fatal, no word splitting, 1-indexed arrays, =word expansion, parameter expansion flags, glob qualifiers, zmodload, and keeping compinit interactive. Triggers: writing a zsh script, zsh vs bash, zsh strict mode, zsh arrays, ${(L)var}, glob qualifiers, extended_glob, zmodload, zshrc, compinit. Bash is shell-dev, fish is fish-dev.

03 SKILL.md 正文

Writing Zsh

The Bash tool and the user's rc files run zsh. Zsh is close enough to bash to mislead, so this skill holds the differences that change behaviour silently and the user's header. Bash is shell-dev, fish is fish-dev.

Rules

  • Open a script with this header, because /bin/sh is dash on Arch and does not know setopt:

    #!/usr/bin/env zsh
    setopt err_exit no_unset pipe_fail warn_create_global
    
  • Add setopt local_options err_return inside a function, because err_exit does not propagate a failure out of a function body and err_return does.

  • Guard a glob with *.json(N) or setopt null_glob, because an unmatched glob is fatal (nomatch).

  • Index arrays from 1. $arr[1] is the first and ${arr[0]} is empty.

  • Split on purpose with ${=var} or an array, because $var never word-splits.

  • Quote a value that can start with =, because =word expands to a command path.

  • Set extended_glob at the top when a pattern uses ^, ~ or #, because it is off by default and the script then depends on the session that sourced it.

  • Use expansion flags and glob qualifiers instead of tr, find and eval: ${(L)name}, ${(j:,:)parts}, ${(P)varname}, *(.om[1]) newest file. They run in the current shell.

  • zmodload zsh/datetime, zsh/regex or zsh/mathfunc before using $EPOCHSECONDS, $MATCH or the math functions, because a script without it works here and fails in CI.

  • Load a plugin manager and compinit only under [[ -o interactive ]], because they cost 50 to 500 ms and assume a TTY. Gate zsh-only syntax in a file bash also sources on [[ -n $ZSH_VERSION ]].

Red flags

  • When a script forks tr, sed or find for something a flag or qualifier does, replace it, because the fork is slower and splits differently.

Say it in the reply

When you translate from bash, name the zsh difference that forced each change (glob, index, splitting), so the user sees why the line is not a copy.

04 同仓库更多 Skills

qsmark-labs
qsmark-labs/qsm-marketplace

worktrunk

Use when working with git worktrees or wt (worktrunk): creating, switching, merging or removing a branch workspace, configuring wt (project or personal config, workflow hooks around switch, commit and merge, commit-message generation, hook approvals), or a wt command that failed. Triggers: make a worktree for this branch, wt merge, wt remove, configure wt, .config/wt.toml, run tests before merge, install deps when a worktree is created, wt hook, wt switch does not cd, nastav wt, wt nefunguje.

★ 0
qsmark-labs
qsmark-labs/qsm-marketplace

web-ladder

Use when a task needs something the internet holds: look something up, search the web, find which page answers a question, read a page, check a library's current docs, a page that needs a browser or shows a captcha. Runs one research loop: searxng search, keywords, cases, search again up to three times, Context7 for a library, Tavily when the keywords will not come, one page in a browser, the person on a wall. Triggers: look this up, search the web, find out online, read this page, check the docs, the page is blocked, captcha, najdi na webu, otevri tu stranku. A multi-round question goes to the qsm-web:web-research agent; one tool's commands are its own skill (searxng, browserbox, opensrc).

★ 0
qsmark-labs
qsmark-labs/qsm-marketplace

searxng

Use when running a web search through the person's own SearXNG instance with qsm-web searxng: choosing a search profile or engines, the instance, time range or language, reading its JSON, a suspended engine. Triggers: search with searxng, qsm-web searxng, search profile, niche search, academic search, IT search, vyhledavaci profil, searxng is down, which engines. The research loop around it is the web-ladder skill.

★ 0
qsmark-labs
qsmark-labs/qsm-marketplace

opensrc

Use when the source code of an open-source library or repository is needed on disk to read: the docs are silent, the behaviour must be checked in code, the version the project pins. Runs qsm-web opensrc get with a package spec or a repository address. Triggers: get the source of this package, clone this library, read the library's code, qsm-web opensrc, stahni zdrojak knihovny. Library docs are the Context7 skill; the research loop is the web-ladder skill.

★ 0
qsmark-labs
qsmark-labs/qsm-marketplace

browserbox

Use when one page needs a real browser through qsm-web browserbox: content built by script, a page that blocks plain fetching, a captcha to solve or hand to the person, a scripted sequence of clicks, a login the person is present for. Triggers: open it in a browser, the page is empty without JavaScript, captcha, take over the browser, run these steps on the page, log in to this site, browserbox. When to reach for a browser at all is the web-ladder skill.

★ 0
qsmark-labs
qsmark-labs/qsm-marketplace

usage

Use when the user wants a review of how they use Claude Code, or setup hands over after a first install: review my Claude Code usage, audit my setup, what does my setup cost, where did my tokens go, clean up my Claude Code, usage report, zkontroluj moje pouzivani. One walkthrough of four stages (machine, work, habits, extensions), questions after each, then one plan. A question about one topic (which hooks are slow) goes to that topic's skill; this session's tokens alone is `/qsm-usage`.

★ 0