アイデアの整理、実装、不具合調査など、状況に合う関連スキルと使う順序を案内します。作業の規模や段階に応じて、次に進む手順を選ぶための相談役です。
- アイデアから実装までの手順選び
- 不具合調査の始め方を知りたいとき
- 複数回に分ける開発の進め方を相談
Claude CodeでGitの送信や変更破棄などを実行前にブロックするフックを設定します。プロジェクト単位か全体への適用を選び、対象コマンドの調整と動作確認まで行います。
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
Claude CodeがGitコマンドを実行する直前に、指定した操作を止めるフックを設定します。フックとは、処理の前などに自動で動く確認用の仕組みです。標準ではgit pushの全形式、git reset --hard、強制削除を伴うgit clean、git branch -D、git checkout .、git restore .をブロックします。
エージェントによるリモートへの送信や、作業中の変更・ブランチの削除を防ぎたいときに向いています。一つのプロジェクトだけに適用するか、全プロジェクトに適用するかを選べます。ブロック対象の追加・削除にも対応します。
git pushをブロックして」Claude CodeのPreToolUseフックと、付属のシェルスクリプトを使用します。スクリプトには実行権限が必要です。設定先は.claude/settings.jsonまたは~/.claude/settings.jsonで、既存の設定へ追記します。対象はBashによる実行です。設定後はテスト入力を渡し、終了コードとブロックメッセージを確認します。
この紹介文は、公開されている SKILL.md をもとに AI(Claude Haiku)が作成しました。正確な仕様は下の原文を確認してください。
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
git push (all variants including --force)git reset --hardgit clean -f / git clean -fdgit branch -Dgit checkout . / git restore .When blocked, Claude sees a message telling it that it does not have authority to access these commands.
Ask the user: install for this project only (.claude/settings.json) or all projects (~/.claude/settings.json)?
The bundled script is at: scripts/block-dangerous-git.sh
Copy it to the target location based on scope:
.claude/hooks/block-dangerous-git.sh~/.claude/hooks/block-dangerous-git.shMake it executable with chmod +x.
Add to the appropriate settings file:
Project (.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
Global (~/.claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
If the settings file already exists, merge the hook into the existing hooks.PreToolUse array. Don't overwrite other settings.
Ask if user wants to add or remove any patterns from the blocked list. Edit the copied script accordingly.
Run a quick test:
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
Should exit with code 2 and print a BLOCKED message to stderr.
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
アイデアの整理、実装、不具合調査など、状況に合う関連スキルと使う順序を案内します。作業の規模や段階に応じて、次に進む手順を選ぶための相談役です。
長期的な目標に向けて複数のサブエージェントの作業を調整し、利用者との対話を続けながら、次の仕事にも役立つ作業環境や規約の改善を進めるスキル。
進行中の会話を引き継ぎ用に要約し、新しいバックグラウンドエージェントへ渡します。次の作業方針や参照資料を整理して、現在の作業場所で続きを始めます。
指定したコミットやブランチなどを基準にコードの変更を確認し、開発規約への適合と仕様の実現を別々にレビューします。二つの観点の指摘を分けて報告するスキルです。
呼び出し側が覚える使い方を小さく保ち、複雑な処理を内部にまとめる設計を支援します。共通の用語と判断基準で、モジュールの使いやすさやテストのしやすさを検討するスキルです。
再現しにくい不具合や処理速度の悪化を、症状を判定するテストやスクリプトで調べます。原因候補の検証から修正、再発防止の確認まで進めるスキル。