auto-trigger について
auto-triggerは、ワークフローのイベント後にスキル間で後続処理をつなぐ方法を定めるスキルです。トリガーモード、条件、コンテキストの受け渡し、安全策を記述し、実行にはホストランタイムやアダプターの対応が必要です。
主な機能
- 01ワークフローイベント用フック
- 02自動・バックグラウンド・事前確認モード
- 03後続処理の条件とコンテキスト
- 04安全でない処理やループを避ける指針
活用シーン
- 01PRD完了後の処理を定義
- 02実装後にコードレビューを依頼
- 03セッションの開始・終了イベントを記録
- 04エラーのコンテキストを後続スキルに渡す
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ zhaono1/ agent-playbook --skill auto-triggerインストール後、Claude Code で/auto-triggerを入力して読み込まれたか確認します。
同梱ファイルREADME.md
詳細
自動トリガーフック
このスキルでは、スキル間のトリガーの意図を定義します。スキルがワークフローを完了すると、ホストランタイムまたはエージェントはこのメタデータを読み取り、後続処理を保留として記録できます。次のスキルを実行するのは、その処理が現在のセッションでサポートされ、安全な場合に限ります。
フックの定義
PRD 作成チェーン
prd_complete:
triggers:
- skill: self-improving-agent
mode: background
condition: PRD file exists and is complete
- skill: session-logger
mode: auto
context: "PRD created for {feature_name}"
prd_implemented:
triggers:
- skill: session-logger
mode: auto
context: "Implemented PRD: {feature_name}"
実装チェーン
implementation_complete:
triggers:
- skill: code-reviewer
mode: ask_first
message: "Implementation complete. Run code review?"
- skill: create-pr
mode: ask_first
condition: user_requested_submission
セッション管理
session_start:
auto_triggers:
- skill: session-logger
action: create_session_file
session_end:
auto_triggers:
- skill: session-logger
action: update_session_file
スキルでのフック形式
スキルに自動トリガー機能を追加するには、フロントマターに次の内容を追加します。
---
name: my-skill
description: Skill description
allowed-tools: Read, Write, Edit
hooks:
before_start:
- trigger: session-logger
mode: auto
context: "Start {skill_name}"
after_complete:
- trigger: self-improving-agent
mode: background
- trigger: session-logger
mode: auto
on_error:
- trigger: self-improving-agent
mode: background
---
実装ガイド
スキルがワークフローを完了したとき:
- 自身のフロントマターの
hooksを確認します(before_start、after_complete、on_error、on_progress) - 各フックについて:
mode: autoの場合、ホストランタイムがサポートしているときに限り、リスクの低い後続処理を記録するか実行しますmode: backgroundの場合、ブロックしない後続処理を記録します。永続ファイルをひそかに変更してはいけませんmode: ask_firstの場合、トリガーする前にユーザーに確認しますcondition:がある場合は、最初に条件を確認します
- コンテキストを渡します トリガーされたスキルに
統合例
prd-planner が追加する内容
---
name: prd-planner
description: Creates PRDs using persistent file-based planning...
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion, WebSearch
hooks:
after_complete:
- trigger: self-improving-agent
mode: background
context: "PRD created at {prd_file}"
- trigger: session-logger
mode: auto
context: "PRD creation complete"
---
self-improving-agent では、明示的な検証ゲートと適用ゲートを使用します
---
name: self-improving-agent
description: Captures redacted candidates, validates them with evidence, and records only explicitly applied rules...
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
---
Claude の失敗フックは CLI アダプターによってインストールされ、移植可能なスキルメタデータとして宣言されるものではありません。このスキルの hooks の例は宣言的な意図を示すものであり、ホストアダプターが明示的に実装しない限り、機能しません。他のホストでは、文書化されたアダプターまたは手動での記録を使用してください。
create-pr が追加する内容
---
name: create-pr
description: Creates pull requests with bilingual documentation updates...
allowed-tools: Read, Write, Edit, Bash, Grep, AskUserQuestion
hooks:
after_complete:
- trigger: session-logger
mode: auto
context: "PR created: {pr_title}"
---
チェーンの可視化
┌──────────────┐
│ prd-planner │
└──────┬───────┘
│ after_complete
├──→ self-improving-agent (background)
│ └──→ create-pr (ask_first)
│ └──→ session-logger (auto)
└──→ session-logger (auto)
エラー修正チェーン
on_error:
triggers:
- skill: self-improving-agent
mode: background
context: "Error occurred in {skill_name}"
- skill: session-logger
mode: auto
context: "Error captured for {skill_name}"
重要なルール
- 無限ループを作らないでください - チェーンが必ず終了するようにします
- 重要な操作の前に確認してください - PR、デプロイ、永続ファイルの変更には
mode: ask_firstを使用します - バックグラウンドタスク - ブロックしない分析や提案用アーティファクトには
mode: backgroundを使用します - コンテキストを渡してください - トリガーされるスキルには、関連するコンテキストを必ず含めます
コメント
Markdown 対応