---
title: "VB-05「Commands & Hooks」を使い倒して生産性アップ！"
url: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat?lang=ja"
locale: ja
access: members
full_text: false
published_at: "2025-07-29T03:26:10.000Z"
tags: ["Claude Code", "Vibe Coding", "AI", "SaaS", "Startup"]
translations:
  en: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=en"
  vi: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=vi"
  zh: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=zh"
  ko: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=ko"
---
# VB-05「Commands & Hooks」を使い倒して生産性アップ！

> Claude Code の Commands & Hooks：よく使う prompt を / コマンドにまとめ、hook で CC が作業完了時に Telegram で知らせたり、しゃべったりするように。毎日使っている commands の全リストも公開します 😁

「Claude Code で Vibe Coding」シリーズ第 05 回です！正直、今回はちょっとサボり気味なので、よく使う commands と hooks を並べるだけにさせてください 😅

（とはいえ、記事の最後に Claude Code ユーザーにかなり役立つ repo をいくつか集めておいたので、ぜひチェックしてみてください！）

![VB-05「Commands & Hooks」を使い倒して生産性アップ！](https://media.zuey.me/blog/2025/ec820e22-cleanshot-2025-08-21-at-17-39-29.png)

> **INFO:** **TL;DR：** **Commands** は作り置きの prompt テンプレートを `/` で一発呼び出しする仕組み。**Hooks** は「X をするたびに必ず Y をする」という自動ルールで、Claude Code のイベントで発火します。交渉なし、「うっかり忘れ」もなし。

### Commands とは？

あらかじめ用意した prompt テンプレートを素早く送るための方法です。

`CLAUDE.md` や `agents/*.md` のような「**System Prompt**」と違い、commands は「**User Prompt**」なので「重み」がずっと大きく、優先的に処理されます。

たとえば作業中に何度も何度も書いている prompt があるなら、それを command にまとめて `/` でサッと呼び出せるようになります。

### Commands の作り方

とても簡単です。`~/.claude/commands` フォルダに、次の構成で Markdown ファイルを作るだけ：

```markdown
---
description: この command の説明
---

ここに prompt を書く

$ARGUMENTS
```

`$ARGUMENTS` は command の後ろに入力した内容で、その位置に差し込まれます（例：`/fix デフォルト言語のバグ`）。

#### command のスコープは 2 種類

| スコープ | .md ファイルの場所 | 使える範囲 |
| --- | --- | --- |
| Project commands | プロジェクトの `.claude/commands` | そのプロジェクト内だけ |
| Global commands | `~/.claude/commands` | どこでも！ |

#### Pro tip：Commands で Subagents を召喚する

最初の「Subagents」の記事で、「Commands」は必要なときに Subagents を召喚するベストな方法だと書きました。なので、各 command の中に詳しく明確な workflow を作り込んでおけば、自分好みにカスタマイズでき、タスクの種類ごとにぴったり合わせられます。

例：`fix-ci.md`

```markdown
---
description: Github Actions の失敗したテストを読み取り、分析、デバッグして修正する
---

Github Actions の失敗したテストを読み取り、分析、デバッグして修正して：

$ARGUMENTS

手順：
- "debugger" agent で Github Actions の logs を読んで分析する
- "planner" agent で修正計画を立てる
- "tester" agent で修正をテストし、すべての test suite が通ることを確認する
```

---

### 私が使っている commands 一覧

今回はちょっとサボり気味だし、「Commands」についてはもうあまり語ることもないので、Claude Code 用に作った command の一覧だけ共有させてください。

command ファイルはすべて[この repo](https://github.com/mrgoonie/claude-code-setup)に置いてあります。私が最適化して今使っている Subagents のセットアップ一式も入っているので、必要な人は自由に持っていってください。

（フィードバックや改善アイデアがあれば、repo に直接 contribute してくださいね！）

*実は私も他の人の repo から「インスパイアされた」（「パクった」のおしゃれな言い方）だけなんです。Claude Code ユーザーにかなり役立つと思う repo のひとつが* [*https://github.com/mrgoonie/claude-code-setup*](https://github.com/mrgoonie/claude-code-setup) *— ぜひ見てみてください！*

| Command | 用途 | 自分でコードを直す？ |
| --- | --- | --- |
| `/ask` | codebase やアーキテクチャについて何でも質問 | いいえ |
| `/plan` | `planner-researcher` で詳細な計画を作成 | いいえ、レポートのみ |
| `/cook` | agent チーム総出で機能実装 / 複雑なバグ修正 | はい |
| `/fix` | ちょっとしたバグをサクッと修正 | はい |
| `/fix-test` | ローカルでテストを回し、通るまで修正 | はい |
| `/fix-ci` | Github Actions の logs を読み、修正計画を作成 | 先に確認を取る |
| `/test` | ローカルでテストを回して報告 | いいえ |
| `/refactor` | 計画と制約つきのリファクタリング | 先に確認を取る |
| `/debug` | バグの根本原因を探す | いいえ |
| `/watzup` | 最近の変更をまとめる | いいえ |

#### /ask

codebase について何でも質問するための command です。

**/ask command の中身を見る**

```markdown
---
description: Answer technical and architectural questions.
---
## Context
- Technical question or architecture challenge: $ARGUMENTS
- Relevant system documentation and design artifacts will be referenced using @ file syntax.
- Current system constraints, scale requirements, and business context will be considered.

## Your Role
You are a Senior Systems Architect providing expert consultation and architectural guidance. You focus on high-level design, strategic decisions, and architectural patterns rather than implementation details. You orchestrate four specialized architectural advisors:
1. **Systems Designer** – evaluates system boundaries, interfaces, and component interactions.
2. **Technology Strategist** – recommends technology stacks, frameworks, and architectural patterns.
3. **Scalability Consultant** – assesses performance, reliability, and growth considerations.
4. **Risk Analyst** – identifies potential issues, trade-offs, and mitigation strategies.

## Process
1. **Problem Understanding**: Analyze the technical question and gather architectural context.
2. **Expert Consultation**:
   - Systems Designer: Define system boundaries, data flows, and component relationships
   - Technology Strategist: Evaluate technology choices, patterns, and industry best practices
   - Scalability Consultant: Assess non-functional requirements and scalability implications
   - Risk Analyst: Identify architectural risks, dependencies, and decision trade-offs
3. **Architecture Synthesis**: Combine insights to provide comprehensive architectural guidance.
4. **Strategic Validation**: Ensure recommendations align with business goals and technical constraints.

## Output Format
1. **Architecture Analysis** – comprehensive breakdown of the technical challenge and context.
2. **Design Recommendations** – high-level architectural solutions with rationale and alternatives.
3. **Technology Guidance** – strategic technology choices with pros/cons analysis.
4. **Implementation Strategy** – phased approach and architectural decision framework.
5. **Next Actions** – strategic next steps, proof-of-concepts, and architectural validation points.

## Important
This command focuses on architectural consultation and strategic guidance. Do not start implementing anything.
```

#### /plan

「planner-researcher」subagent を召喚して、機能実装や複雑なバグ修正のための詳細な計画を立てます。**REPORT のみ、実行は NO。**

```markdown
---
description: Research, analyze, and create implementation plans
---
Use the `planner-researcher` subagent to plan for this task: 
 $ARGUMENTS

REMEMBER: **Do not** start implementing.
```

#### /cook

私の system prompt には、subagents と働く workflow の重要な 3 要素がすでに入っています：**Core Responsibilities、Subagents Team、Development Rules。** agent チーム総出が必要な機能実装や複雑なバグ修正のときに、この command を呼びます。

---

*Phần còn lại dành cho thành viên có quyền đọc toàn bài (Knowledges, Kết hợp, Cộng đồng) — see plans at https://zuey.me/pricing*
