mcpField
S
shortcuts-generator

shortcuts-generator

github.com/drewocarr生産性21962 回インストール41 週間前に更新
リポジトリ

shortcuts-generator について

Apple Shortcutsにインポートできる、署名可能な`.shortcut`ファイルを生成するスキルです。plistの構造、アクションのパラメーター、変数参照、制御フローを扱います。

主な機能

  1. 01ショートカットのplistファイル生成
  2. 02アクション識別子とパラメーターの設定
  3. 03変数参照による出力の接続
  4. 04繰り返し・条件分岐・メニューの構築
  5. 05アクションとパラメーターの資料

活用シーン

  1. 01複数アクションを含むショートカットの作成
  2. 02前のアクションの出力を後続へ渡す処理
  3. 03条件分岐や繰り返しを含むフローの構築
  4. 04ファイルに署名してShortcutsへインポート

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/drewocarr/generate-shortcuts-skill --skill shortcuts-generator

インストール後、Claude Code で/shortcuts-generatorを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

APPINTENTS.md
README.md
ACTIONS.md
PLIST_FORMAT.md
VARIABLES.md
CONTROL_FLOW.md
EXAMPLES.md
FILTERS.md
PARAMETER_TYPES.md

詳細

macOS ショートカットジェネレーター

Appleのショートカットアプリにインポートできる、署名可能な有効な .shortcut ファイルを生成します。

クイックスタート

ショートカットは、次の構造を持つバイナリ plist です。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>WFWorkflowActions</key>
    <array>
        
    </array>
    <key>WFWorkflowClientVersion</key>
    <string>2700.0.4</string>
    <key>WFWorkflowHasOutputFallback</key>
    <false/>
    <key>WFWorkflowIcon</key>
    <dict>
        <key>WFWorkflowIconGlyphNumber</key>
        <integer>59511</integer>
        <key>WFWorkflowIconStartColor</key>
        <integer>4282601983</integer>
    </dict>
    <key>WFWorkflowImportQuestions</key>
    <array/>
    <key>WFWorkflowMinimumClientVersion</key>
    <integer>900</integer>
    <key>WFWorkflowMinimumClientVersionString</key>
    <string>900</string>
    <key>WFWorkflowName</key>
    <string>My Shortcut</string>
    <key>WFWorkflowOutputContentItemClasses</key>
    <array/>
    <key>WFWorkflowTypes</key>
    <array/>
</dict>
</plist>
最小限の Hello World
<dict>
    <key>WFWorkflowActionIdentifier</key>
    <string>is.workflow.actions.gettext</string>
    <key>WFWorkflowActionParameters</key>
    <dict>
        <key>UUID</key>
        <string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
        <key>WFTextActionText</key>
        <string>Hello World!</string>
    </dict>
</dict>
<dict>
    <key>WFWorkflowActionIdentifier</key>
    <string>is.workflow.actions.showresult</string>
    <key>WFWorkflowActionParameters</key>
    <dict>
        <key>Text</key>
        <dict>
            <key>Value</key>
            <dict>
                <key>attachmentsByRange</key>
                <dict>
                    <key>{0, 1}</key>
                    <dict>
                        <key>OutputName</key>
                        <string>Text</string>
                        <key>OutputUUID</key>
                        <string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
                        <key>Type</key>
                        <string>ActionOutput</string>
                    </dict>
                </dict>
                <key>string</key>
                <string></string>
            </dict>
            <key>WFSerializationType</key>
            <string>WFTextTokenString</string>
        </dict>
    </dict>
</dict>

基本概念

1. アクション

各アクションには次の要素があります。

  • 識別子:is.workflow.actions.<name>(例:is.workflow.actions.showresult)
  • パラメーター:WFWorkflowActionParameters 内の、アクション固有の設定
  • UUID:このアクションの出力を参照するための一意の識別子
2. 変数参照

前のアクションの出力を使用するには:

  1. 出力元のアクションに UUID パラメーターが必要です
  2. attachmentsByRange 辞書内の OutputUUID を使って参照します
  3. 文字列内で変数を挿入する位置に、プレースホルダーとして (U+FFFC)を使用します
  4. WFSerializationType を WFTextTokenString に設定します
3. 制御フロー

制御フローアクション(繰り返し、条件分岐、メニュー)では、次の要素を使用します。

  • GroupingIdentifier:開始/中間/終了アクションを関連付けるUUID
  • WFControlFlowMode:0=開始、1=中間(else/case)、2=終了

よく使うアクションのクイックリファレンス

