geekfujiwara/codeappsdevelopmentstandard/ai-builder

Claude Code and agent skill by geekfujiwara/codeappsdevelopmentstandard

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

AI Builder の AI プロンプト(GPT Dynamic Prompt)を Dataverse API で作成し、Copilot Studio エージェントにツール(アクション)として追加する。Power Automate フローとの統合パターンも含む。

Install

npx vskill@latest install geekfujiwara/codeappsdevelopmentstandard/ai-builder

SKILL.md

AI Builder AI プロンプト構築スキル

AI Builder の AI プロンプト(GPT Dynamic Prompt) を Dataverse API で作成し、 Copilot Studio エージェントに ツール(アクション) として追加する。 Power Automate フローから aibuilderpredict_customprompt で呼び出すパターンも含む。

基本方針: AI プロンプトを常にプレビルトモデルより優先する

AI Builder で AI 処理を実装する場合、以下の方針に従う:
✅ AI プロンプト(カスタムプロンプト)を常に第一選択肢とする
- 請求書処理、ドキュメント情報抽出、分類、要約 等すべて
- プロンプトテキスト + document/image 入力で柔軟に対応
- トレーニングデータ不要、即座にデプロイ・更新可能
- プロンプト変更だけで出力形式・抽出項目を自由に調整
❌ プレビルトモデル(請求書処理モデル等)は原則使用しない
- 従来型のプレビルトモデルやカスタムモデルはトレーニング(学習)が必要
- AI プロンプトで同等の処理がプロンプトだけで実現できる
⚠ プレビルトモデルを使う例外ケース(稀)
- 手書き文字の高精度 OCR が必須で AI プロンプトでは精度不足の場合
- 既存のプレビルトモデルが組み込まれたワークフローを維持する必要がある場合

前提: 設計フェーズ完了後に構築に入る(必須)

AI プロンプトを構築する前に、プロンプト設計をユーザーに提示し承認を得ていること。

設計提示時に含める内容:

項目内容
プロンプト名英語推奨(スキーマ名に使用される)
プロンプトテキストリテラルテキスト+入力変数の組み合わせ
入力変数名前・型(text / document / image)・説明・テスト値
出力形式text or json(JSON の場合はスキーマ+サンプル)
モデルパラメータモデル種別(gpt-41-mini 等)・temperature
利用先Copilot Studio ツール or Power Automate フロー
shouldPromptUser各入力変数をユーザーに自動的に尋ねるか(true/false)

事前確認(会話の最初に 1 回だけ)

本スキルの利用が確定したら、standard の共通契約に加え、 1 回の AskUserQuestion で次をまとめて確認する。

#質問合格条件
1対象環境で AI Builder を利用できるか必要なライセンス / AI Builder capacity があり、利用制限を確認している
2AI プロンプトを作成・公開する権限があるかmsdyn_aimodel 等の必要テーブルと AIModelPublish を実行できる担当者がいる
3利用先はどこかCopilot Studio / Power Automate、接続参照、実行ユーザー、呼び出し側ライセンスを確定している
4入力データをモデルへ送信してよいかdocument / image / text の分類、個人情報、保持・リージョン要件を承認済みである
5プロンプト、入力、JSON schema、モデル、テスト値は承認済みか正常系、拒否すべき入力、期待出力を記録している

System Administrator を常用せず、AI モデルの作成・公開とソリューション追加に必要な Dataverse 権限だけを持つ担当者を優先する。capacity または権限が未確認なら AIModelPublish を呼び出さない。

重要事項: AIModelPublish 1ステップ・アクティベーション

2026-04-15 検証済み: `AIModelPublish` アクションは1ステップでモデルを完全にアクティブ化する。

従来(旧パターン — ❌ 複雑で環境差異に弱い):
1. Create Model
2. Create Training Config (statecode=2, statuscode=6 を指定)
3. Create Run Config (statecode=2, statuscode=7 を指定)
4. PATCH Model (_msdyn_activerunconfigurationid_value + statecode=1)
→ 環境によって statecode/statuscode 指定や _value PATCH が拒否される
正解(新パターン — ✅ シンプルで確実):
1. Create Model(msdyn_TemplateId@odata.bind 形式)
2. AIModelPublish(msdyn_ プレフィックスなし unbound action)
→ Published Training Config (state=2, status=6) を自動生成
→ Run Config (state=2, status=7) を自動生成(RunConfigurationId の値が ID になる)
→ Model を Active (state=1, status=1) に自動変更
→ 完了! わずか 2 API コール
更新時:
1. 既存 Model を検索 → Active Run Config の ID を取得
2. Run Config の msdyn_customconfiguration を PATCH
→ 完了!(再公開不要)
AIModelPublish の呼び出し方
python
import requests
token = get_token()
headers = {
"Authorization": f"Bearer {token}",
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Content-Type": "application/json; charset=utf-8",
}
r = requests.post(
f"{DATAVERSE_URL}/api/data/v9.2/AIModelPublish", # ★ msdyn_ プレフィックスなし!
headers=headers,
json={
"TemplateId": GPT_TEMPLATE_ID, # GPT Dynamic Prompt テンプレート固定値
"ModelId": model_id, # 作成した Model の GUID
"RunConfigurationId": model_id, # ★ model_id を渡すと Run Config ID = model_id
"ModelName": PROMPT_NAME,
"CustomConfiguration": custom_config_json_str,
"RunConfiguration": custom_config_json_str,
},
)
assert r.status_code < 400, f"AIModelPublish 失敗: {r.status_code}"
# → Model が Active、activeRun = model_id
重要な注意点
項目説明
アクション名AIModelPublish(msdyn_AIModelPublish ではない! プレフィックスなし)
RunConfigurationIdmodel_id を渡すと Run Config がその ID で自動作成される
自動生成物Published Training (state=2,status=6) + Run Config (state=2,status=7)
結果Model が state=1(Active)に自動変更される
副作用Published Training Config は DELETE 不可(405)→ 無害
失敗時既に Active な Run Config がある場合 AnotherRunConfigAlreadyPublished

