Claude Code already supports piping — but the syntax is a mouthful:
ls -la | claude -p "Help me understand why these build artifacts look wrong"That's too much typing for something you want to reach for 50 times a day. So I wrapped it in a three-letter shell function and it changed how often I use it.
Add this to your ~/.zshrc (or ~/.bashrc):
# Quick Claude prompt shortcut
# -t 0 checks if stdin is a terminal (no pipe); if piped, stdin is read as context
ask() {
if [ -t 0 ]; then
claude -p "$*"
else
claude -p "$(cat -)" "$*"
fi
}Then reload your shell:
source ~/.zshrcAsk anything directly:
ask what is the capital of FrancePipe files and ask questions about them:
cat README.md | ask what is this project aboutPipe any command output for instant analysis:
git diff | ask summarize these changes
git log --oneline -20 | ask what has the team been working on
docker ps | ask which containers are using the most ports
cat package.json | ask are any of these dependencies outdated
kubectl get pods | ask are there any pods in a bad stateChain it into your workflows:
curl -s https://api.example.com/health | ask is everything healthy
cat error.log | tail -50 | ask what went wrong hereThe best tools disappear into your workflow. ask turns Claude into a Unix citizen — something you pipe to, chain with, and reach for without thinking. No context switching, no separate app, no ceremony. Just a question, right where you already are.
Note: ask is intentionally simple — it's a shortcut for claude -p, not a replacement for the full CLI. If you need flags like --model, --output-format, or --max-turns, use claude directly.