Zum Inhalt springen
Skillpedia
Datenbanken6.2k · #14391

sql-analysis

Was er macht

Dieser Skill macht aus einer Geschäftsfrage eine geprüfte SQL-Abfrage und eine kleine Ergebnistabelle. Er ist für Analysten und Manager gedacht, die Zahlen aus einer Datenbank brauchen, ohne die Abfrage selbst zu schreiben.

Wann du ihn nutzt

  • ✓Wenn du fragst, wie viele, welcher Trend oder welche Top-Einträge in einer Datenbank vorkommen.
  • ✓Wenn du zwei Gruppen oder zwei Zeiträume anhand der Daten vergleichen willst.
  • ✓Wenn du eine Ergebnistabelle zusammen mit der Abfrage brauchst, die sie erzeugt hat.

Link zum 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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: 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 Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wie viele neue Kunden hatten wir letztes Jahr jeden Monat, aufgeschlüsselt nach Region? Zeig mir die Abfrage und die Tabelle.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Skill formuliert die Frage als Kennzahl mit Gruppierung, Zeitfenster und Filter um. Er entwirft das SQL, führt es aus, prüft, ob Zeilenanzahl und Ergebnisse plausibel sind, und meldet dann die Tabelle mit der Abfrage.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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.
Häufige Fragen

Errät er fehlende Angaben?

Nein. Wenn Kennzahl, Gruppierung, Zeitfenster oder Filter unklar sind, stellt der Skill eine klärende Frage.

Zeigt er die Abfrage?

Ja, er zeigt das SQL zusammen mit der Ergebnistabelle.

Prüft er die Antwort?

Ja, er prüft, ob Zeilenanzahl und Werte sinnvoll aussehen, bevor er berichtet.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
6.2k
Platz im Ranking
#14391
Lizenz
Apache-2.0
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills