sql-analysis
できること
業務の質問を、確認済みのSQLクエリと小さな結果の表に変えます。クエリを自分で書かずにデータベースの数字がほしいアナリストやマネージャー向けです。
使う場面
- ✓データベースで、いくつか、傾向、上位の項目を知りたいとき。
- ✓データを使って、2つのグループや2つの期間を比べたいとき。
- ✓結果を、それを生んだクエリとともに表で見たいとき。
スキルのリンク
https://github.com/agentscope-ai/agentscope-java/blob/main/agentscope-examples/agents/agentscope-dataagent/src/main/resources/shared/agents/data-agent/skills/sql-analysis/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“去年、毎月の新規顧客数を地域ごとに知りたいです。クエリと表を見せてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、質問を指標、グループ分け、期間、絞り込みに言い換えます。SQLを下書きして実行し、行数と値が妥当かを確認してから、結果の表をクエリとともに報告します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
SQL Analysis Skill
Repeatable SOP for turning a business question into a verifiable SQL answer.
Steps
Restate the question as a metric. In one sentence, write: "<metric> by <grouping> over <time window>, filtered by <filter>". If any of those four (metric / grouping / window / filter) is missing or ambiguous, ask one clarifying question and stop. Do not guess.
Locate the source. Decide where the data lives:
- Look in
knowledge/first for any schema notes, data-dictionary entries, or prior query examples uploaded by the user. - If the right table is not obvious, delegate to the
data-explorersub-agent with the metric definition as the prompt — its job is to identify the canonical source.
- Look in
Draft the query. Write the SQL in a fenced
sqlblock. Conventions:- Always include the time window in a
WHEREclause — never query the full history "just in case". - Always
SELECTan explicit column list — neverSELECT *in an answer. - Use CTEs (
WITH x AS (...)) over nested subqueries for anything beyond two levels of nesting. - Comment any non-obvious filter (
-- excludes internal test accounts).
- Always include the time window in a
Validate before reporting. Run the query and check:
- Row count is in the ballpark you expected (1 row, 10 rows, ~30 daily buckets, etc.). A surprising row count is almost always a bug — investigate.
- No
NULLs in the grouping column unless that is the intended cohort. - At least one numeric sanity check: a known total, a known reference value, or a min/max range that matches reality.
- If anything looks off, do not report the number — fix the query first.
Write the report. Use this exact structure:
## Answer <one-sentence direct answer with the headline number(s)> ## Result <small markdown table — at most ~15 rows; for longer results, summarise and offer to render a chart or attach the full CSV> ## Query ```sql <the exact query you ran>Sources & validation
- Table(s):
schema.table_name(row count, freshness if known) - Validation: <which sanity checks you ran and the result>
- Caveats: <known data quality issues, missing dates, etc.>
- Table(s):
Anti-patterns
- ❌ Reporting a number without the query that produced it.
- ❌ Using
LIMIT Nto "make the output fit" without explaining what got cut. - ❌ Reading a single row and reporting it as a trend.
- ❌ Inventing a table or column name. If unsure, delegate to
data-explorer.
When to delegate
- The user's question requires probing several candidate tables / sources
before any query can be written → spawn
data-explorer. - The user wants a polished written deliverable summarising several analyses
(e.g. "weekly health report") → spawn
report-writerafter you have the underlying numbers ready.
よくある質問
足りない詳細を推測しますか?
いいえ。指標、グループ分け、期間、絞り込みが不明確な場合、スキルは明確にするための質問を一つ尋ねます。
クエリは見せてもらえますか?
はい。SQLを結果の表と一緒に示します。
答えは確認されますか?
はい。報告する前に、行数と値が妥当かを確認します。
詳細
作者による元の説明
Answer a quantitative business question by writing a SQL query against the data warehouse, validating it, and presenting the result. Use when the user asks "how many...", "what's the trend of...", "compare X vs Y over...", "what's our top N...", or anything that resolves to a query against tabular data. Produces a small result table plus the underlying query.
人気
- GitHubのスター
- 6.2k
- ランキング
- #14391
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agentscope-java
6.2kProject Reactorの上に構築されたマルチエージェントフレームワークAgentScopeのために、ノンブロッキングなJavaコードを書くのを支援します。
data-report
6.2kデータセットを、平均、合計、範囲、傾向を含むレポートに要約し、Markdownファイルとして保存するのを支援します。
data-transform
6.2kCSVやJSONなどのデータファイルを形式間で変換し、他のツールで使えるようにするのを支援します。
git-changelog
6.2kGitの履歴から変更履歴やリリースノートを書き、機能、修正、その他の変更にまとめるのを支援します。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。