cfn-careful
PreToolUse hook that warns before destructive bash commands (rm -rf, DROP TABLE, git push --force, etc.). Activates via /careful command. Whitelists safe deletions (node_modules, .next, dist).
Best use case
cfn-careful is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
PreToolUse hook that warns before destructive bash commands (rm -rf, DROP TABLE, git push --force, etc.). Activates via /careful command. Whitelists safe deletions (node_modules, .next, dist).
Teams using cfn-careful should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cfn-careful/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cfn-careful Compares
| Feature / Agent | cfn-careful | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
PreToolUse hook that warns before destructive bash commands (rm -rf, DROP TABLE, git push --force, etc.). Activates via /careful command. Whitelists safe deletions (node_modules, .next, dist).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# CFN Careful **Purpose:** Prevent accidental destructive operations by intercepting dangerous bash commands before execution. ## Dangerous Patterns Detected ### File Operations - `rm -rf` / `rm -r` (except whitelisted dirs) - `dd if=/dev/zero` ### Database - `DROP TABLE` - `DROP DATABASE` - `TRUNCATE` ### Git - `git push --force` / `git push -f` - `git reset --hard` - `git checkout -- .` / `git checkout .` - `git clean -f` ### Container/Orchestration - `kubectl delete` - `docker system prune` - `docker rm -f` ## Whitelisted Safe Deletions These directories are safely regenerated and do not contain user data: - node_modules, .next, dist, __pycache__, .cache, .turbo - *.pyc, *.o, .DS_Store - Build artifacts in /tmp/ ## How It Works PreToolUse hook on Bash tool. Parses command from stdin JSON, checks against dangerous patterns. Returns exit 2 (block) with warning message if matched, exit 0 (allow) otherwise. ## Activation The hook is registered in settings.json and always active. No /careful command needed to activate.