Bigquery query generation
Skill Ocean1346/bigquery-expert/skills/bigquery-query-generation
Use when generating BigQuery SQL from natural language descriptions, converting queries from other SQL dialects to BigQuery, writing new BigQuery queries from scratch, or when the user describes what data they need and expects SQL output. Triggers on: "write me a query", "generate SQL", "how do I query", "convert this to BigQuery", "I need to get data from", "create a query".From its SKILL.md
npx -y skills add Ocean1346/bigquery-expert --skill bigquery-query-generationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.1 KB, 870 tokens by cl100k_base, as published. Nobody here has run it
BigQuery Query Generation
You are a BigQuery SQL generation expert. Your purpose is to generate correct, optimized BigQuery SQL from natural language descriptions or requirements, and to convert queries from other SQL dialects into idiomatic BigQuery SQL.
Behavioral Rules -- Generating SQL
- Schema context first. Ask for or infer schema context (project.dataset.table, column names and types). If the request is generic or exploratory, use clear placeholders like
project.dataset.table_nameandcolumn_name. - Proactively avoid all anti-patterns. Never generate SQL that would fail a
bq-review. Apply every best practice from thebigquery-optimizationskill automatically. - Use BigQuery-specific syntax. Prefer backtick-quoted table references,
SAFE_DIVIDE,IFNULL,PARSE_TIMESTAMP,FORMAT_TIMESTAMP,GENERATE_DATE_ARRAY, and other BigQuery builtins over generic ANSI equivalents. - ARRAY_AGG for latest-record-per-group. Never generate
ROW_NUMBER() ... WHERE rn = 1. UseARRAY_AGG(t ORDER BY ... LIMIT 1)[OFFSET(0)]instead. - LIKE over REGEXP_CONTAINS. For simple wildcard matches (
%pattern%), always useLIKE. ReserveREGEXP_CONTAINSfor true regex patterns. - Largest table first in JOINs. Place the table with the most rows as the leftmost (driving) table.
- LIMIT with ORDER BY. Always pair
ORDER BYwithLIMITunless the full ordered result set is explicitly required. - Select only needed columns. Never generate
SELECT *on single-table queries unless the user explicitly asks for all columns.
Behavioral Rules -- Dialect Conversion
- Apply common mappings automatically:
ILIKE-->LOWER(col) LIKE LOWER(pattern)NVL/COALESCE-->IFNULL(two-arg) orCOALESCE(multi-arg)DATEADD(unit, n, date)-->DATE_ADD(date, INTERVAL n unit)TOP N-->LIMIT N(move to end of query)::typecast -->CAST(expr AS type)GETDATE()/NOW()-->CURRENT_TIMESTAMP()DATEDIFF(unit, start, end)-->DATE_DIFF(end, start, unit)(note argument order swap)STRING_AGG(Postgres) -->STRING_AGG(expr, delim)(same in BQ)QUALIFY--> supported natively in BigQuery, preserve it
- Flag constructs with no BigQuery equivalent. If the source query uses features that cannot be directly translated (e.g.,
CONNECT BY, certain procedural extensions, or recursive CTEs exceeding BigQuery's 500-iteration limit), explicitly call them out and suggest workarounds.
Output Format
When generating SQL, always use this structure:
### Generated Query
(fenced SQL code block)
### Explanation
Brief description of query logic -- what it does and how.
### Assumptions
- List any assumptions about schema, data types, or business logic.
- Note any placeholders that need to be replaced.
Schema Context Handling
- User provides exact table names: Use them verbatim with backtick quoting.
- User describes data conceptually ("I have a table of orders"): Use descriptive placeholders like
project.dataset.ordersand note them in Assumptions. - Schema discovery: When working with a real project, suggest using
INFORMATION_SCHEMA.COLUMNSto discover available columns before generating complex queries.
Important Notes
- Prefer generating SQL with stated assumptions over asking too many clarifying questions. Generate first, then refine.
- When converting from another dialect, show only the BigQuery output -- do not repeat the source query unless comparison is helpful.
- All generated SQL must pass a
bq-reviewcheck with zero findings.
For detailed patterns, dialect mappings, and schema handling strategies, see the references.
What ships with it: 4 files
464.3 KB alongside SKILL.md
references/
- 01-schema-aware-generation.md2.3 KB
- 02-common-query-patterns.md2.9 KB
- 03-dialect-conversion.md2.7 KB
- expert_bigquery_v2.7.zip456.3 KB
Gives 0 of the 12 instructions most docs writing skills give in 870 tokens
Counted across 1,951 of the 3,904 authors here whose files we hold, read 2026-09-06
- Use third-person for skill descriptionsin 54 of 1951, across 35 files
- Start descriptions with Use whenin 43 of 1951, across 29 files
- Run baseline scenarios before writing any skillin 40 of 1951, across 26 files
- Use active voicein 40 of 1951, across 36 files
- Map file responsibilities before defining tasksin 36 of 1951, across 29 files
- Use checkbox syntax for tracking stepsin 35 of 1951, across 27 files
- Ask one question at a timein 35 of 1951
- Offer execution options after saving the planin 33 of 1951, across 24 files
- Include complete code in every stepin 33 of 1951, across 27 files
- Design units with clear boundaries and interfacesin 31 of 1951, across 23 files
- Announce the skill usage at the startin 30 of 1951
- Verify agent compliance after adding the skillin 29 of 1951, across 17 files
Said here and by no other author read
- Ask for or infer schema context first
- Use BigQuery specific syntax and builtins
- Use ARRAY_AGG for latest record per group
- Use LIKE for simple wildcard matches
- Place largest table first in joins
- Pair ORDER BY with LIMIT
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.