Help us improve
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
By TonyWu20
Blocks shell commands that read or edit files (sed, cat, xxd, od, sd, python -c). Hints agents to re-read files when Edit fails with stale strings.
npx claudepluginhub tonywu20/my-claude-marketplace --plugin no-shell-file-opsA Claude Code plugin that blocks shell commands that read or edit files — enforcing the built-in Read and Edit tools. Also hints agents to re-read files when the Edit tool fails with stale strings.
Find/grep enforcement lives in the sibling plugin: no-find-grep — blocks bare
find/grepand detects commonrgflag misuse.
Registers a PreToolUse hook that intercepts every Bash command before execution. It detects and blocks:
| Pattern | Why | Example |
|---|---|---|
sed -n | Use Read tool to view file content instead of parsing with sed | sed -n '100,200p' file |
cat -A/-v/-vet | Use Read tool to inspect file content instead of shell tricks | cat -A file |
xxd / od | Use Read tool to inspect file content instead of hex/octal dumps | xxd file |
sed -i | Use Edit tool for file editing instead of sed in-place | sed -i 's/old/new/' file |
sd | Use Edit tool for find-and-replace. sd always returns exit 0 even on no-op. | sd 'old' 'new' file |
python -c with open() | Use Read/Edit tools for file operations instead of ad-hoc scripts | python3 -c "open('f').read()" |
When a match is found, the hook prints a diagnostic message to stderr and exits with code 2, preventing the command from running.
Also registers a PostToolUseFailure hook on Edit: when the Edit tool fails with "String to replace not found," it provides additionalContext hinting the agent to re-read the file with the Read tool before retrying.
At session end (or /clear), the plugin reports how many commands were blocked.
My global CLAUDE.md already says:
For file editing, use the built-in
Edittool instead ofsed -i,sd, orpython -c.
But Claude Code doesn't always follow instructions consistently. A hook enforces the rule at the tool level, every time, with no exceptions.
Install via the marketplace:
TonyWu20/my-claude-marketplace
Or manually, register the plugin in your Claude Code settings:
{
"plugins": {
"no-shell-file-ops": {
"path": "/path/to/no-shell-file-ops"
}
}
}
| File | Purpose |
|---|---|
hooks/hooks.json | Hook registration — intercepts Bash tool calls and Edit failures |
hooks/block-file-ops.sh | Shell script that blocks shell file-read and file-edit commands (enforcing Read/Edit tools) |
hooks/hint-edit-reread.sh | Shell script that catches Edit tool failures and hints the agent to re-read the file via additionalContext |
hooks/session-end.sh | Shell script that reports blocked-command count on session exit and /clear |
Compatible with Linux and macOS. Locking uses mkdir-based mutex (no flock dependency).
Executes bash commands
Hook triggers when Bash tool is used
Modifies files
Hook triggers on file write and edit operations
Share bugs, ideas, or general feedback.
Based on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Memory compression system for Claude Code - persist context across sessions
Multi-model consensus engine integrating OpenAI Codex CLI, Gemini CLI, and Claude CLI for collaborative code review and problem-solving.
Curate auto-memory, promote learnings to CLAUDE.md and rules, extract proven patterns into reusable skills.
A comprehensive Fortran development pipeline for Claude Code — orchestrates planning, code review, fix execution, and implementation through specialized agents and skills
Routes Claude Code hook events to a Discord channel — approval requests, notifications, and session stop signals — with interactive Approve/Deny buttons. Also provides slash commands to inspect active sessions and conversation history.
LSP proxy that filters stale diagnostics for Rust, Python, and Fortran
A comprehensive Rust development pipeline for Claude Code — orchestrates planning, code review, fix execution, and implementation through specialized agents and skills
Blocks bare find/grep in Bash calls and detects common rg flag misuse. Enforces fd/rg per CLAUDE.md. Shell file-read and file-edit blocking has moved to the no-shell-file-ops plugin.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claim