ユーザーが動作する質問とそれに対応するSQL(データベース問い合わせ言語)のペアを登録・検証して `.aidp/verified-queries.md` に保存し、エージェント(自動処理を行うプログラム)が新しいSQLを生成する前に、信頼できる既存のSQLを再利用できるようにします。確認済みのペアはそれぞれクラスタ(複数のコンピュータを連携させたシステム)上で検証してから、信頼済みとしてマーク付けされます。 **次のような場合に使用:** - ユーザーが動作実績のあるクエリを標準形式として保存したい - 信頼できるクエリの参考集を構築したい - よくある質問に対する回答の信頼性を高めたい
Register and validate reusable question→Spark-SQL pairs in .aidp/verified-queries.md so the agent reuses trusted SQL before generating new SQL. Use when the user wants to save a working query as canonical, build a verified-query repository, or improve answer reliability for recurring questions. Validates each pair on the cluster before marking it verified.
aidp-verified-queries — 検証済みクエリリポジトリ(VQR).aidp/verified-queries.md を管理するスキルです。
このファイルには、検証済みの「質問 → Spark SQL」ペアが蓄積されており、
aidp-analyzing-data がゼロからSQLを生成する前に再利用します。
これは、最も高い信頼性を持つNL-to-SQLメカニズムです。
誤った検証済みクエリは、精度を悪化させます。
verified: true に設定する前に、以下の条件をすべて満たす必要があります。
scripts/aidp_sql.py ヘルパー経由で実行)いずれかのチェックが失敗した場合は verified: false(DRAFT)のままにし、理由を記録してください。
失敗したペアを自動的に昇格させてはなりません。
候補となる質問とSQL(または aidp-analyzing-data で最後に実行されたクエリ)を読み込む。
.aidp/semantic.md の論理名を優先し、参照する物理テーブルを記録する。
同梱ヘルパーを使ってSQLをクラスター上で実行し、検証する(MCP不要):
python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region <region> --datalake <DATALAKE_OCID> --workspace <ws> --cluster <cluster-key> \
--code "spark.sql('''<your SELECT … LIMIT 50>''').show(50, truncate=False)"
このスクリプトは、api_key の DEFAULT プロファイルから UPST を生成し、
スクラッチノートブックを自動作成して、{status, outputs, spark_job_ids} 形式のJSONを返します。
status == "ok" であること、かつ質問に回答する結果が得られることを確認してください。
検証コストを抑えるため、件数を絞ったサンプル(LIMIT を付加)で実行してください。
所定のフォーマットに従いエントリを .aidp/verified-queries.md に追記する。
verified: true は、実行成功が記録されている場合のみ設定すること(クラスターと日付を明記)。
再利用時、aidp-analyzing-data は質問の類似度とテーブルの重複度でマッチングし、
日付・バインド値のみを適宜調整して使用する。
.aidp/verified-queries.md はユーザーが編集可能で、gitの管理対象外です(プロジェクトごとに設定)。scripts/aidp_sql.py を通じて実行され、
MCPサーバーは不要です。aidp MCPが設定されている場合は nb_execute_code を
アクセラレーターとして使用してもかまいませんが、必須ではありません。scripts/aidp_sql.py を使ったMCP不要のSQL実行)aidp-verified-queries — the verified-query repository (VQR)Maintain .aidp/verified-queries.md: validated question → Spark SQL pairs that aidp-analyzing-data
reuses before generating SQL from scratch — the highest-reliability NL-to-SQL mechanism.
A wrong verified query makes accuracy worse. Before setting verified: true, the pair MUST:
scripts/aidp_sql.py helper),verified: false (DRAFT) and explain why — never auto-promote a failing pair.aidp-analyzing-data)..aidp/semantic.md; record the physical tables touched.python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region <region> --datalake <DATALAKE_OCID> --workspace <ws> --cluster <cluster-key> \
--code "spark.sql('''<your SELECT … LIMIT 50>''').show(50, truncate=False)"
It mints a UPST from the api_key DEFAULT profile, auto-creates a scratch notebook, and returns JSON
{status, outputs, spark_job_ids}. Require status == "ok" and a result that answers the question.
Run on a bounded sample (add LIMIT) to keep validation cheap..aidp/verified-queries.md in the documented format; set verified: true only on
a recorded successful run (note cluster + date).aidp-analyzing-data matches by question similarity + table overlap and adapts only
dates/bind values..aidp/verified-queries.md is user-editable and git-ignored (per-project).scripts/aidp_sql.py, not any MCP server. If an
aidp MCP happens to be configured you may use its nb_execute_code as an accelerator, but it is not
required.scripts/aidp_sql.py)原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。