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انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“كم عميلًا جديدًا حصلنا عليه كل شهر في العام الماضي، حسب المنطقة؟ أرني الاستعلام والجدول.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تعيد هذه المهارة صياغة السؤال كمقياس مع تجميع ونافذة زمنية وفلتر. ثم تكتب SQL وتشغّله، وتتحقق من أن عدد الصفوف والقيم منطقيان، وتعرض الجدول مع الاستعلام.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من 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.
الأسئلة الشائعة
هل تخمّن التفاصيل الناقصة؟
لا، إذا كان المقياس أو التجميع أو النافذة الزمنية أو الفلتر غير واضح، تسألك المهارة سؤالًا توضيحيًا واحدًا.
هل ستعرض الاستعلام؟
نعم، تعرض 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.
الشعبية
- نجوم GitHub
- 6.2k
- الترتيب
- #14391
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
agentscope-java
6.2kيساعد وكيلك على كتابة كود Java غير محجوب للوكلاء باستخدام AgentScope، وهو إطار متعدد الوكلاء مبني على Project Reactor.
data-report
6.2kيساعد وكيلك على تلخيص مجموعة بيانات في تقرير يتضمن المتوسطات والمجاميع والمدى والاتجاهات، ويحفظه كملف Markdown.
data-transform
6.2kيساعد وكيلك على تحويل ملف بيانات بين صيغ مثل CSV وJSON، حتى تصبح البيانات قابلة للاستخدام في أدوات أخرى.
git-changelog
6.2kيساعد وكيلك على كتابة سجل التغييرات أو ملاحظات الإصدار من تاريخ Git، مرتبة في ميزات وإصلاحات وتغييرات أخرى.
مهارات مشابهة
discrawl
394kيتيح لوكيلك البحث في أرشيف محلي محفوظ لرسائل Discord وتلخيصه، والتحقق من مدى حداثته، وقراءة الرسائل المباشرة.
clickhouse-io
280kيساعد وكيلك على تحسين الاستعلامات والمخططات في ClickHouse وتطبيق أفضل ممارسات التحليل عالي الأداء، ويفيد عندما تكون الاستعلامات التحليلية بطيئة.
scientific-db-pubmed-database
280kيساعد وكيلك على البحث عن المقالات العلمية في المجال الطبي الحيوي. مفيد للبحوث التي تحتاج إلى معلومات طبية محددة.