mk:careful
Warns before destructive Bash commands such as rm -rf, DROP TABLE and force-push, and blocks the critical ones in production.
| Source | .claude/skills/careful/SKILL.md |
| Owner | research |
| Runtime | claude-code |
| Risk | medium |
mk:careful adds a PreToolUse hook on every Bash call (bin/check-careful.cjs) that checks the command against a catalogue of destructive patterns and asks before it runs. Use it when touching production, debugging a live system or working in a shared environment, or when you say "careful mode" or "prod mode". The hook lasts for the session and ends with the conversation.
When not to use it
To limit file edits to one directory, use mk:freeze.
Usage
/mk:carefulWhat it does
For each Bash command the hook returns allow (no match or a safe exception), ask (a match, which you can override) or block (a CRITICAL match in a production context). Matching looks at the command string only, so source code that mentions rm -rf in a comment does not trigger it.
| Severity | Meaning | Behaviour |
|---|---|---|
| CRITICAL | Irreversible, possible data loss or production impact | Ask in development. Blocked with no override in production |
| HIGH | Reversible but costly to recover | Ask everywhere |
| MEDIUM | Dangerous in some contexts | Ask everywhere |
A context counts as production when NODE_ENV, APP_ENV or ENVIRONMENT contains production, prod or staging. The block message says an override needs a human to unset those variables.
Each override is logged with the command in .meowkit/telemetry/security-log.md.
Pattern categories
| Category | Examples |
|---|---|
| File system | rm -rf, find -delete, shred, dd, chmod -R |
| SQL | DROP TABLE, DROP DATABASE, TRUNCATE, prisma migrate reset, rails db:drop |
| NoSQL and cache | redis-cli FLUSHALL, db.dropDatabase() |
| Git | push --force, reset --hard, checkout ., clean -fd, filter-branch, rebase -i |
| Containers | kubectl delete, docker rm -f, helm uninstall |
| Cloud | terraform destroy, aws s3 rm --recursive, gcloud ... delete |
The full list is references/destructive-patterns.md, kept in step with the hook.
Never warned: deleting build and dependency caches (node_modules, .next, dist, build, .turbo, coverage, __pycache__, .cache, .gradle, target, vendor, Pods, .venv, venv), removing stopped containers, and removing dangling images.
Gotchas
- During
mk:investigate, destructive-command warnings still fire. Each debugging command that touches state needs your confirmation. - A shell alias such as
alias del='rm -rf'can slip past the match. - A multi-line command with backslash continuations may not match a single-line pattern.
- Run
git stashbeforegit reset --hardto keep uncommitted work.