SLOPSHOPPER

guardrails

Blocks shell commands you pick in /config: Cloudflare cf writes, attribution lines in commits and PRs, claude/ branch names. All rules start off

guard
★ 7v0.4.0MITupdated 2026-10-10arasovic/claude-code-mods/guardrails
A shopper browsing a rack in a slop shop
README

guardrails

Blocks shell commands you choose never to let Claude run. Claude gets the reason back and can retry the right way.

Every rule starts off. After you install, the plugin blocks nothing until you turn a rule on in /config.

Rules

/config optionBlocksClaude is told
cfWritescf deploy, cf migrate, cf initAsk the user to run them.
attributiongit commit, gh pr, gh issue with a Co-Authored-By or "Generated with Claude" lineRemove the line and retry.
claudeBranchesgit checkout -b, git switch -c, git branch, git push naming a claude/ branchUse a purpose prefix such as fix/ or chore/.

Turn a rule on in /config, or in ~/.claude/settings.json:

"pluginConfigs": {
  "guardrails@claude-code-mods": {
    "options": { "cfWrites": true, "attribution": true, "claudeBranches": true }
  }
}

The attribution rule is a backstop. To stop Claude Code from adding attribution in the first place, set Claude Code's own top-level "attribution": false in settings.json.

Reading credential files is secret-guard's job.

Your own rules

To block another command, use a permission deny rule in settings.json. It needs no plugin:

"permissions": { "deny": ["Bash(npm publish:*)"] }

Limits

  • It reads the command text only. git commit -F file, shell aliases and scripts get through. Use permission deny rules where you need a hard guarantee.

Install

claude plugin marketplace add arasovic/claude-code-mods
claude plugin install guardrails@claude-code-mods

Restart Claude Code, then turn on the rules you want in /config.

Develop

claude plugin validate .
claude plugin test .
../typecheck.sh guardrails
Source 1 files
hooks/register.ts 21 lines
1import type { PluginOptions, Register } from 'claude-code'
2
3// Commands refused on their text, each behind its userConfig toggle. Credential reads are secret-guard's.
4const RULES = [
5  { option: 'cfWrites', re: /\bcf\s+(deploy|migrate|init)\b/, why: 'cf deploy, migrate and init are blocked; ask the user to run them.' },
6  { option: 'attribution', re: /\b(git\s+commit|gh\s+(pr|issue))\b[\s\S]*(Co-Authored-By|Generated with \[?Claude)/i, why: 'Remove the Co-Authored-By / tool-attribution line and retry.' },
7  { option: 'claudeBranches', re: /\bgit\s+(checkout\s+-b|switch\s+-c|branch|push)\b[^|;&]*(?:[\s:+]|refs\/heads\/)claude\//, why: 'Branch names may not start with claude/; use a purpose prefix such as fix/ or chore/.' },
8]
9// ponytail: matches command text only; `git commit -F file`, aliases and scripts slip through. Permission deny rules for hard guarantees.
10
11export const forbiddenReason = (command: string, options: PluginOptions) =>
12  RULES.find(r => options[r.option] === true && r.re.test(command))?.why
13
14export const register: Register = (on, options) => {
15  if (!RULES.some(r => options[r.option] === true)) return
16  on('tool.call', { tool: 'Bash' }, ($, e, next) => {
17    const reason = forbiddenReason(e.command, options)
18    return reason ? { deny: `${$.plugin.name}: ${reason}` } : next(e)
19  })
20}
21