ClaudeMods
☰
EN
● 0 online · Views 0 times
SponsorsSubmit a project
Official examples · by 泉水亮介 │ 大学でVibe Codingを教えてます。

next-steps

After each turn, suggests up to three next prompts above the input. Press 1, 2 or 3 to put one in the prompt box as a draft you can edit, 0 to dismiss.

泉水亮介 │ 大学でVibe Codingを教えてます。@rsensui

1/

Claude Codeに「Mods」が入った。 Thariq(@trq212)が紹介していたので、公式ドキュメントと手元のCLIで全部裏を取った。 一部、ポストの説明より踏み込める。 元記事→ https://x.com/trq212/status/2105734197801562264

Original post image1

2/

Modsは「中で動くフック」だ。ここが肝。 これまでのsettings hooksは外側でシェルコマンドを叩く仕組みだった。 Modsは、JS/TSで書いた関数がClaude Codeのプロセスの内側で呼ばれる。 だからできることが一段違う。 ツール呼び出しを握って止める、差し替える、ユーザーに聞き返す。スピナーの表示を書き換える。トランスクリプトの横に自分のペインを出す。 公式ドキュメントの例は12行で、ツール呼び出し数をスピナーの隣に出すだけのコードだった。 `on('http://tool.call', ...)` と `on('ui.render', { component: 'Spinner' }, ...)` の2本。短い。

3/

Thariqが挙げていた「毎ターン分類器を回して記憶を書く」も実装できる。 ただ、彼は「エージェントを分岐させる(fork)」と書いていたので、APIを確認した。 実体は `$.model.fork({ prompt })`。 別エージェントを立ち上げるのではなく、**いま進行中の会話の上に1問だけ投げる**。同じモデル・同じシステムプロンプトなので、大半がプロンプトキャッシュから返る。 会話を混ぜたくなければ `$.model.complete`。こちらは履歴を持たない単発のプロンプト。 どちらも自分のプランかAPIキーを消費する。

4/

で、驚いたのがこっち。 **`/diff` も、AGENTS.mdの読み込みも、実はModだった。** 公式の組み込み一覧にこう書いてある。 ・`cc-plugin-diff` → `/diff` のペインを描いている ・`cc-plugin-agents-md` → AGENTS.mdをプロジェクト指示として読む ・`cc-plugin-telemetry` → 分析記録の送信 つまりAnthropic自身が、自社機能をこの拡張層の上に載せ替えている。 後付けのプラグイン機構じゃなくて、本体がもうそう動いてる。 `/plugin` の Installed タブに Built-in として並ぶ。無効化もできる。

5/

危ないところも書いておく。ここは誇張じゃない。 Modsはサンドボックスされない。あなたの権限でそのまま動く。 ファイルの読み書き、プロセス起動、ネットワーク、環境変数のAPIキー、送ったプロンプト全部、そしてツール呼び出しの事前承認まで。 sandboxingを有効にしていても、Modが起動したプロセスはサンドボックスの外だ。 入れる前に中身を見る手がある。 ``` claude plugin validate ./some-mod ``` 出力の `hooks:` と `calls:` に、扱うイベントと要求する操作が出る。実行せずに読める。

6/

手元で試すなら。 ``` claude plugin marketplace add anthropics/claude-plugins-community claude plugin install next-steps@claude-community ``` next-stepsの実際の挙動も確認した。「次に何をするか提案」より具体的で、**次のプロンプト候補を最大3つ、入力欄の上に出す。1/2/3で下書きに入り、0で消える**。 ひとつ注意。Modsはv2.1.287以降が必要。僕の手元は2.1.281で、そのままでは動かなかった。`claude --version` を先に見たほうがいい。 僕の考察。 ツール呼び出しの前後に自分のコードを差し込めるということは、「AIにどこまで任せるか」を各チームが自分で書けるということだ。危険なコマンドを止めるのも、承認を自動化するのも、同じ一行の裏表にある。 機能が増えた話に見えて、実は責任の置き場所が変わった。

7/

@trq212 非エンジニア向け Claude Code / Vibe Coding 法人研修 https://vibe-coder-bootcamp.com

Translated

About this mod

A function-hooks plugin shipped in the official anthropics/claude-plugins-community repository. On turn.complete it forks the session via $.model.fork to generate up to three likely next prompts, constrained to the session's available skills and slash commands (obtained through $.command.list). Suggestions render above the prompt box via ui.render on AbovePrompt; pressing 1/2/3 fills the prompt box as an editable draft ($.prompt.fill), 0 dismisses, and the top suggestion appears as ghost text via $.prompt.suggest. Suggestions are cleared on turn.start and the plugin never submits a prompt on its own. Options: minAnswerChars (default 80) and suggestSkills (default true). Scan flags an L3 model-fork call in hooks/register.tsx.

Installation

Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.

claude plugin marketplace add anthropics/claude-plugins-community
claude plugin install next-steps
Original text / README

next-steps

