본문으로 건너뛰기
Skillpedia
데이터베이스6.2k · #14391

sql-analysis

하는 일

이 스킬은 비즈니스 질문을 검증된 SQL 쿼리와 작은 결과 표로 바꿉니다. 쿼리를 직접 쓰지 않고 데이터베이스에서 숫자를 얻고 싶은 분석가와 관리자를 위한 스킬입니다.

사용하는 경우

  • ✓데이터베이스에서 얼마나 되는지, 추세가 어떤지, 상위 항목이 무엇인지 물을 때.
  • ✓데이터를 이용해 두 그룹이나 두 기간을 비교하고 싶을 때.
  • ✓결과를 만든 쿼리와 함께 결과 표가 필요할 때.

스킬 링크

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: 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 Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“지난해 매월 신규 고객이 지역별로 몇 명이었는지 알려 주세요. 쿼리와 표를 함께 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 질문을 지표, 그룹화, 시간 범위, 필터로 다시 정리합니다. SQL 초안을 작성해 실행하고, 행 수와 결과가 타당한지 확인한 뒤, 쿼리와 함께 결과 표를 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

빠진 세부 사항을 추측하나요?

아니요, 지표, 그룹화, 시간 범위, 필터가 불분명하면 스킬이 명확한 질문 하나를 합니다.

쿼리를 보여 주나요?

네, 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.

repo: agentscope-ai/agentscope-java

인기도

GitHub 스타
6.2k
순위
#14391
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