---
title: "多すぎるヒヤリハットの後、小さな Claude Code mod を5つ作りました"
url: "https://claudemods.dev/ja/builds/i-built-5-small-claude-code-mods-after-one-too-many-close-ca-bbda35"
source: "https://www.reddit.com/r/ClaudeCode/comments/1x401ga/i_built_5_small_claude_code_mods_after_one_too"
source_type: "reddit"
author: "ITower__Education"
author_handle: "ITower__Education"
stars: 0
category: "セキュリティ・プライバシー"
categories: ["security"]
tags: ["guardrails", "hooks", "safety", "statusline", "task-board"]
permission_level: null
scan_complete: false
added: "2026-10-16T16:49:50.897Z"
updated: "2026-10-16T16:49:50.897Z"
locale: "ja"
content_locale: "ja"
---

# 多すぎるヒヤリハットの後、小さな Claude Code mod を5つ作りました

ある Reddit ユーザーが、度重なるヒヤリハットの後に作った5つの小さな Claude Code hook mod を共有しています。git reset --hard や rm -rf で一時停止し、危険にさらされる未コミットのファイルを一覧表示する破壊的コマンドガード、プロンプト上部のコンテキスト使用量の天気予報インジケーター、貼り付けられたシークレット用の API キーフィルター、main へのプッシュと金曜午後のブロック、そして Claude が読み取り、追記できるタスクボードです。著者は hook が fail open であること——クラッシュした hook はスキップされるため、あらゆるクラッシュを deny に変換する catch を追加したこと——を指摘し、これらのガードはパターンマッチングのみであり完全ではないと認めています。

## Description

r/ClaudeCode の Reddit 投稿で、著者が作った5つの小さな Claude Code mod を説明しており、それぞれ約20〜50行です。最も目立つのは破壊的コマンドガードです。Claude が git reset --hard または rm -rf を試みると、一時停止し、失われる未コミットのファイルを示し、確認を求め、通常は代わりに stash することを提案します。著者は、クラッシュした hook は黙ってスキップされるため、ガードのない失敗はすべてを通してしまい、クラッシュを deny に変える catch を追加したと強調しています。他の4つの mod は、プロンプト上部のコンテキスト使用量の天気予報インジケーター、誤って貼り付けられたシークレット用の API キーフィルター、main へのプッシュ（および金曜午後3時以降のあらゆる操作）のブロック、そして Claude が読み取り、追加できるタスクボードです。著者は、キーフィルターは入力されたテキストのみを検査し、コマンドガードはパターンマッチングであるため、スクリプト内に隠されたコードはすり抜ける可能性があると指摘しています。リポジトリのリンクやインストール手順は提供されていません。

## Original README

Claude Code opened up to mods recently so I built a few for stuff that kept biting me. Each one is 20-50 lines. I built them with Claude Code itself. I described what each mod should do, Claude wrote the first version, then I tested it in a live session and asked it to fix whatever broke. The regex lists for risky commands and API key formats were mostly Claude’s, I just trimmed them down. The most useful one by far stops destructive commands. If Claude tries git reset --hard or rm -rf , it pauses, shows which uncommitted files would be lost and asks me. If I say no, Claude usually just offers to stash first. Funny thing I didn’t expect: if a hook crashes, Claude Code just skips it. So a broken guard lets everything through. Had to add a catch that turns any crash into a deny. Lesson for me: always decide what your mod should do when it fails, because the default is “do nothing”. The other four: context usage shown as a little weather forecast above the prompt, a filter that hides API keys if you paste them by accident, a block on pushing to main (and on anything after 3pm Friday), and a task board Claude can read and add to. None of them are bulletproof btw. The key filter only sees what you type, and the command guard is just pattern matching, so something hidden inside a script gets past it. Is anyone else making mods? I’d like to see what people come up with.   submitted by   /u/ITower__Education   to   r/ClaudeCode [link]   [comments]
