<?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: Brie Lab</title>
    <description>The latest articles on DEV Community by Brie Lab (@yeogreenji).</description>
    <link>https://dev.to/yeogreenji</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4277697%2Faff29270-56be-40d9-912b-280b5a8ed335.png</url>
      <title>DEV Community: Brie Lab</title>
      <link>https://dev.to/yeogreenji</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yeogreenji"/>
    <language>en</language>
    <item>
      <title>7 mistakes that make Claude Code hooks fail silently</title>
      <dc:creator>Brie Lab</dc:creator>
      <pubDate>Wed, 02 Dec 2026 07:29:58 +0000</pubDate>
      <link>https://dev.to/yeogreenji/7-mistakes-that-make-claude-code-hooks-fail-silently-9kn</link>
      <guid>https://dev.to/yeogreenji/7-mistakes-that-make-claude-code-hooks-fail-silently-9kn</guid>
      <description>&lt;p&gt;Claude Code hooks are the only rules an agent can't forget in a long session. But a hook that never fires fails silently: no error, no warning, just an agent doing the thing you thought you'd blocked. Here are seven mistakes I see most in &lt;code&gt;.claude/settings.json&lt;/code&gt;, and one in &lt;code&gt;.mcp.json&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A lower-case matcher
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tool names are case-sensitive. &lt;code&gt;bash&lt;/code&gt; matches nothing; it has to be &lt;code&gt;Bash&lt;/code&gt;. Same for &lt;code&gt;Edit&lt;/code&gt;, &lt;code&gt;Write&lt;/code&gt;, &lt;code&gt;Read&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The hook object without its wrapper
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"PostToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx prettier --write"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each event takes an array of &lt;em&gt;groups&lt;/em&gt;, and each group has its own &lt;code&gt;hooks&lt;/code&gt; array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"PostToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Edit|Write|MultiEdit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx prettier --write"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Matching Edit but not Write
&lt;/h2&gt;

&lt;p&gt;A guard on &lt;code&gt;"matcher": "Edit"&lt;/code&gt; protects existing files, but the agent can still create a brand-new file with &lt;code&gt;Write&lt;/code&gt; or change several at once with &lt;code&gt;MultiEdit&lt;/code&gt;. Use &lt;code&gt;Edit|Write|MultiEdit&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. A relative script path
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;".claude/hooks/protect-files.sh"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hook runs from the current working directory, and the agent changes directories. Anchor it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The quotes matter if the path has a space.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. exit 1 in a PreToolUse hook
&lt;/h2&gt;

&lt;p&gt;Exit code 1 is a non-blocking error: the tool call still runs. To block it and send your message back to the agent, write to stderr and &lt;strong&gt;exit 2&lt;/strong&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="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Blocked: .env files are off limits"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2
&lt;span class="nb"&gt;exit&lt;/span&gt; 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Allowing all of Bash
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"allow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Bash"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That approves every shell command, &lt;code&gt;rm -rf&lt;/code&gt; and &lt;code&gt;curl | sh&lt;/code&gt; included. Allow specific commands instead, like &lt;code&gt;"Bash(npm run test:*)"&lt;/code&gt;, and leave the rest to ask.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. No deny rule for .env
&lt;/h2&gt;

&lt;p&gt;Nothing stops the agent from reading your secrets into its context unless you say so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"deny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Read(./.env)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Read(./.env.*)"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bonus: literal tokens in .mcp.json
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.mcp.json&lt;/code&gt; is meant to be committed. Put &lt;code&gt;"GITHUB_TOKEN": "${GITHUB_TOKEN}"&lt;/code&gt; there, not the token itself, and pin &lt;code&gt;npx&lt;/code&gt; packages to a version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check yours in 10 seconds
&lt;/h2&gt;

&lt;p&gt;I turned these checks into a free browser tool: &lt;a href="https://yeogreenji.github.io/agent-lint/" rel="noopener noreferrer"&gt;AgentLint&lt;/a&gt;. Paste your &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;settings.json&lt;/code&gt; or &lt;code&gt;.mcp.json&lt;/code&gt; and it lists what's wrong and how to fix it. Nothing is uploaded.&lt;/p&gt;

&lt;p&gt;For tested hooks to copy, the &lt;a href="https://github.com/yeogreenji/claude-code-playbook" rel="noopener noreferrer"&gt;Claude Code Playbook&lt;/a&gt; repo has a &lt;code&gt;.env&lt;/code&gt; guard, a dangerous-command blocker and a formatter hook, with a test script.&lt;/p&gt;

