A collection of command-line tools and Vim integration for interacting with Claude AI.
This repository contains several tools for using Claude AI in your daily workflow:
- claude-ask - Command-line tool for asking Claude questions and getting responses
- claude-bash - Generate and execute bash commands using natural language
- claude-fix - Fix issues in scripts and files using Claude
- claude-agent - A CLI agent that uses Claude AI to execute system tasks
- claude-vim - Vim plugin for seamless Claude integration in your editor
All tools use the secure tulikieli credential manager to retrieve your Claude API key.
- Arch Linux (or other Linux distribution with minimal adjustments)
jqpackage installed (sudo pacman -S jq)curlpackage installed (usually pre-installed)- Tulenkantajat secure credential manager set up with your Claude API key
This project uses Tulenkantajat, a secure GPG-based credentials management system, to safely store and retrieve your Claude API key.
# First install Tulenkantajat if you haven't already
# Follow the instructions at: https://github.com/mijuny/tulenkantajat
# Add your Claude API key to the credential manager
tulikieli add claude api_key "your_actual_api_key_here"- Clone this repository or copy the scripts to your preferred location
- Make the scripts executable:
chmod +x ~/bin/claude-ask chmod +x ~/bin/claude-bash chmod +x ~/bin/claude-fix chmod +x ~/bin/claude-agent.sh
- Ensure ~/bin is in your PATH:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc # Or for zsh echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
- Install the Vim plugin by copying it to your Vim plugin directory:
mkdir -p ~/.vim/plugin cp claude-vim.vim ~/.vim/plugin/
Ask Claude questions and receive answers directly in your terminal.
# Basic usage
claude-ask "What is quantum computing?"
# Process content from a file
cat file.txt | claude-ask "Summarize this text"
# Save response to a file
claude-ask -o response.md "Write a markdown document about climate change"-o FILE- Save response to the specified file-m MODEL- Specify Claude model (default: claude-3-7-sonnet-20250219)-t TOKENS- Maximum tokens in response (default: 4096)-v- Verbose mode (show API request details)-h- Show help message
- Process piped input for analyzing files
- Save responses to files
- Control model parameters
- Handles special characters and formatting correctly
Generate and execute bash commands from natural language descriptions.
# Generate a command to list specific files
claude-bash "find all .sh files in my home directory"
# System information commands
claude-bash "show me my current disk usage"
# Network commands
claude-bash "find my ip address"- Generates bash commands based on natural language descriptions
- Shows the command and asks for confirmation before executing
- Allows editing the command before execution
- Automatically fixes common issues like unquoted wildcards
- Safety checks for potentially destructive commands
Fix issues in scripts and code files using Claude.
# Fix issues in a script
claude-fix script.sh "Fix the error handling in this script"
# Update a configuration file
claude-fix config.json "Add proper indentation and comments"
# Fix a script and include its runtime output for context
claude-fix script.py "The script fails when processing empty input"- Reads a file, has Claude analyze and fix it
- Creates a backup of the original file (.bak extension)
- Preserves file permissions
- Performs sanity checks before updating the file
- Prompts for confirmation for significant changes
A CLI agent that uses Claude AI to execute system tasks by determining and running the appropriate commands.
# Basic usage
claude-agent.sh "Collect all hardware information about my computer"
# Save output to a file
claude-agent.sh -o system_report.md "Generate a system report"
# Set a custom output directory
claude-agent.sh -d /path/to/output "Check disk usage and suggest cleanup"-o FILE- Save final output to the specified file-d DIRECTORY- Output directory (default: ~/claude_agent)-m MODEL- Specify Claude model (default: claude-3-7-sonnet-20250219)-i ITERATIONS- Maximum iterations (default: 5)-t TIMEOUT- Command timeout in seconds (default: 30)-v- Verbose mode (show API requests and responses)-r- Force root access (use sudo for all commands)-h- Show help message
- Intelligently breaks down complex tasks into step-by-step commands
- Creates detailed logs of all commands and their outputs
- Validates commands before execution for safety
- Handles sudo commands with user confirmation
- Timeouts for long-running commands
- Organizes outputs in session-based directories
Seamlessly use Claude AI directly within Vim.
:AskClaude- Ask Claude a question:AskClaudeSelection- Send selected text to Claude with an optional prompt:AskClaudeBuffer- Send the entire buffer/file to Claude for analysis
<leader>ca- Ask Claude (in normal mode) or send selection to Claude (in visual mode)<leader>cf- Send the entire file/buffer to Claude
- In normal mode, press
<leader>ca - Type your question at the prompt
- A new buffer opens with Claude's response
- Select code in visual mode (
v) - Press
<leader>ca - Enter a prompt like "Explain this code" or "Fix these bugs"
- Claude analyzes the selection and shows results in a new buffer
- With a file open in Vim, press
<leader>cf - Enter a prompt like "Refactor this script" or "Optimize this code"
- Claude processes the entire file and shows results in a new buffer
After Claude responds in a new buffer, you can navigate between buffers:
Ctrl+o- Jump back to previous bufferCtrl+i- Jump forwardCtrl+^- Toggle between current and last buffer:bpand:bn- Previous and next buffer
-
For code analysis: Use specific prompts like "Find bugs" or "Optimize this function" rather than general ones.
-
For document creation: Use
claude-ask -o filename.mdto directly save responses to files. -
For shell commands: When using
claude-bash, review the command before execution, especially for file operations. -
For the agent: When using
claude-agent.sh, provide clear task descriptions and review any sudo commands before confirming execution. -
Vim workflow: Use split windows (
Ctrl+w sorCtrl+w v) to view Claude's response alongside your code. -
Security: Review all commands from
claude-bashandclaude-agent.shbefore execution.
If you see "Could not retrieve Claude API key":
tulikieli get claude api_keyIf this doesn't return your API key, add it with:
tulikieli add claude api_key "your_actual_api_key_here"If you're having issues with the Tulenkantajat credential manager:
# Check if Tulikieli is properly installed
which tulikieli
# View available credentials
tulikieli list
# Check the Tulenkantajat project documentation for more help
# https://github.com/mijuny/tulenkantajatIf you see "command not found" errors, ensure the scripts are executable and in your PATH:
chmod +x ~/bin/claude-*
echo $PATH # Verify ~/bin is includedIf Vim commands aren't recognized:
:scriptnames " Check if claude-vim.vim is listed
:source ~/.vim/plugin/claude-vim.vim " Reload the pluginThese tools are provided under the MIT License.
- Developed for personal use with the Claude API by Anthropic.
- Uses Tulenkantajat for secure credential management.