Pular para o conteúdo
Skillpedia
Bancos de dados6,2 mil · #14391

sql-analysis

O que ela faz

Esta skill transforma uma pergunta de negócio em uma consulta SQL verificada e uma tabela de resultado pequena. É para analistas e gestores que precisam de números de um banco de dados sem escrever a consulta sozinhos.

Quando usar

  • ✓Quando você pergunta quantos, qual é a tendência ou quais são os itens principais em um banco de dados.
  • ✓Quando você quer comparar dois grupos ou dois períodos usando os dados.
  • ✓Quando você precisa de uma tabela de resultado junto com a consulta que a gerou.

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

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: 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 Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Quantos clientes novos tivemos a cada mês do ano passado, por região? Mostre a consulta e a tabela.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A skill reformula a pergunta como uma métrica com agrupamento, janela de tempo e filtro. Ela rascunha o SQL, executa a consulta, verifica se o número de linhas e os resultados fazem sentido e depois apresenta a tabela com a consulta.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do 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.
Perguntas frequentes

Ela adivinha detalhes que faltam?

Não, se a métrica, o agrupamento, a janela de tempo ou o filtro não estiverem claros, a skill faz uma pergunta de esclarecimento.

Ela mostra a consulta?

Sim, ela apresenta o SQL junto com a tabela de resultado.

Ela confere a resposta?

Sim, ela verifica se o número de linhas e os valores parecem razoáveis antes de informar.

Detalhes

Descrição original do autor

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

Popularidade

Estrelas no GitHub
6,2 mil
Posição no ranking
#14391
Licença
Apache-2.0
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas