Langsung ke konten
Skillpedia
Database6.2k Β· #14391

sql-analysis

Fungsinya

Skill ini mengubah pertanyaan bisnis menjadi kueri SQL yang sudah diperiksa dan tabel hasil yang ringkas. Skill ini untuk analis dan manajer yang membutuhkan angka dari database tanpa harus menulis kueri sendiri.

Kapan dipakai

  • βœ“Saat Anda bertanya berapa banyak, bagaimana tren, atau apa item teratas dalam sebuah database.
  • βœ“Saat Anda ingin membandingkan dua kelompok atau dua periode waktu menggunakan data.
  • βœ“Saat Anda membutuhkan tabel hasil beserta kueri yang menghasilkannya.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: 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 Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBerapa pelanggan baru yang kami dapatkan setiap bulan tahun lalu, per wilayah? Tampilkan kueri dan tabelnya.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menyusun ulang pertanyaan menjadi sebuah metrik dengan pengelompokan, rentang waktu, dan filter. Lalu skill menyusun SQL, menjalankannya, memeriksa apakah jumlah baris dan hasilnya masuk akal, lalu melaporkan tabel beserta kuerinya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

SQL Analysis Skill

Repeatable SOP for turning a business question into a verifiable SQL answer.

Steps

  1. 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.

  2. 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-explorer sub-agent with the metric definition as the prompt β€” its job is to identify the canonical source.
  3. Draft the query. Write the SQL in a fenced sql block. Conventions:

    • Always include the time window in a WHERE clause β€” never query the full history "just in case".
    • Always SELECT an explicit column list β€” never SELECT * 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).
  4. 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.
  5. 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.>
    
    

Anti-patterns

  • ❌ Reporting a number without the query that produced it.
  • ❌ Using LIMIT N to "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-writer after you have the underlying numbers ready.
Pertanyaan umum

Apakah skill menebak detail yang hilang?

Tidak. Jika metrik, pengelompokan, rentang waktu, atau filter belum jelas, skill akan mengajukan satu pertanyaan klarifikasi.

Apakah kueri akan ditampilkan?

Ya, SQL ditampilkan bersama tabel hasilnya.

Apakah jawabannya diperiksa?

Ya, jumlah baris dan nilainya diperiksa dulu agar masuk akal sebelum dilaporkan.

Detail

Deskripsi asli dari pembuat

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.

repo: agentscope-ai/agentscope-java

Popularitas

Bintang GitHub
6.2k
Peringkat
#14391
Lisensi
Apache-2.0
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa