effective-dbt-sql
यह क्या करती है
यह स्किल सही और आसानी से पढ़े जाने वाले dbt मॉडल SQL लिखने के नियम देती है। यह उन analytics engineers के लिए है जो dbt मॉडल और मीट्रिक लिखते या बदलते हैं।
कब इस्तेमाल करें
- ✓जब आप dbt मॉडल के अंदर SQL लिखने वाले हैं।
- ✓जब आप किसी मीट्रिक की SQL परिभाषा बदलना चाहते हैं।
- ✓जब आप तय कर रहे हैं कि सबक्वेरी जोड़ें या मौजूदा फ़ील्ड दोबारा इस्तेमाल करें।
Skill का लिंक
https://github.com/lightdash/lightdash/blob/main/skills/effective-dbt-sql/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“subscriptions dbt मॉडल में एक चर्न रेट मीट्रिक जोड़िए, जिसमें मौजूदा फ़ील्ड दोबारा इस्तेमाल हों, तर्क दोहराने के बजाय।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल एजेंट को कहती है कि जब संभव हो तो मौजूदा फ़ील्ड दोबारा इस्तेमाल करे, ऐसी सबक्वेरी से बचे जो बाहरी हर पंक्ति पर निर्भर हों, और जटिल तर्क के लिए CTE को प्राथमिकता दे। वह यह भी कहती है कि रिपॉज़िटरी में पहले से इस्तेमाल हो रही शैली अपनाई जाए।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Effective dbt SQL
Write dbt model SQL that is correct, readable, and idiomatic. This skill is about the semantics of the SQL you write — not naming or formatting.
Scope
Use this when you are about to write or change SQL inside a dbt model (.sql), or a metric/dimension whose value is defined by SQL.
This skill covers semantics only. It does not prescribe naming schemes, file layout, or indentation. For those, follow the rule below.
Match the target repo first. These are fallback defaults, not mandates. Before applying any rule, read the models around the one you are changing and match the repo's established conventions where they differ. Apply these rules to new or changed SQL only — do not reformat, rename, or restructure existing code that already works.
The rules
Reuse before you re-derive. If the value you are asked for is already expressed by an existing dimension or metric — or by two of them combined — compose those fields instead of writing new SQL to recompute it. Read the model's existing dimensions/metrics before adding one. See reuse-over-subqueries.
No correlated subqueries. Never compute a value with a subquery that references the outer query's rows (a per-row correlated subquery in
SELECTorWHERE). Reuse an existing field, or join to an aggregated CTE instead. This is the single most common mistake. See cte-pipelines.CTEs over nested subqueries. Structure a query as a pipeline of named CTEs, each referenced by the next, ending in a final
select. Prefer this over subqueries nested insidefrom/where. See cte-pipelines.Explicit joins. Always state the join type (
inner/left/…) and theoncondition. Never comma-join. Know the grain: a join that fans out rows silently changes every downstream aggregate.Explicit columns. Select named columns rather than
select *when adding or changing what a model emits, so a change to an upstream model can't silently alter this model's output. (A pass-throughselect * from finalat the very end of a CTE pipeline is fine — the columns are already pinned by the CTEs.)Don't break references. Before editing a model's SQL, read the
source()/ref()models it selects from. Do not rename or remove a column that downstream models orschema.ymlreference without checking the impact first.
Not in scope
- Emitted-type / casting safety (e.g. boolean-vs-numeric column types): follow the warehouse skill the system prompt points you to (
/home/user/.lightdash-skills/). This skill does not restate casting rules. - Naming and formatting conventions: match the target repo (see the rule above).
अक्सर पूछे जाने वाले सवाल
क्या यह नामकरण या फ़ॉर्मेटिंग बदलती है?
नहीं, स्किल SQL के अर्थ को कवर करती है, नामों या लेआउट को नहीं।
क्या यह मौजूदा कोड दोबारा लिखेगी?
नहीं, स्किल केवल नए या बदले गए SQL पर लागू होती है और चलते कोड को दोबारा नहीं लिखती।
correlated subquery क्या है?
यह ऐसी सबक्वेरी है जो बाहरी क्वेरी की पंक्तियों का संदर्भ देती है, और स्किल इससे बचने को कहती है।
जानकारी
लेखक का मूल विवरण
Use when writing or modifying dbt model SQL — deciding whether to add a subquery or reuse an existing dimension/metric, structuring a query, joining models, or refactoring a metric's SQL. Encodes SQL semantic-correctness rules: reuse existing fields, prefer CTEs over correlated subqueries, and make joins and column lists explicit.
repo: lightdash/lightdash
लोकप्रियता
- GitHub स्टार
- 6.2k
- रैंकिंग में स्थान
- #14405
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
breakup-pr
6.2kआपके एजेंट को बड़े pull request को छोटे, एक के ऊपर एक जुड़े हिस्सों में बाँटने में मदद करती है, जिन्हें एक-एक करके रिव्यू और मर्ज किया जा सके।
lightdash-agent-slack-messaging
6.2kआपके एजेंट को Lightdash एडमिनिस्ट्रेटरों के लिए साफ़ और मित्रवत रखरखाव तथा गतिविधि रिपोर्ट लिखने में मदद करती है, केवल उपलब्ध सबूतों के आधार पर।
developing-in-lightdash
6.2kआपके एजेंट को Lightdash डैशबोर्ड और चार्ट को JSON के रूप में पढ़ने, बनाने और संपादित करने में मदद करती है, हर चार्ट प्रकार की सेटिंग के साथ।
filter-expressions
6.2kआपके एजेंट को Lightdash मीट्रिक क्वेरी के लिए सही फ़िल्टर एक्सप्रेशन लिखने में मदद करती है, जिनमें कस्टम मीट्रिक पर फ़िल्टर भी शामिल हैं।
मिलती-जुलती skills
discrawl
394kयह आपके एजेंट को Discord संदेशों के सेव किए गए स्थानीय आर्काइव में खोजने, उसका सारांश बनाने और उसकी ताज़गी जांचने में मदद करती है।
clickhouse-io
280kआपके एजेंट को ClickHouse databases में queries और schemas optimize करने में मदद करता है। high-performance analytical workloads के लिए best practices लागू करता है। जब analytical queries बहुत धीमी हों, तब इसका उपयोग करें।
scientific-db-pubmed-database
280kआपके एजेंट को बायोमेडिकल क्षेत्र के वैज्ञानिक लेख खोजने में मदद करता है। जिस रिसर्च में खास मेडिकल जानकारी चाहिए, उसके लिए यह काम का है।