&lt;p&gt;Which of these has bitten you?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>productivity</category>
      <category>security</category>
    </item>
    <item>
      <title>Cron jobs fail silently. Here is how to know when they stop</title>
      <dc:creator>Brie Lab</dc:creator>
      <pubDate>Wed, 02 Dec 2026 06:27:00 +0000</pubDate>
      <link>https://dev.to/yeogreenji/cron-jobs-fail-silently-here-is-how-to-know-when-they-stop-24lp</link>
      <guid>https://dev.to/yeogreenji/cron-jobs-fail-silently-here-is-how-to-know-when-they-stop-24lp</guid>
      <description>&lt;p&gt;Cron has no idea whether your job did its work. It starts the command and moves on. If the job crashes, hangs, or never starts, nobody hears about it until the backup you needed isn't there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways cron jobs fail silently
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The job never runs.&lt;/strong&gt; The server rebooted and crond didn't come back, a deploy overwrote the crontab, the container holding it was replaced, or the schedule has a typo (&lt;code&gt;0 0 31 2 *&lt;/code&gt; never fires).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The job runs but fails.&lt;/strong&gt; A missing environment variable (cron runs with a minimal &lt;code&gt;PATH&lt;/code&gt;), an expired credential, a full disk. The output goes to local mail nobody reads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The job hangs.&lt;/strong&gt; A network call without a timeout, a lock that never releases. No error is written because the process never exits.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Logging exit codes only catches case 2. Case 1 produces no log line at all, and case 3 produces nothing until someone notices.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: a heartbeat (dead man's switch)
&lt;/h2&gt;

&lt;p&gt;Turn the check around. Instead of watching for errors, expect a signal. At the end of each successful run, the job calls a URL. A monitor knows how often that should happen, and alerts you when the signal is late. All three failure modes look the same from outside: the ping didn't arrive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 3 * * * /usr/local/bin/backup.sh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl -fsS -m 10 --retry 3 https://example.com/ping/YOUR_KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; sends the ping only if the script exits 0.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-m 10&lt;/code&gt; stops a slow network from hanging your job.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--retry 3&lt;/code&gt; rides out a blip.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pick the period and grace time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Period&lt;/strong&gt; = how often the job is scheduled. Daily at 03:00 means 1 day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grace&lt;/strong&gt; = how long a normal run can take, plus margin. A backup that takes 20 minutes gets 1 hour.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Too little grace gives false alarms; too much delays real ones. Start generous and tighten after a week.&lt;/p&gt;

&lt;h2&gt;
  
  
  Report failures explicitly
&lt;/h2&gt;

&lt;p&gt;For a daily job, waiting for a missed ping can mean hours of delay. If your script knows it failed, say so right away:&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="k"&gt;if&lt;/span&gt; /srv/job.sh&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; curl -fsS &lt;span class="s2"&gt;"$PING"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; curl -fsS &lt;span class="s2"&gt;"$PING/fail"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Catch hangs with timeout
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;*/10 * * * * &lt;span class="nb"&gt;cd&lt;/span&gt; /srv/app &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; timeout 300 ./sync.sh &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/log/sync.log 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl -fsS -m 10 &lt;span class="s2"&gt;"$PING"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;timeout 300&lt;/code&gt; turns a hang into a non-zero exit, so the ping is skipped and the alert fires.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other schedulers
&lt;/h2&gt;

&lt;p&gt;The same pattern works for systemd timers (&lt;code&gt;ExecStartPost=&lt;/code&gt;), Kubernetes CronJobs (a final step), GitHub Actions &lt;code&gt;schedule:&lt;/code&gt; workflows (a last step with &lt;code&gt;if: success()&lt;/code&gt;), and Windows Task Scheduler (&lt;code&gt;Invoke-WebRequest&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  A free monitor to try
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://yeogreenji.github.io/cronbeat/" rel="noopener noreferrer"&gt;CronBeat&lt;/a&gt; for this: create a check, put its ping URL at the end of your job, and add a Slack or Discord webhook. Five checks are free with no signup. Healthchecks.io and Cronitor are solid alternatives if you need more.&lt;/p&gt;

&lt;p&gt;What do you use to watch your cron jobs?&lt;/p&gt;

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