Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Zsh plugin that integrates Claude Code CLI into your shell. Chat with Claude and execute AI-generated commands directly from your terminal prompt

License

Notifications You must be signed in to change notification settings

3dyuval/zsh-claude-code-shell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

zsh-claude-code-shell

An oh-my-zsh plugin that translates natural language comments into shell commands using Claude Code.

Demo

# find all js files larger than 100kb modified in the last week and show their sizes

Press Enter, and the line becomes:

find . -name "*.js" -size +100k -mtime -7 -exec ls -lh {} \;

Review the command, press Enter again to execute.

Another example:

# recursively find and delete all node_modules folders

Becomes:

find . -type d -name "node_modules" -prune -exec rm -rf {} +

Prerequisites

Installation

oh-my-zsh

Clone to your custom plugins directory:

git clone https://github.com/ArielTM/zsh-claude-code-shell ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-claude-code-shell

Add to your ~/.zshrc:

plugins=(... zsh-claude-code-shell)

Restart your shell or run source ~/.zshrc.

Manual

Clone the repository and source the plugin:

git clone https://github.com/ArielTM/zsh-claude-code-shell ~/zsh-claude-code-shell
echo 'source ~/zsh-claude-code-shell/zsh-claude-code-shell.plugin.zsh' >> ~/.zshrc

zinit

zinit light ArielTM/zsh-claude-code-shell

zplug

zplug "ArielTM/zsh-claude-code-shell"

Usage

  1. Type a comment starting with # followed by what you want to do
  2. Press Enter
  3. The comment is replaced with the generated command
  4. Review the command, press Enter to execute (or edit it first)

Examples

# find all TODO comments in typescript files
# becomes: grep -rn "TODO" --include="*.ts" .

# show top 10 largest files in current directory recursively
# becomes: find . -type f -exec du -h {} + | sort -rh | head -10

# kill all processes matching "node"
# becomes: pkill -f node

# compress all log files older than 30 days
# becomes: find . -name "*.log" -mtime +30 -exec gzip {} \;

# show git commits from last week with stats
# becomes: git log --since="1 week ago" --stat

# find duplicate files by md5 hash
# becomes: find . -type f -exec md5sum {} + | sort | uniq -w32 -dD

Configuration

Set these environment variables in your ~/.zshrc before the plugin loads:

Variable Default Description
ZSH_CLAUDE_SHELL_DISABLED 0 Set to 1 to disable the plugin
ZSH_CLAUDE_SHELL_MODEL (default) Override the Claude model (e.g., sonnet, opus)
ZSH_CLAUDE_SHELL_DEBUG 0 Set to 1 to show debug output
ZSH_CLAUDE_SHELL_FANCY_LOADING 1 Set to 0 to use simple loading message instead of animated spinner

Example

# Use a specific model
export ZSH_CLAUDE_SHELL_MODEL="sonnet"

# Temporarily disable
export ZSH_CLAUDE_SHELL_DISABLED=1

How It Works

The plugin overrides zsh's accept-line widget (the Enter key handler). When you press Enter:

  1. If the line starts with # , it extracts your description
  2. Calls claude -p with your description
  3. Replaces the buffer with the generated command
  4. You review and press Enter again to execute

Lines that don't start with # work normally.

License

MIT

About

Zsh plugin that integrates Claude Code CLI into your shell. Chat with Claude and execute AI-generated commands directly from your terminal prompt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%