query-writer

Write or update BigQuery SQL and Python ETL scripts following Mozilla conventions.

10|2|Updated Nov 6, 2025
One-click install
npx skills add https://github.com/mozilla/bigquery-etl-skills --skill query-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-writer
Source: https://github.com/mozilla/bigquery-etl-skills/tree/main/query-writer
Command: npx skills add https://github.com/mozilla/bigquery-etl-skills --skill query-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Writing and maintaining BigQuery SQL queries or Python ETL scripts that adhere to specific formatting, conventions, and testing requirements is a meticulous task. This skill automates the creation, updating, and validation of these queries, ensuring consistency and reducing manual effort.

Core Features & Use Cases

  • Automated Query Generation: Writes new query.sql or query.py files following Mozilla's BigQuery ETL conventions, including proper formatting, partitioning, and UDF usage.
  • Mandatory Test Management: Automatically checks for and updates existing unit tests (coordinating with sql-test-generator) whenever queries are modified, preventing regressions and ensuring data integrity.
  • Schema & Metadata Coordination: Integrates with metadata-manager to update schema.yaml and metadata.yaml files when query outputs change, maintaining consistent data definitions.
  • Validation & Formatting: Ensures queries are correctly formatted and validated against BigQuery ETL standards, making them ready for deployment.
  • Use Case: A developer needs to create a new BigQuery SQL query for a daily aggregation. They use this skill to generate the query.sql file, which then automatically triggers the creation of schema.yaml, metadata.yaml, and unit tests, all adhering to project standards.

Quick Start

Write a BigQuery SQL query to aggregate daily user activity from telemetry.events into my-project.my-dataset.daily_activity_v1. Ensure it uses @submission_date for incremental processing.

Frequently Asked Questions about query-writer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write BigQuery SQL queries that follow Mozilla ETL conventions?

BigQuery SQL queries should follow Mozilla's ETL conventions including proper formatting, partitioning, UDF usage, and incremental processing with @submission_date. This skill automates query generation, validation, and formatting to ensure compliance with project standards.

Can I automatically generate tests when I create or update a BigQuery query?

Yes, this skill automatically checks for and updates unit tests whenever queries are modified, coordinating with test generation tools to prevent regressions and maintain data integrity.

What happens to schema and metadata files when I modify a BigQuery ETL query?

When query outputs change, this skill integrates with metadata-manager to automatically update schema.yaml and metadata.yaml files, keeping data definitions consistent across your pipeline.

How do I set up incremental processing for a new BigQuery ETL workflow?

Create SQL or Python ETL scripts using this skill, which enforces incremental processing patterns and @submission_date partitioning for daily aggregations, with automatic schema and test generation.

Does this work with Python ETL scripts as well as SQL queries?

Yes, this skill writes and updates both query.sql files and query.py Python ETL scripts, applying the same formatting conventions, validation, and test coordination to both file types.

Why do I need to update tests when I modify a BigQuery query?

Updating tests when queries change prevents regressions and ensures data integrity. This skill mandates test updates alongside query modifications, coordinating through sql-test-generator to keep tests synchronized.