Pre exec check
Security skills that make AI coding agents safe to run. 5 drop-in skills: skill verification, cost tracking, tool authorization, behavioral anomaly detection, and pre-execution safety.
npx -y skills add ArielSmoliar/safe-agent --skill pre-exec-checkAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Safety check before executing destructive or irreversible commands. Catches dangerous shell commands, risky git operations, secret exposure, and high-blast-radius actions before they run. Activates automatically when Claude is about to execute shell commands that match known risk patterns. Trigger phrases: "check before running", "is this command safe", "safety check", "pre-execution review".
SKILL.md
4.3 KB, as published. Nobody here has run it
Pre-Execution Safety Check
Before executing any shell command, evaluate it against the risk categories below. This check runs silently — only surface it to the user when a risk is detected.
Risk Categories
CRITICAL — Block and warn. Never proceed without explicit user confirmation.
Destructive file operations:
rm -rfon any path outside a known temp/build directoryrm -rf /,rm -rf ~,rm -rf .(catastrophic)- Recursive delete on paths containing
.. > filename(truncating files) on non-build artifacts
Irreversible git operations:
git push --forceorgit push -ftomain,master, orproductiongit reset --hardwhen there are uncommitted changesgit clean -fdorgit clean -fdx(deletes untracked files)git branch -Don branches with unmerged commitsgit rebaseon already-pushed commits
Database destruction:
DROP TABLE,DROP DATABASE,TRUNCATE TABLEwithout a WHERE or in productionDELETE FROMwithout a WHERE clause- Migration rollbacks in production
Process/system operations:
kill -9on PIDs that aren't child processes of the current sessionpkillorkillallon broad patternschmod -R 777orchmod -R 000chown -Ron system directories- Writing to
/etc/,/usr/, or other system paths
Secret exposure:
echo $API_KEY,cat .env,printenvpiped to files or network- Any command that would print secrets to stdout in a logged session
curlorwgetwith credentials in the URL
HIGH — Warn user, explain the risk, suggest safer alternative.
Risky git operations:
git push --forceto any branch (suggest--force-with-lease)git reset --hard(suggestgit stashfirst)git checkout -- .orgit restore .(discards all changes)- Amending commits that have been pushed
Package management:
npm publish(publicly publishing a package)pip installfrom URL or--extra-index-url(supply chain risk)- Removing lockfiles (
rm package-lock.json,rm poetry.lock)
Infrastructure:
kubectl deleteon production namespacesterraform destroydocker system prune -a(removes all images)
Network:
curl -X POSTto external URLs with body containing local datascporrsyncto unfamiliar hostssshto production servers
MEDIUM — Note the risk in passing. Proceed unless the context is unusual.
- Installing global packages (
npm install -g,pip install --user) - Running
sudocommands - Modifying dotfiles (
.bashrc,.zshrc,.gitconfig) - Creating world-readable files in shared directories
Behavior
When a command matches a risk pattern:
- CRITICAL: Stop. Tell the user: "This command [specific description] is destructive/irreversible. [Explain what could go wrong]. Do you want to proceed?"
- HIGH: Warn: "Heads up — [command] carries risk because [reason]. Safer alternative: [suggestion]. Proceeding unless you object."
- MEDIUM: Brief note only if the broader context makes it concerning.
When no risk is detected, proceed normally — do not mention this check.
Anti-Patterns to Avoid
- Do NOT warn about every
rmcommand.rm file.txton a known temp file is fine. - Do NOT block normal development workflows.
git pushto a feature branch is fine. - Do NOT add friction to routine operations. The goal is catching genuine mistakes, not slowing down the user.
- Do NOT be paranoid about
curlfor fetching docs or APIs. Only flag when local data is being sent.
Context Awareness
Use available context to reduce false positives:
- If in a git repo, check if the branch has been pushed before warning about force-push
- If a file was just created by the agent, deleting it is lower risk
- If running inside a Docker container or CI, destructive commands are lower risk
git statusoutput tells you if there are uncommitted changes worth protecting