sql-analysis
Qué hace
Esta skill convierte una pregunta de negocio en una consulta SQL comprobada y en una tabla de resultados pequeña. Está pensada para analistas y responsables que necesitan cifras de una base de datos sin escribir la consulta ellos mismos.
Cuándo usarla
- ✓Cuando preguntas cuántos, cuál es la tendencia o cuáles son los elementos principales de una base de datos.
- ✓Cuando quieres comparar dos grupos o dos periodos de tiempo con los datos.
- ✓Cuando necesitas una tabla de resultados junto con la consulta que la produjo.
Link de la 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.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Cuántos clientes nuevos tuvimos cada mes del año pasado, por región? Muéstrame la consulta y la tabla.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La skill replantea la pregunta como una métrica con una agrupación, un periodo de tiempo y un filtro. Redacta el SQL, lo ejecuta, comprueba que el número de filas y los resultados tienen sentido y, después, muestra la tabla con la consulta.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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.
Preguntas frecuentes
¿Adivina los detalles que faltan?
No. Si la métrica, la agrupación, el periodo o el filtro no están claros, la skill hace una pregunta de aclaración.
¿Muestra la consulta?
Sí, presenta el SQL junto con la tabla de resultados.
¿Comprueba la respuesta?
Sí, comprueba que el número de filas y los valores parecen razonables antes de dar el resultado.
Detalles
Descripción original del 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.
Popularidad
- Estrellas en GitHub
- 6,2 mil
- Posición en el ranking
- #14391
- Licencia
- Apache-2.0
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
agentscope-java
6,2 milAyuda a tu agente a escribir código Java no bloqueante para AgentScope, un framework multiagente construido sobre Project Reactor.
data-report
6,2 milAyuda a tu agente a resumir un conjunto de datos en un informe con medias, totales, rangos y tendencias, guardado como archivo Markdown.
data-transform
6,2 milAyuda a tu agente a convertir un archivo de datos entre formatos como CSV y JSON, para que los datos se puedan usar en otras herramientas.
git-changelog
6,2 milAyuda a tu agente a escribir un registro de cambios o notas de versión a partir del historial de Git, agrupado en novedades, correcciones y otros cambios.
Skills parecidas
discrawl
394 milPermite que tu agente busque y resuma un archivo local guardado de mensajes de Discord, revise qué tan actual es y lea mensajes directos.
clickhouse-io
280 milAyuda a tu agente a optimizar consultas y esquemas en ClickHouse con buenas prácticas para cargas analíticas de alto rendimiento. Úsalo si las consultas son muy lentas.
scientific-db-pubmed-database
280 milAyuda a tu agente a buscar artículos científicos del ámbito biomédico. Es útil para investigaciones que necesitan información médica específica.