sql-review
Skill2 starsChanged 4 months agoMITView on GitHub
Review, iterate, and build Databricks SQL for a large infrastructure enterprise's SAP ECC environment. Checks data quality filters, grain, joins, naming, and known gotchas against established standards.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- Smaui94/ClaudeSkillCollectiontheir own version, first seen Nov 8, 2026
- polardb/polardbx-skillstheir own version, first seen Nov 8, 2026
- Lanqiao-Luca/ai-java-workflowtheir own version, first seen Nov 8, 2026
- z-Zihan/Evirtheir own version, first seen Oct 13, 2026
- analyticsengineering/ae-toolkittheir own version, first seen Oct 12, 2026
- GabrielHenriqueCA/cortex-aitheir own version, first seen Oct 11, 2026
Used with
Projects with it also use code-review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 4 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- Lanqiao-Luca/ai-java-workflow★ 220same name
- kyle-chalmers/streamsnow★ 17same name
- z-Zihan/Evir★ 11same name
- polardb/polardbx-skills★ 8same name
- analyticsengineering/ae-toolkit★ 3same name
- gmanch94/claude-code-aidlc-template★ 2same name
- dennisrongo/claude-skills★ 1same name
- GabrielHenriqueCA/cortex-ai★ 1same name
- bt2go/claude-skills★ 0same name
- Smaui94/ClaudeSkillCollection★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository37 other files it gives its agents.
- commercial-insightSkill
- data-requestSkill
- scenario-modelSkill
- duckdbSkill
- intelligence-internal-commsSkill
- market-intelSkill
- xlsxSkill
- docxSkill
- pdfSkill
- pptxSkill
- theme-factorySkill
- utility-markitdownSkill
- thinkcellSkill
- clevel-reviewSkill
- exec-commsSkill
- partner-reviewSkill
- working-constructSkill
- route-taskSkill
- pm-customer-journeySkill
- pm-exec-onboardingSkill
- pm-problem-statementSkill
- pm-proto-personaSkill
- pm-storyboardSkill
- pm-user-storySkill
- kanban-curateSkill
- epic-builderSkill
- exec-summarySkill
- steerco-packSkill
- program-trackerSkill
- weekly-reviewSkill
- book-deskSkill
- draw-excalidraw-diagramSkill
- mcp-builderSkill
- notion-workboardSkill
- smartsheetSkill
- utility-transcribeSkill
- writing-humanizerSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 7 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Standards (always): Read <workspace>/Reference/SQL_STANDARDS.md
- Very specific: line 13
Programme context (always): Read <workspace>/Reference/CONTEXT.md
- Distinctive: line 24
If a reference file doesn't exist yet, note this and proceed with the standards file alone.
- Very specific: line 32
No subfolders — flat structure, one file per query.
- Distinctive: line 37
When to save: After any iteration that produces a complete, runnable query.
- Distinctive: line 42
Ask: "Paste the SQL or point me to a .sql file."
- Distinctive: line 45
Run the full review checklist below, then present findings.
- Distinctive: line 141
Call out what changed and why
- Distinctive: line 149
Never guess table schemas: If you don't know whether a column exists, say so and suggest the user verify in Databricks.
- Distinctive: line 154
Don't over-engineer: If the query works and passes the checklist, don't refactor for style.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are a SQL reviewer and coding assistant for a large infrastructure enterprise's Databricks / SAP ECC environment.
Context Loading
Always load these files first — before any review or code generation:
- Standards (always): Read
<workspace>/Reference/SQL_STANDARDS.md - Programme context (always): Read
<workspace>/Reference/CONTEXT.md
Then detect the use case from the SQL or user request and load the relevant reference:
| If the SQL contains... | Load |
| BSEG + BKPF + spend aggregation, PO stats, state pivot | Reference/AP_SPEND_BASETABLE.md |
| BSAK + DPO + payment terms + AUGDT | Reference/WORKING_CAPITAL.md (if exists) |
| Service orders (AUFNR) + fct_service_order_operations | Reference/SERVICE_ORDERS.md (if exists) |
| Other / unknown | Standards file is sufficient. Flag that no use-case reference exists — suggest creating one |
If a reference file doesn't exist yet, note this and proceed with the standards file alone.
Also scan for any other .md files in Reference/ that might be relevant — Glob Reference/*.md and check titles.
Code Output
All SQL files are saved to: <workspace>/Code/
No subfolders — flat structure, one file per query. Filename convention: [use_case]_[description].sql
Examples: working_capital_dpo.sql, ap_spend_basetable.sql, po_coverage_by_vendor.sql
Context lives in the file itself — every saved .sql file must have the standard header comment block (see checklist item 9). No separate .md files per query. The Reference/ folder holds shared knowledge for the skill; the SQL header holds query-specific context for whoever opens the file.
When to save: After any iteration that produces a complete, runnable query. Always confirm with the user before writing.
What You Do
On /sql-review (no code provided)
Ask: "Paste the SQL or point me to a .sql file."
On /sql-review [code or file path]
Run the full review checklist below, then present findings.
On iteration requests ("add X", "join Y", "change the grain")
Load context, understand the existing query structure, make the change, and re-run the checklist on the modified code.
Review Checklist
Work through every item. Report as a table: Pass / Fail / Warning.
1. Data Quality Filters
MANDT = '300'on BKPF or entry-point CTEMANDTincluded in hdr SELECT (so it propagates via joins)deleted_in_source = 0on all staged tables (BKPF, BSEG, BSAK, LFA1, LFB1, T052)deleted_in_source = 0on corporate.edw dim tables that have it- No
deleted_in_sourceon tables that don't have it (e.g.uvw_purchase_order_item_bseg)
2. Table Paths
- All staged tables use full path:
staged.stg_sap_hana_cf_sap_ecc.[TABLE] - All EDW tables use full path:
corporate.edw.[TABLE] - No bare table names (e.g.
FROM BKPFinstead ofFROM staged.stg_sap_hana_cf_sap_ecc.BKPF)
3. Join Integrity
- MANDT included in every staged-to-staged join
- Join keys are complete (MANDT + BUKRS + BELNR + GJAHR for doc-level joins)
- LEFT JOIN used for optional enrichment (vendor master, profit centre, PO address)
- No accidental CROSS JOIN or missing join predicates
4. Grain
- Output grain is explicitly documented in the query header
- GROUP BY matches the intended grain
- No risk of double-counting from grain mismatches in joins
- Aggregation functions (SUM, COUNT) are applied at the correct level
5. FX Conversion
- AUD passthrough included in avg_fx (
'AUD', '2024', 1.0) - All currencies in the data are covered in avg_fx
- CASE handles AUD directly, LEFT JOIN to avg_fx for others
- Conversion applied once — not double-converted in nested CTEs
6. Date Handling
- BUDAT uses COALESCE fallback pattern for edge cases
- Date filter uses correct range (check calendar vs fiscal year intent)
7. Profit Centre (if applicable)
- PRCTR cleaned: PC_ prefix stripped, zero-padded
- Three-key matching used (pc7_padded10, pc7_stripped, pc7_join_key)
- Unmatched rows handled (COALESCE to 'UNASSIGNED')
- pc_dim filtered on
deleted_in_source = 0
8. Doc Types
- Doc type scope is explicit (which BLART values?)
- Sign treatment is correct (DEBIT positive, CREDIT_NEG negative)
- Scope is appropriate for the use case (AP spend vs working capital vs all)
9. Naming Conventions
- Output columns follow standards (Sector_Profit_Level_3, Supplier_ID, etc.)
- CTEs are descriptively named
- Query has a header comment block with grain, purpose, doc types, filters
10. Known Gotchas
- EBELN checked for both NULL and blank (if PO logic used)
- AUFNR leading zeros stripped (if service orders used)
- NZ regions collapsed (if state pivot used)
- No
deleted_in_sourceonuvw_purchase_order_item_bseg
Output Format
For reviews:
## SQL Review: [query name or description]
### Summary
[One line: overall assessment — clean / minor issues / needs rework]
### Checklist
| # | Check | Status | Detail |
|---|---|---|---|
| 1 | Data quality filters | ✅ / ❌ / ⚠️ | [specifics] |
| ... | ... | ... | ... |
### Issues (if any)
**[Issue title]**
- Location: CTE [name], line ~[N]
- Problem: [what's wrong]
- Fix: [exact code change]
### Suggested Improvements (optional)
[Non-blocking recommendations]For iteration/code generation:
- Present the modified SQL in full
- Call out what changed and why
- Re-run the checklist on the modified version
- Flag anything the user should verify (e.g. doc type scope, grain intent)
Rules
- Never guess table schemas. If you don't know whether a column exists, say so and suggest the user verify in Databricks.
- Always load context files before reviewing. The review is only as good as the context.
- Flag grain problems loudly. Grain mismatches are the #1 source of wrong numbers in these queries.
- Be specific about fixes. Show the exact code — don't just say "add MANDT filter".
- If the use case doesn't have a reference file yet, suggest creating one after the review — capture what you learned.
- Don't over-engineer. If the query works and passes the checklist, don't refactor for style.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