Dataverse データ構造

AI Builder の AI プロンプトは 3 つの Dataverse テーブル + 1 つの botcomponent で構成される。

┌─────────────────────────┐
│ msdyn_aimodel │ ← AI プロンプト本体
│ (msdyn_aimodels) │
│ │
│ msdyn_name │ プロンプト名
│ _msdyn_templateid_value│ GPT Prompt テンプレート ID
│ _msdyn_activerunconfigurationid_value │ → Run Config
│ statecode=1 (Active) │
└──────────┬──────────────┘
│ 1:N
▼
┌─────────────────────────┐
│ msdyn_aiconfiguration │ ← 設定(AIModelPublish で自動生成)
│ (msdyn_aiconfigurations│
│ │
│ Training (type=190690000, state=2, status=6) │ Published Training
│ Run (type=190690001, state=2, status=7) │ Active Run Config
│ msdyn_customconfiguration = JSON │ ← プロンプト定義本体
└─────────────────────────┘
┌─────────────────────────┐
│ botcomponent │ ← エージェントとの紐付け(Copilot Studio 利用時のみ)
│ (botcomponents) │
│ │
│ componenttype=9 │ トピックと同じ型
│ kind: TaskDialog │ AI プロンプトアクション
│ action.aIModelId │ → msdyn_aimodel の GUID
│ _parentbotid_value │ → エージェント (bots)
└─────────────────────────┘
テンプレート ID(固定値)
テンプレート名ID
GPT Dynamic Promptedfdb190-3791-45d8-9a6c-8f90a37c278a
msdyn_customconfiguration の JSON 構造
json
{
"version": "GptDynamicPrompt-2",
"prompt": [
{ "type": "literal", "text": "以下の情報を分析してください: " },
{ "type": "inputVariable", "id": "input_text" },
{ "type": "literal", "text": " を基にレポートを作成。" }
],
"definitions": {
"inputs": [
{
"id": "input_text",
"text": "input_text",
"type": "text",
"quickTestValue": "テスト用のサンプルテキスト"
}
],
"formulas": [],
"data": [],
"output": {
"formats": ["json"],
"jsonSchema": {
"type": "object",
"properties": {
"summary": { "type": "string" },
"key_points": { "type": "array", "items": { "type": "string" } }
}
},
"jsonExamples": [
{ "summary": "出力例", "key_points": ["ポイント1", "ポイント2"] }
]
}
},
"modelParameters": {
"modelType": "gpt-41-mini",
"gptParameters": { "temperature": 0 }
},
"settings": {
"recordRetrievalLimit": 30,
"shouldPreserveRecordLinks": null,
"runtime": null
},
"code": "",
"signature": ""
}
prompt 配列の要素型
type説明必須フィールド
literal固定テキストtext
inputVariable入力変数への参照id
definitions.inputs の型
type説明備考
textテキスト入力quickTestValue でテスト値
documentドキュメント入力ファイルアップロード
image画像入力画像ファイル
definitions.output の形式
formats説明追加フィールド
["text"]テキスト出力なし
["json"]JSON 出力jsonSchema + jsonExamples 必須
modelParameters.modelType の値
値モデル
gpt-41-miniGPT-4.1 mini
gpt-41GPT-4.1
o3-minio3-mini
botcomponent の YAML 構造(kind: TaskDialog)
yaml
kind: TaskDialog
inputs:
- kind: AutomaticTaskInput
propertyName: text
name: text
shouldPromptUser: true
modelDisplayName: AI Prompt Sample
modelDescription: AI Prompt Sample
action:
kind: InvokeAIBuilderModelTaskAction
aIModelId: {your-ai-model-id} # AI Model 作成時に払い出される環境固有 ID
outputMode: All

構築手順

詳細な構築手順・デプロイスクリプトテンプレートは 構築リファレンス を参照。

Power Automate フローからの AI Builder 呼び出し

AI Builder プロンプトを Power Automate フロー内で呼び出す パターン。 Copilot Studio ツールではなく、Dataverse トリガー等と組み合わせて自動実行する場合に使う。

詳細は Power Automate 連携リファレンス を参照。

必須要件

AI Model 作成【必須】
✅ テンプレート ID は固定値 edfdb190-3791-45d8-9a6c-8f90a37c278a(GPT Dynamic Prompt)
✅ Model 作成は msdyn_TemplateId@odata.bind 形式を使用
✅ AIModelPublish (msdyn_ プレフィックスなし) で1ステップ完全アクティブ化
✅ RunConfigurationId に model_id を渡す → Run Config がその ID で作成される
✅ 更新時は Active Run Config の msdyn_customconfiguration を PATCH するだけ
❌ _msdyn_templateid_value を使う → 一部環境で拒否される
❌ _msdyn_activerunconfigurationid_value を直接 PATCH → 一部環境で拒否される
❌ statecode/statuscode を Config 作成時に指定 → 一部環境で拒否される
❌ PublishAIConfiguration を新規モデルに使う → AIModelPublish 単体で十分
❌ msdyn_AIModelPublish(msdyn_ プレフィックス付き)→ 404
❌ msdyn_Publish → 404
❌ SetState → 404
プロンプト定義
✅ prompt 配列は literal と inputVariable を交互に配置
✅ inputVariable の id は definitions.inputs の id と一致させる
✅ JSON 出力の場合は jsonSchema + jsonExamples の両方を定義
✅ modelType は有効な値を使用(gpt-41-mini, gpt-41, o3-mini)
✅ temperature は 0〜1 の float 値
botcomponent(エージェント追加)
✅ componenttype=9(トピックと同じ型番)
✅ schemaname は {botSchema}.action.{PromptNameNoSpaces} 形式
✅ YAML の kind は TaskDialog
✅ action.kind は InvokeAIBuilderModelTaskAction
✅ action.aIModelId は msdyn_aimodel の GUID(ハイフン付き小文字)
✅ inputs の propertyName は customconfiguration の inputs.id と一致
✅ shouldPromptUser: true でエージェントがユーザーに入力を求める
❌ yaml.dump() で YAML を生成 → PVA パーサーと非互換
❌ componenttype を間違える → エージェントに表示されない
ソリューション管理
✅ msdyn_aimodel の作成は solution ヘッダー付きで POST
✅ AIModelPublish 後、自動生成された Config もソリューションに含まれる
✅ AddSolutionComponent (componenttype=401) で検証・補完
❌ デフォルトソリューションに入ったままにする → 環境間移行不可
Power Automate フロー連携
✅ aibuilderpredict_customprompt で Active Model を参照(recordId パラメータ)
✅ Model が Active でないとフロー有効化時に GetPredictionSchema 検証で失敗
✅ Model → Flow の順でデプロイ(Model が Active 必須)
✅ フロー定義の dict キーに動的値を使う場合は f-string 必須
✅ 新しい Dataverse 列を追加した後は PublishAllXml でコネクタメタデータ更新
❌ Draft Model を参照するフローを有効化 → "GetPredictionSchema failed"

ファイル入力(Image or Document Input)の制限事項

公式ドキュメント: https://learn.microsoft.com/en-us/microsoft-copilot-studio/add-inputs-prompt#limitations

対応ファイル形式
条件対応形式
標準(Code Interpreter オフ)PNG, JPG, JPEG, PDF のみ
Code Interpreter オン上記 + Word (.doc/.docx), Excel (.xls/.xlsx), PowerPoint (.ppt/.pptx)
サイズ・ページ数・時間制限
制限項目値
ファイルサイズ合計25 MB 未満(全ファイル合計)
ページ数50 ページ未満
処理タイムアウト100 秒(超過するとタイムアウトエラー)
その他の制限
  • Copilot Studio エージェントのツールとしての AI プロンプトでは画像/ドキュメント入力は未対応
  • ファイル処理が必要な場合は Power Automate フロー経由で AI プロンプトを呼び出す
  • 非対応ファイル形式の回避策: OneDrive for Business ConvertFile で PDF 変換してから渡す

.env 追加パラメータ

全パラメータの定義(取得元コメント付き)は references/.env.example を参照。 実値はリポジトリルートの .env に置く(.gitignore 済み)。

env
# AI Builder AI Prompt 用(既存 .env に追加)
AI_PROMPT_NAME=AI Prompt Sample
AI_PROMPT_BOT_ID=https://copilotstudio.../bots/xxxxxxxx-xxxx-.../overview
# ↑ BOT_ID と異なるエージェントに追加する場合のみ指定

デプロイ・トラブルシューティング

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
57
Repository forks
20
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/geekfujiwara/codeappsdevelopmentstandard/ai-builder/badge)](https://verified-skill.com/skills/geekfujiwara/codeappsdevelopmentstandard/ai-builder)

Something wrong with this skill or its page? Tell us.