After each turn, suggests up to three next prompts above the input box.

next:
  1: run the tests you just wrote
  2: do the same for the settings page
  3: /code-review high
  0: dismiss

Press 1, 2 or 3 from an empty prompt box (or click one) and that prompt is written into the box as a draft. Edit it, then press Enter yourself. 0 dismisses. The top suggestion also shows as the box's dim ghost text, so Tab takes it.

The plugin never submits a prompt on its own.

How it works

It is a function-hooks plugin (hooks/register.tsx):

  • turn.complete: forks the session with $.model.fork to ask for likely next prompts. The fork shares the session's prompt cache, so it costs about one short reply.
  • $.command.list: the session's skills and slash commands (plugin, user and MCP ones with their descriptions) go into the fork's question, so a suggestion can be /skill arguments. A suggestion that names a command the session does not have is dropped.
  • ui.render on AbovePrompt: draws the suggestions as buttons.
  • A press calls $.prompt.fill; the top suggestion goes to $.prompt.suggest.
  • turn.start: hides the suggestions.

Suggestions draw in the terminal. Other surfaces show nothing.

Options

| Option | Default | What it does | | --- | --- | --- | | minAnswerChars | 80 | Skip suggestions after answers shorter than this | | suggestSkills | true | Tell the suggester which skills and slash commands the session has |

Showcase: Claude Codeに「Mods」が入った。

Thariq(@trq212)が紹介していたので、公式ドキュメントと手元のCLIで全部裏を取った。 一部、ポストの説明より踏み込める。

元記事→ https://x.com/trq212/status/2105734197801562264

Modsは「中で動くフック」だ。ここが肝。

これまでのsettings hooksは外側でシェルコマンドを叩く仕組みだった。 Modsは、JS/TSで書いた関数がClaude Codeのプロセスの内側で呼ばれる。

だからできることが一段違う。 ツール呼び出しを握って止める、差し替える、ユーザーに聞き返す。スピナーの表示を書き換える。トランスクリプトの横に自分のペインを出す。

公式ドキュメントの例は12行で、ツール呼び出し数をスピナーの隣に出すだけのコードだった。 on('http://tool.call', ...) と on('ui.render', { component: 'Spinner' }, ...) の2本。短い。

Thariqが挙げていた「毎ターン分類器を回して記憶を書く」も実装できる。

ただ、彼は「エージェントを分岐させる(fork)」と書いていたので、APIを確認した。

実体は $.model.fork({ prompt })。 別エージェントを立ち上げるのではなく、いま進行中の会話の上に1問だけ投げる。同じモデル・同じシステムプロンプトなので、大半がプロンプトキャッシュから返る。

会話を混ぜたくなければ $.model.complete。こちらは履歴を持たない単発のプロンプト。 どちらも自分のプランかAPIキーを消費する。

で、驚いたのがこっち。

/diff も、AGENTS.mdの読み込みも、実はModだった。

公式の組み込み一覧にこう書いてある。 ・cc-plugin-diff → /diff のペインを描いている ・cc-plugin-agents-md → AGENTS.mdをプロジェクト指示として読む ・cc-plugin-telemetry → 分析記録の送信

つまりAnthropic自身が、自社機能をこの拡張層の上に載せ替えている。 後付けのプラグイン機構じゃなくて、本体がもうそう動いてる。

/plugin の Installed タブに Built-in として並ぶ。無効化もできる。

危ないところも書いておく。ここは誇張じゃない。

Modsはサンドボックスされない。あなたの権限でそのまま動く。 ファイルの読み書き、プロセス起動、ネットワーク、環境変数のAPIキー、送ったプロンプト全部、そしてツール呼び出しの事前承認まで。

sandboxingを有効にしていても、Modが起動したプロセスはサンドボックスの外だ。

入れる前に中身を見る手がある。

claude plugin validate ./some-mod

出力の hooks: と calls: に、扱うイベントと要求する操作が出る。実行せずに読める。

手元で試すなら。

claude plugin marketplace add anthropics/claude-plugins-community
claude plugin install next-steps@claude-community

next-stepsの実際の挙動も確認した。「次に何をするか提案」より具体的で、次のプロンプト候補を最大3つ、入力欄の上に出す。1/2/3で下書きに入り、0で消える。

ひとつ注意。Modsはv2.1.287以降が必要。僕の手元は2.1.281で、そのままでは動かなかった。claude --version を先に見たほうがいい。

僕の考察。 ツール呼び出しの前後に自分のコードを差し込めるということは、「AIにどこまで任せるか」を各チームが自分で書けるということだ。危険なコマンドを止めるのも、承認を自動化するのも、同じ一行の裏表にある。

機能が増えた話に見えて、実は責任の置き場所が変わった。

@trq212 非エンジニア向け Claude Code / Vibe Coding 法人研修 https://vibe-coder-bootcamp.com 社群 next-steps mod:輸入欄上方最多 3 個下一步提示

Similar projects