Supercharging Claude Code with the Right (CLI) Tools
I’ve been using Claude Code quite a bit lately, and I got curious – what if I asked it directly which tools would make it more productive? Not the usual suspects like ripgrep, jq or git, but tools it wishes it had access to, tools that would genuinely extend its capabilities.
So I did exactly that. I asked Claude Code: “What are the most valuable CLI tools I could install for you, outside of the ones you already have?” The answer was surprisingly thoughtful and insightful, so I figured I’d share it here along with my own commentary. Here are 10 tools, ranked by how useful they’d be for an AI coding assistant.
Note: I write all my blog posts old-school, but this time around I took the liberty to just extend with my comments the output generated by Claude Code.
Note also that the post includes some installation instructions that are macOS-specific. That’s what I got from Claude on my local machine (a Mac mini), and I felt it didn’t make much sense to tweak them given how many combinations of operating systems and package managers exist.
High Value
1. ast-grep
1
brew install ast-grep
This was Claude’s number one pick, and I can see why. ast-grep does structural code search and refactoring using AST patterns. Instead of fumbling with regex to find “all calls to function X with 3 arguments”, you write patterns that look like actual code:
1
2
3
4
5
# Find all console.log calls
sg -p 'console.log($$$ARGS)' -l js
# Refactor optional chaining candidates
sg -p '$PROP && $PROP()' --rewrite '$PROP?.()' -l ts
This is the kind of thing where regex is fragile and error-prone, but AST matching just works. Supports 20+ languages via tree-sitter.
2. difftastic
1
brew install difftastic
A structural diff tool that understands syntax. difftastic compares files by AST nodes rather than lines, so it won’t flag whitespace changes or reformatting as meaningful diffs. This makes reviewing AI-generated changes much clearer – and let’s be honest, reviewing changes is half the job when working with an AI assistant.
3. shellcheck
1
brew install shellcheck
AI assistants generate a lot of shell commands, and shell scripting is notoriously full of pitfalls (unquoted variables, [ ] vs. [[ ]], POSIX compatibility…). ShellCheck catches these before they blow up. Given that shell bugs can be destructive (e.g., rm -rf $UNSET_VAR/ expanding to rm -rf /), having a safety net here is valuable.
Medium Value
4. sd
1
brew install sd
A modern sed replacement with sane regex syntax – no more escaping nightmares. Uses standard PCRE-style regex and has a string-literal mode (-F) for replacing code strings full of metacharacters. Simple, but it eliminates a whole class of errors when generating substitution commands.
5. scc
1
brew install scc
Sloc Cloc and Code – a fast code counter that gives you an instant overview of a codebase: languages, lines of code, complexity estimates. Understanding the shape of a project before diving in is genuinely useful context for an AI assistant, and this is hard to replicate by manually scanning files.
Note: I was under the impression that cloc is a better tool, but perhaps I was mistaken.1
6. yq
1
brew install yq
jq for YAML (and JSON, TOML, XML). Modern projects are drowning in YAML – GitHub Actions workflows, Kubernetes manifests, Docker Compose files. yq can programmatically query and update YAML while preserving comments and formatting, which is much more reliable than text-based editing that can break indentation.
7. comby
1
brew install comby
Structural search and replace that works across languages without needing a full parser. Complements ast-grep for simpler pattern matching – it understands delimiters (braces, parens, quotes) but doesn’t need tree-sitter grammar support. Great for quick refactoring across less common languages or config files.
Note: I was happy to see that comby was written in OCaml, but when I installed it I got a warning that the project was deprecated and doesn’t support OCaml 5, so I’m not sure about its future.
Nice to Have
8. hyperfine
1
brew install hyperfine
A command-line benchmarking tool that runs commands multiple times and gives you proper statistical analysis. When you ask an AI to optimize something, it’s nice to have real numbers. The --export-markdown flag produces results ready for a PR description.
9. watchexec
1
brew install watchexec
A file watcher that executes commands when files change. Useful for setting up persistent feedback loops – rerun tests on save, rebuild docs when markdown changes, restart a dev server after config edits. One command instead of cobbling together something with fswatch and shell scripts.
10. delta
1
brew install git-delta
A syntax-highlighting pager for git diff and friends. Provides word-level diff highlighting, so when only a variable name changes in a long line, you see exactly that. Mostly benefits the human reviewing the AI’s work, but that’s arguably where it matters most.
Epilogue
If you only install one tool from this list, make it ast-grep. It’s the biggest capability gap – an AI assistant limited to regex-based search and replace is like a carpenter limited to a hand saw. Everything else is nice to have, but structural code understanding is a genuine superpower.
You can install everything at once if you’re feeling adventurous:
1
brew install ast-grep difftastic shellcheck sd scc yq comby hyperfine watchexec git-delta
I’m not ashamed to admit that I had never heard of some of the tools (e.g. sd, yq and comby), and I had only one of them installed (scc).2 It’s never too late to learn something new!
By the way, keep in mind that depending on the programming languages that you’re using there are other language specific tools that you can benefit from, so make sure to ask your favorite AI coding tool about those.
That’s all I have for you today. Keep hacking!
I asked Claude about this as well and it told me that it prefers
sccbecause it’s written in Go (as opposed to Perl) and therefore it’s much faster thancloc. ↩Of course, I didn’t really have it installed - I only thought I did, otherwise Claude wouldn’t have suggested it. (I switch between computers and my setup on all of them is not exactly the same) ↩