Claude Hook Advisor is a Rust CLI tool that integrates with Claude Code to provide intelligent command suggestions, semantic directory aliasing, command history tracking, and security pattern detection. It helps operations teams automate and optimize command execution, reducing errors and improving efficiency. The tool connects to Claude Code and enhances workflows by suggesting alternatives based on keyword matching.
git clone https://github.com/sirmews/claude-hook-advisor.gitClaude Hook Advisor is a Rust-based CLI tool designed for operations teams using Claude Code. It operates through three integrated hooks that intelligently map commands to preferred alternatives (npm to bun, curl to wget), enable natural language directory references instead of full paths, automatically track all executed commands in a SQLite database with session linking, and detect 27 built-in security patterns across multiple programming languages to warn against dangerous code patterns like eval injection and unsafe blocks. The tool runs with minimal overhead (~1-5ms per hook execution) and requires only a TOML configuration file to map commands and directories, making it ideal for teams seeking to reduce command execution errors, improve workflow efficiency, and enforce security best practices.
[{"step":"Install claude-hook-advisor in your Rust environment using `cargo install --git https://github.com/your-org/claude-hook-advisor.git`. Ensure it's added to your PATH.","tip":"Run `claude-hook-advisor --version` to verify installation. If using Claude Code, add the tool to your `CLAUDE_TOOLS` environment variable."},{"step":"Navigate to your project directory or specify the path using `[PROJECT_PATH]` in the prompt. The tool analyzes the directory structure for semantic aliases and historical patterns.","tip":"Use `claude-hook-advisor --init` to set up a project-specific configuration file if your team uses custom aliases or security policies."},{"step":"Run the advisor with your target command, e.g., `claude-hook-advisor suggest --command \"cargo test\"`. Include additional flags like `--security-check` or `--historical` to refine suggestions.","tip":"For complex commands, break them into parts (e.g., `cargo test --lib` vs. `cargo test --bin`) to get targeted optimizations."},{"step":"Review the advisor's output, which includes optimized command alternatives, security flags, and historical context. Select the suggestion that best fits your workflow.","tip":"Use the `--dry-run` flag to preview changes without executing them. This is useful for testing security policy compliance."},{"step":"Integrate the optimized command into your workflow or CI/CD pipeline. The tool can also generate a report for your team's documentation.","tip":"Enable `claude-hook-advisor --watch` to monitor command usage in real-time and suggest improvements dynamically."}]
Map npm/yarn commands to bun automatically for faster package installation
Track all Claude-executed commands with success/failure status for audit trails
Detect security risks like eval injection and unsafe code before execution
Create semantic directory aliases so Claude understands 'docs' as full paths
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/sirmews/claude-hook-advisorCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use the claude-hook-advisor tool to analyze the current project directory [PROJECT_PATH] and suggest optimized command alternatives for [COMMAND_TO_RUN]. Include semantic directory aliases, historical command patterns, and security checks for [SPECIFIC_CONCERN]. Prioritize suggestions that reduce execution time by at least 20% and flag any commands that may violate security policies.
After analyzing the project directory `/opt/finance-app` and the command `cargo build --release`, the claude-hook-advisor provided the following optimized suggestions: 1. **Semantic Alias Replacement**: - Original: `cargo build --release` - Optimized: `cargo b -r` (using the `b` alias for `build` and `-r` for `--release`) - Savings: 45% reduction in keystrokes (18 → 10 characters) 2. **Historical Optimization**: - Detected previous runs of `cargo build --release` with `clippy` checks enabled. - Suggested: `cargo b -r && cargo clippy` (combined into a single workflow) - Savings: 30% reduction in context switching 3. **Security Check**: - Flagged the `--release` flag as potentially bypassing debug assertions in production builds. - Recommended: Add `RUSTFLAGS="-D warnings" cargo b -r` to enforce strict warnings. 4. **Directory-Specific Optimization**: - Detected the project uses a monorepo structure with a `services/` subdirectory. - Suggested: `cd services/finance-core && cargo b -r` to scope the build to the relevant module. The advisor also logged this command in the historical database with the tag `production-build` for future reference. The optimized workflow reduces execution time by 35% and ensures compliance with the team's security policies.
Agents that listen, think and act for you.
AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan