zsh-completions

Author Zsh completion scripts with _arguments, colors, and dynamic suggestions.

Updated May 19, 2024
One-click install
npx skills add https://github.com/kettleofketchup/dotfiles --skill zsh-completions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zsh-completions
Source: https://github.com/kettleofketchup/dotfiles/tree/main/.claude/skills/zsh-completions
Command: npx skills add https://github.com/kettleofketchup/dotfiles --skill zsh-completions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies and standardizes the authoring of Zsh completion scripts, enabling robust, descriptive, and colorized command completions with dynamic behavior.

Core Features & Use Cases

  • Author completion scripts using _arguments, _describe, and _values for reliable option and argument completion.
  • Integrate colors with ZLS_COLORS and groupings with fzf-tab for organized, readable outputs.
  • Build nested subcommand trees (e.g., git and kubectl style) and generate dynamic completions from external commands.
  • Use this Skill when implementing CLI tooling that requires polished, user-friendly command completion and debugging tips.

Quick Start

  • Create a completion function for a command (for example _mycommand) using _arguments to declare flags and positionals.
  • Place the script in ~/.config/zsh/completions/_mycommand and load it via fpath + compinit in your .zshrc.
  • Restart the shell or source the file to activate the completion.

Frequently Asked Questions about zsh-completions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create zsh completions with descriptions for my custom CLI tool?

Create zsh completions with descriptions by authoring a completion function using _arguments to declare flags and positionals, then placing the script in your fpath and loading it via compinit. This Skill provides references for structuring these scripts with descriptive text and color styling.

What is the best way to build dynamic zsh completions from external commands?

Building dynamic zsh completions from external commands is supported through this Skill's reference patterns. It guides you in generating dynamic suggestions and integrating them with zsh completion mechanisms like compinit for responsive, data-driven CLI inputs.

Can I use fzf-tab and ZLS_COLORS to add colors and groupings to my zsh completions?

Yes, you can use fzf-tab and ZLS_COLORS to add colors and groupings to your zsh completions. This Skill provides reference material for integrating these tools to produce organized, readable, and colorized completion outputs.

How do I structure nested subcommands for git or kubectl style CLI tools in zsh?

Structuring nested subcommands for git or kubectl style CLI tools in zsh requires specific completion tree patterns. This Skill offers references for building these nested subcommand structures and managing complex argument definitions reliably.

Where do I place zsh completion scripts so they load automatically in my shell?

Place zsh completion scripts in a directory on your fpath, such as ~/.config/zsh/completions, and ensure compinit is loaded in your .zshrc. Restart your shell or source the file to activate the completion script.

What are the limitations of using standard zsh completion scripts for complex CLI tools?

Standard zsh completion scripts can become difficult to maintain for complex CLI tools without a structured approach. This Skill addresses that constraint by enforcing a structure with YAML frontmatter and optional references to support rich context and robust script maintenance.