safety-essentials

A set of five safety checks for Claude Code, the coding assistant, that can stop especially risky commands before they run.

In plain words
What is it for?
Use it when an AI assistant can run shell commands or change a project, and you want safeguards around rm -rf, force-push, hard reset, .env overwrites, and package publishing.
Why use it?
It helps prevent accidental deletion, irreversible Git changes, overwriting environment files, and publishing a package by mistake.

Plugin for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Claude Code
/plugin marketplace add yurukusa/cc-safe-setup
agentmods
npx agentmods add plugins/yurukusa/cc-safe-setup/safety-essentials
Clone the repo
git clone --depth 1 https://github.com/yurukusa/cc-safe-setup

Made for: Claude Code.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan C 1 finding. Scan, not verified.
Origin 88% copy Near-identical to another mod in the catalogue.
Security

Grade C, and why

safety-essentials scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

"description": "5 essential safety hooks for Claude Code. Blocks rm -rf, force-push, hard-reset, .env overwrites, and package publish. The minimum viable safety net from 800+ hours of autonomous operation.",
Origin

This is a copy

88% identical to git-protection — 16 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/safety-essentials/.claude-plugin/plugin.json · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "name": "safety-essentials",
  "description": "5 essential safety hooks for Claude Code. Blocks rm -rf, force-push, hard-reset, .env overwrites, and package publish. The minimum viable safety net from 800+ hours of autonomous operation.",
  "version": "1.2.0",
  "author": {
    "name": "yurukusa"
  },
  "homepage": "https://yurukusa.github.io/cc-safe-setup/",
  "repository": "https://github.com/yurukusa/cc-safe-setup",
  "license": "MIT",
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "INPUT=$(cat); CMD=$(printf %s \"$INPUT\" | { if command -v jq >/dev/null 2>&1; then jq -r '.tool_input.command // empty' 2>/dev/null; elif command -v python3 >/dev/null 2>&1; then python3 -c 'import sys,json;d=json.load(sys.stdin);print((d.get(\"tool_input\") or {}).get(\"command\") or \"\")' 2>/dev/null; elif command -v node >/dev/null 2>&1; then node -e 'let s=\"\";process.stdin.on(\"data\",d=>s+=d).on(\"end\",()=>{try{process.stdout.write(String((JSON.parse(s).tool_input||{}).command||\"\"))}catch(e){}})' 2>/dev/null; else echo __CCHOOK_NO_PARSER__; fi; }); if [ \"$CMD\" = \"__CCHOOK_NO_PARSER__\" ]; then W=/tmp/cc-noparser-warned-safety-essentials-$PPID; [ -f \"$W\" ] || { echo \"WARNING [safety-essentials]: cannot inspect tool calls - jq, python3 and node are all unavailable, so this plugin is NOT protecting you. Install any one of them.\" >&2; : > \"$W\"; }; exit 0; fi; [ -z \"$CMD\" ] && exit 0; if echo \"$CMD\" | grep -qE 'rm\\s([^;&|]*\\s)?-[a-zA-Z]*r[a-zA-Z]*\\s[^;&|]*-[a-zA-Z]*f|rm\\s([^;&|]*\\s)?-[a-zA-Z]*f[a-zA-Z]*\\s[^;&|]*-[a-zA-Z]*r|rm\\s([^;&|]*\\s)?-[a-zA-Z]*(rf|fr)[a-zA-Z]*(\\s|$)|rm\\s[^;&|]*--recursive[^;&|]*--force|rm\\s[^;&|]*--force[^;&|]*--recursive'; then echo 'BLOCKED [safety-essentials]: rm -rf detected. Use git clean or manual deletion instead.' >&2; exit 2; fi"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
  

Read the full file on GitHub · 61 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 61 lines scan C f85181b0cda6

Subscribe to this mod's changes

safety-essentials is a plugin published in the GitHub repository yurukusa/cc-safe-setup (5 stars, last pushed 2d ago), licensed MIT. Its token cost is not measured: this kind of file is read by the harness, not the model. A static security scan graded it C with 1 finding (recursive force delete). It is 88% identical to git-protection, differing in 16 lines, and is treated as a copy.