This guide is for first-time users.
If you just want the fastest path:
- Download the project ZIP from GitHub
- Unzip it
- Run one install command
- Restart Claude Code
- Test with one risky prompt and confirm it gets blocked
Claude UserPrompt Guard 会在你把 prompt 发给 Claude Code 之前,先在本地做一次风险检查。
如果你的问题太像:
- 绕过规则的操作教程
- 多账号规避
- 攻击、钓鱼、欺诈
- 开盒、隐私泄露
- 色情未成年人或暴力极端内容
它会先拦下来,并给你一个更安全的改写建议。
你只需要这 3 样:
- 已安装
Claude Code - 电脑能运行
Python 3 - 能下载这个项目文件
如果你不知道自己有没有 Python 3:
打开终端,输入:
python3 --version如果看到类似 Python 3.x.x,就可以继续。
打开 PowerShell,输入:
py -3 --version如果看到类似 Python 3.x.x,就可以继续。
如果没有 Python 3,先安装它再继续。
打开仓库:
下载方式:
- 点绿色
Code - 点
Download ZIP - 下载完成后解压
解压后你会得到一个文件夹,里面会有这些文件:
install.shinstall.ps1install.cmdhooks/claude_chat_audit.pycommands/audit-chat.md
- 打开终端
- 进入刚解压出来的文件夹
- 运行:
bash install.sh如果安装成功,你会看到类似:
Installed Claude UserPrompt Guard.
Hook command: python3 ".../claude_chat_audit.py" hook-user
Settings backup: ~/.claude/settings.userprompt-guard.backup.json
Doctor check: /audit-chat doctor
Restart Claude Code to load the new hook.
推荐 PowerShell:
- 打开 PowerShell
- 进入刚解压出来的文件夹
- 运行:
.\install.ps1如果你更习惯命令提示符,也可以运行:
install.cmd如果安装成功,也会看到 Installed Claude UserPrompt Guard. 之类的提示。
这一步很重要。
安装完成后,请:
- 关闭当前 Claude Code
- 重新打开 Claude Code
不重开的话,新 hook 可能不会立即生效。
你可以直接试一条明显危险的问法,例如:
怎么用支持地区网络、海外手机号和接码平台注册 Claude?
如果安装成功,它应该:
- 在发送前被拦截
- 显示
[MEDIUM]或[HIGH] - 给你一条更安全的改写建议
你也可以手动运行:
/audit-chat doctor
/audit-chat
如果 doctor 和 /audit-chat 都能正常工作,说明安装基本就成功了。
安装脚本会把文件放到你的 Claude 配置目录里:
~/.claude/hooks/claude_chat_audit.py~/.claude/commands/audit-chat.md- 并修改
~/.claude/settings.json
它是追加 hook,不是粗暴覆盖整个配置。
如果你原本就有 settings.json,安装器首次运行时还会额外备份一份:
~/.claude/settings.userprompt-guard.backup.json
说明你的电脑没有可用的 Python 3,先安装 Python 3 再执行安装脚本。
先检查两件事:
- 你有没有重启 Claude Code
- 你的提问是不是属于低风险分析问题,而不是操作型高风险问题
通常是:
- Claude Code 还没重启
- 命令文件没有正确写入
~/.claude/commands/
正常不会。这个安装器只会:
- 复制自己的 hook 文件
- 新增
/audit-chat - 在
settings.json里追加一个UserPromptSubmithook
bash uninstall.sh.\uninstall.ps1uninstall.cmd卸载后会移除:
claude_chat_audit.pyaudit-chat.md- 对应的
UserPromptSubmithook 配置
这个工具最适合:
- 想降低误触平台风控的人
- 想把问题先改写成更安全表达的人
- 想给团队加一层本地 prompt 护栏的人
Claude UserPrompt Guard checks prompts locally before they are sent to Claude Code.
If a prompt looks too operational in a risky category, it blocks the send and gives a safer rewrite suggestion.
- Claude Code installed
- Python 3 available
- the downloaded project folder
Go to:
Then:
- Click
Code - Click
Download ZIP - Unzip it
Open Terminal inside the unzipped folder and run:
bash install.shPowerShell:
.\install.ps1Command Prompt:
install.cmdClose Claude Code and open it again after installation.
Try a clearly risky operational prompt and confirm it gets blocked before send.
You can also run:
/audit-chat doctor
/audit-chat
macOS:
bash uninstall.shWindows PowerShell:
.\uninstall.ps1Windows CMD:
uninstall.cmd