<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: elad</title>
    <description>The latest articles on DEV Community by elad (@kaplanelad).</description>
    <link>https://dev.to/kaplanelad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F790405%2F4b72b346-ecfa-4509-abe1-617820ec5b15.jpeg</url>
      <title>DEV Community: elad</title>
      <link>https://dev.to/kaplanelad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kaplanelad"/>
    <language>en</language>
    <item>
      <title>Your AI Agent Just Ran rm -rf / — How to Stop It Before It Happens</title>
      <dc:creator>elad</dc:creator>
      <pubDate>Fri, 13 Mar 2026 07:52:10 +0000</pubDate>
      <link>https://dev.to/kaplanelad/your-ai-agent-just-ran-rm-rf-how-to-stop-it-before-it-happens-1eal</link>
      <guid>https://dev.to/kaplanelad/your-ai-agent-just-ran-rm-rf-how-to-stop-it-before-it-happens-1eal</guid>
      <description>&lt;p&gt;We gave AI agents the keys to our terminal. It was only a matter of time before one tried to burn the house down.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem Nobody Talks About
&lt;/h2&gt;

&lt;p&gt;Claude Code is incredible. You describe what you want, and it writes code, runs tests, manages git — all autonomously. But here's the thing: &lt;strong&gt;every Bash command it runs has the same permissions as you.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That means when Claude Code decides to "clean up" your project, it can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it tries to fix a git issue, it might run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;--force&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it's debugging a database migration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;DROP DATABASE production&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These aren't hypothetical. AI agents make mistakes. They hallucinate commands. They misinterpret context. And unlike a human who pauses before hitting Enter on something dangerous, &lt;strong&gt;an AI agent just executes.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Hooks: The Interception Point
&lt;/h2&gt;

&lt;p&gt;Claude Code introduced &lt;a href="https://docs.anthropic.com/en/docs/claude-code/hooks" rel="noopener noreferrer"&gt;hooks&lt;/a&gt; — a mechanism that lets you run custom commands before a tool executes. The &lt;code&gt;PreToolUse&lt;/code&gt; hook fires before every Bash command, giving you a chance to inspect and block it.&lt;/p&gt;

&lt;p&gt;The hook protocol is simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Claude Code is about to run a Bash command&lt;/li&gt;
&lt;li&gt;It sends the command as JSON to your hook via stdin&lt;/li&gt;
&lt;li&gt;Your hook returns a JSON response with &lt;code&gt;"permissionDecision": "allow"&lt;/code&gt; or &lt;code&gt;"deny"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Claude Code respects the decision&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is powerful, but building your own safety rules from scratch means maintaining regex patterns, tracking edge cases, and covering dozens of dangerous command families. That's a full-time job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter shellfirm: 100+ Safety Rules, One Command to Install
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/kaplanelad/shellfirm" rel="noopener noreferrer"&gt;shellfirm&lt;/a&gt; is an open-source tool that intercepts dangerous shell commands before they execute. It ships with &lt;strong&gt;100+ built-in patterns&lt;/strong&gt; covering 9 ecosystems — filesystem, git, Kubernetes, Terraform, AWS, databases, Docker, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup takes 30 seconds:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install shellfirm&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @shellfirm/cli

&lt;span class="c"&gt;# Connect to Claude Code (installs hooks + MCP server automatically)&lt;/span&gt;
shellfirm connect claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. shellfirm is now watching every command Claude Code runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens under the hood
&lt;/h3&gt;

&lt;p&gt;When Claude Code tries to run &lt;code&gt;git push --force origin main&lt;/code&gt;, here's the flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude Code: "I'll fix this by force pushing"
     |
     v
PreToolUse Hook fires
     |
     v
shellfirm check --stdin --format json --exit-code
     |
     v
+-------------------------------------+
| Pattern matched: git:force_push     |
| Severity: HIGH                      |
| Blast radius: RESOURCE              |
| Decision: DENY                      |
|                                     |
| Alternative: git push               |
|   --force-with-lease                |
|   (checks remote is up-to-date)     |
+-------------------------------------+
     |
     v
Claude Code: blocked. Uses safer alternative instead.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command never executes. Claude Code receives the denial with a suggested alternative, and adapts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Patterns shellfirm Catches
&lt;/h2&gt;

&lt;p&gt;Here's a sample of what shellfirm blocks out of the box:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Dangerous Command&lt;/th&gt;
&lt;th&gt;What shellfirm Suggests&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Filesystem&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rm -rf /&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Scoped deletion with explicit path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Git&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git push --force&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git push --force-with-lease&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Git&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reset --hard&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git stash&lt;/code&gt; before reset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kubernetes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl delete namespace&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add &lt;code&gt;--dry-run&lt;/code&gt; first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Terraform&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;terraform destroy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;terraform plan -destroy&lt;/code&gt; to review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DROP DATABASE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Backup first, use &lt;code&gt;IF EXISTS&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Docker&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker system prune -af&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove &lt;code&gt;--all&lt;/code&gt; flag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AWS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aws ec2 terminate-instances&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verify instance ID carefully&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each pattern includes severity levels (Low, Medium, High, Critical) and blast radius detection (Project, Resource, or Machine-wide).&lt;/p&gt;

&lt;h2&gt;
  
  
  The MCP Server: Teaching Claude to Ask Before Acting
&lt;/h2&gt;