アクション識別子主要なパラメーター
テキストis.workflow.actions.gettextWFTextActionText
結果を表示is.workflow.actions.showresultText
入力を求めるis.workflow.actions.askWFAskActionPrompt、WFInputType
AIモデルを使用is.workflow.actions.askllmWFLLMPrompt、WFLLMModel、WFGenerativeResultType
コメントis.workflow.actions.commentWFCommentActionText
URLis.workflow.actions.urlWFURLActionURL
URLの内容を取得is.workflow.actions.downloadurlWFURL、WFHTTPMethod
天気を取得is.workflow.actions.weather.currentconditions(必須項目なし)
アプリを開くis.workflow.actions.openappWFAppIdentifier
URLを開くis.workflow.actions.openurlWFInput
アラートis.workflow.actions.alertWFAlertActionTitle、WFAlertActionMessage
通知is.workflow.actions.notificationWFNotificationActionTitle、WFNotificationActionBody
変数を設定is.workflow.actions.setvariableWFVariableName、WFInput
変数を取得is.workflow.actions.getvariableWFVariable
数値is.workflow.actions.numberWFNumberActionNumber
リストis.workflow.actions.listWFItems
辞書is.workflow.actions.dictionaryWFItems
繰り返す(回数)is.workflow.actions.repeat.countWFRepeatCount、GroupingIdentifier、WFControlFlowMode
繰り返す(各項目)is.workflow.actions.repeat.eachWFInput、GroupingIdentifier、WFControlFlowMode
If/Otherwiseis.workflow.actions.conditionalWFInput、WFCondition、GroupingIdentifier、WFControlFlowMode
メニューから選択is.workflow.actions.choosefrommenuWFMenuPrompt、WFMenuItems、GroupingIdentifier、WFControlFlowMode
写真を検索is.workflow.actions.filter.photosWFContentItemFilter(FILTERS.mdを参照)
写真を削除is.workflow.actions.deletephotosphotos(WFInputではありません!)

詳細リファレンスファイル

完全なドキュメントについては、以下を参照してください。

  • PLIST_FORMAT.md - plist構造の詳細
  • ACTIONS.md - 427種類すべてのWF*Action識別子とパラメーター
  • APPINTENTS.md - 728種類すべてのAppIntentアクション
  • PARAMETER_TYPES.md - すべてのパラメーター値の型とシリアライズ形式
  • VARIABLES.md - 変数参照システム
  • CONTROL_FLOW.md - 繰り返し、条件分岐、メニューのパターン
  • FILTERS.md - 検索/フィルターアクション用のコンテンツフィルター(写真、ファイルなど)
  • EXAMPLES.md - 完全な動作例

ショートカットの署名

ショートカットは、インポートする前に必ず署名する必要があります。macOS の shortcuts CLI を使用してください。

# Sign for anyone to use
shortcuts sign --mode anyone --input MyShortcut.shortcut --output MyShortcut_signed.shortcut

# Sign for people who know you
shortcuts sign --mode people-who-know-me --input MyShortcut.shortcut --output MyShortcut_signed.shortcut

署名の手順:

  1. plist を XML として .shortcut ファイルに書き込みます
  2. shortcuts sign を実行して、暗号署名を追加します(約19KB増加します)
  3. 署名済みファイルを Shortcuts.app で開いてインポートできます

ショートカットを作成するワークフロー

  1. アクションを定義する - ショートカットに実行させる内容を列挙します
  2. UUID を生成する - 出力を生成する各アクションに一意の UUID が必要です
  3. アクション配列を構築する - 識別子とパラメーターを含む各アクションの辞書を作成します
  4. 変数参照を接続する - OutputUUID を使って出力と入力を接続します
  5. plist でラップする - アイコン、名前、バージョンを含むルート構造を追加します
  6. ファイルに書き込む - .shortcut として保存します(XML plist 形式で問題ありません)
  7. 署名する - shortcuts sign を実行してインポート可能にします

主なルール

  1. UUID は大文字にする必要があります:A1B2C3D4-E5F6-7890-ABCD-EF1234567890
  2. WFControlFlowMode は整数です:<string>0</string> ではなく <integer>0</integer> を使用します
  3. 範囲キーの形式:{position, length} - 例:最初の文字には {0, 1} を使用します
  4. プレースホルダー文字:(U+FFFC)は、変数を挿入する位置を示します
  5. 制御フローには対応する終了アクションが必要です:すべての繰り返し/if/メニューの開始には、同じ GroupingIdentifier を持つ終了アクションが必要です

コメント