Major changes: - Add package.json with NPM packaging configuration - Create Node.js CLI interface (bin/claude-hooks.js) with full command set - Convert bash scripts to Python for better npm integration - Add npm postinstall/preuninstall hooks for automatic setup - Update bootstrap prompt to recommend NPM method with git fallback - Enhance README with NPM-first documentation - Maintain backward compatibility with existing git installation Features: - npm install -g claude-hooks for easy distribution - claude-hooks init/status/test/backup/uninstall commands - Automatic Python dependency installation - Conflict detection and prevention - Hybrid approach supporting both npm and git workflows This resolves installation complexity while maintaining developer flexibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.3 KiB
Claude Hooks Bootstrap Prompt
Copy this prompt and paste it into a fresh Claude Code session to install Claude Hooks
I want to install Claude Hooks - an intelligent system that will make you smarter and safer by learning from my environment and preventing common mistakes.
⚠️ IMPORTANT: Claude Hooks installs user-wide and affects ALL Claude Code instances. If you have other Claude sessions with hooks already installed, this will create conflicts. Check first!
What it does:
- Learns which commands fail in my environment and suggests working alternatives
- Automatically backs up my work before context limits
- Blocks dangerous commands before they execute
- Maintains session history across Claude restarts
Pre-installation check: First, verify no hooks are already installed:
- Check:
claude-hooks status 2>/dev/null || echo "No claude-hooks found - safe to proceed"
- Check:
ls ~/.config/claude/hooks.json 2>/dev/null || echo "No hooks config found - safe to proceed"
If either check shows existing hooks, STOP and run the uninstall process first:
claude-hooks uninstall
(if available)- Or manually remove:
rm -rf ~/.config/claude/hooks.json
Installation (choose one method):
Method 1 - NPM (Recommended):
npm install -g claude-hooks
claude-hooks init
claude-hooks test
Method 2 - Git (For developers):
git clone https://git.supported.systems/rsp2k/claude-hooks.git
cd claude-hooks && ./scripts/install.sh
./scripts/test.sh
After installation:
- Restart Claude Code to activate the hooks
- Try
claude-hooks status
to verify it's working - Try
pip install requests
to see intelligent command suggestions
To uninstall later: claude-hooks uninstall
or npm uninstall -g claude-hooks
Please guide me through this installation step-by-step, including the pre-installation checks. Use the NPM method unless I specifically request git installation. Handle any errors that come up and make sure everything works. After installation, help me test it by trying some commands that commonly fail on different systems (like pip
vs pip3
, python
vs python3
) so I can see the intelligence in action.
The goal is to have a working Claude Hooks system that starts learning from my environment immediately.