| name | new-zsh-plugin |
| description | Scaffold a new Z-Shell-Standard-compliant Zsh plugin. Use when the user asks to create a new Zsh plugin, start a plugin from scratch, or add a plugin skeleton. Generates a compliant entry file (modeline, ZERO handling, Plugins hash, fpath guard, unload function) plus functions/ and docs/ layout. |
| disable-model-invocation | true |
Create a new Zsh plugin
Scaffold a plugin that conforms to the Z-Shell Plugin Standard and this workspace's CLAUDE.md conventions.
Steps
-
Gather inputs (ask only if not supplied):
- Plugin name in kebab-case, e.g.
zsh-foo → entry file zsh-foo.plugin.zsh.
- A target directory (default:
repos/plugins/<name>/).
- Derive
PLUGIN_KEY = upper-snake of the name without a zsh- prefix, e.g. zsh-foo → ZSH_FOO.
-
Create the layout:
<name>/
<name>.plugin.zsh
functions/
lib/
docs/
-
Write the entry file from templates/plugin.plugin.zsh, replacing __NAME__ (kebab name), __KEY__ (PLUGIN_KEY), and __FPATH_VAR__ (<KEY>_FPATH). Keep the modeline as the first two lines verbatim.
-
Verify: run zsh -n <name>.plugin.zsh. It must pass before reporting done. Source it in a subshell to confirm the unload function is defined:
zsh -ic 'source ./<name>.plugin.zsh; (( ${+functions[<name>_plugin_unload]} )) && echo unload-ok'
-
Report the created tree and remind the user to fill in functions/ (autoloaded, strict-emulation header) and lib/ (sourced) as needed.
Conventions to honor