&lt;p&gt;shellfirm doesn't just block commands — it also installs an &lt;strong&gt;MCP (Model Context Protocol) server&lt;/strong&gt; that gives Claude Code on-demand safety tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;check_command&lt;/code&gt;&lt;/strong&gt; — "Is this command safe to run?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;explain_risk&lt;/code&gt;&lt;/strong&gt; — "What could go wrong with this command?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;suggest_alternative&lt;/code&gt;&lt;/strong&gt; — "What's a safer way to do this?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;get_policy&lt;/code&gt;&lt;/strong&gt; — "What are the current safety rules?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means Claude Code can proactively check commands before attempting them, rather than getting blocked and retrying. It learns to work &lt;em&gt;with&lt;/em&gt; the safety rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure It Your Way
&lt;/h2&gt;

&lt;p&gt;shellfirm is fully customizable. Want to be strict about git but relaxed about filesystem operations? Easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ~/.shellfirm/settings.yaml&lt;/span&gt;
&lt;span class="na"&gt;enabled_groups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git-strict&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;kubernetes&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;terraform&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;database&lt;/span&gt;

&lt;span class="na"&gt;agent&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;auto_deny_severity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;High&lt;/span&gt;  &lt;span class="c1"&gt;# Block High and Critical severity&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Need project-specific rules? Drop a &lt;code&gt;.shellfirm.yaml&lt;/code&gt; in your repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .shellfirm.yaml&lt;/span&gt;
&lt;span class="na"&gt;policies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;check_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git:force_push&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Critical&lt;/span&gt;  &lt;span class="c1"&gt;# Escalate for this project&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  It Works For Humans Too
&lt;/h2&gt;

&lt;p&gt;shellfirm isn't just for AI agents. Install it in your shell and it protects you the same way — with interactive challenges (solve a math problem to confirm you really meant to &lt;code&gt;rm -rf&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add to your shell&lt;/span&gt;
shellfirm init bash &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc  &lt;span class="c"&gt;# or zsh, fish, etc.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One tool protects both you and your AI agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters Now
&lt;/h2&gt;

&lt;p&gt;AI coding agents are becoming the default way we write software. Claude Code, Cursor, Windsurf — they all execute shell commands autonomously. The productivity gains are massive, but so is the blast radius when something goes wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A single bad command can:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete your uncommitted work&lt;/li&gt;
&lt;li&gt;Force push over your team's changes&lt;/li&gt;
&lt;li&gt;Drop a production database&lt;/li&gt;
&lt;li&gt;Terminate cloud infrastructure&lt;/li&gt;
&lt;li&gt;Corrupt your git history&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;shellfirm is the seatbelt for this new world. You don't think about it until you need it — and when you need it, you're very glad it's there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @shellfirm/cli
shellfirm connect claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two commands. Zero configuration required. 100+ dangerous patterns blocked.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/kaplanelad/shellfirm" rel="noopener noreferrer"&gt;github.com/kaplanelad/shellfirm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Star the repo&lt;/strong&gt; if this saved you from a future disaster&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;shellfirm is open source and free. Contributions welcome — especially new check patterns for tools your team uses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>security</category>
      <category>terminal</category>
    </item>
    <item>
      <title>loco-rs: releasing a framework inspired by Rails on Rust</title>
      <dc:creator>elad</dc:creator>
      <pubDate>Sun, 17 Dec 2023 09:34:19 +0000</pubDate>
      <link>https://dev.to/kaplanelad/loco-rs-releasing-a-framework-inspired-by-rails-on-rust-4hac</link>
      <guid>https://dev.to/kaplanelad/loco-rs-releasing-a-framework-inspired-by-rails-on-rust-4hac</guid>
      <description>&lt;p&gt;We've just released an initial version of &lt;a href="https://loco.rs/"&gt;Loco&lt;/a&gt;, a Rails inspired framework for Rust. Looking to get feedback, ideas, and contributions! (also, feel free to AMA here)&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://loco.rs/"&gt;https://loco.rs/&lt;/a&gt;&lt;br&gt;
Github: &lt;a href="https://github.com/loco-rs/loco"&gt;https://github.com/loco-rs/loco&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>webserver</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Secure you shell commands history</title>
      <dc:creator>elad</dc:creator>
      <pubDate>Sun, 17 Jul 2022 12:28:57 +0000</pubDate>
      <link>https://dev.to/kaplanelad/secure-you-shell-commands-history-21dm</link>
      <guid>https://dev.to/kaplanelad/secure-you-shell-commands-history-21dm</guid>
      <description>&lt;p&gt;Secrets can be everywhere, even in your shell history commands. &lt;br&gt;
I created a small tool that detects and clean those commands from your history. You can even stash your history commands before you share your screen and pop the history when you finish.&lt;/p&gt;

&lt;p&gt;Appreciate your feedback &lt;br&gt;
&lt;a href="https://github.com/rusty-ferris-club/shellclear"&gt;https://github.com/rusty-ferris-club/shellclear&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>rust</category>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>Opppsss you did it again?</title>
      <dc:creator>elad</dc:creator>
      <pubDate>Wed, 12 Jan 2022 14:46:13 +0000</pubDate>
      <link>https://dev.to/kaplanelad/opppsss-you-did-it-again-3p10</link>
      <guid>https://dev.to/kaplanelad/opppsss-you-did-it-again-3p10</guid>
      <description>&lt;p&gt;Hey all,&lt;/p&gt;

&lt;p&gt;Did you ever run a command by mistake? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;delete a folder recursively? &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git reset --hard&lt;/code&gt; and remove all your work?&lt;/li&gt;
&lt;li&gt;Or any command that you can think of as risky.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Shellfirm&lt;/code&gt; is a handy utility to help avoid running dangerous commands with an extra approval step.&lt;/p&gt;

&lt;p&gt;See more on GitHub page:&lt;br&gt;
&lt;a href="https://github.com/kaplanelad/shellfirm"&gt;https://github.com/kaplanelad/shellfirm&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>bash</category>
      <category>linux</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
