bigquery-pipeline-audit

Audits Python + BigQuery pipelines for cost safety, idempotency, and production readiness. Returns a structured report with exact patch locations.

25 stars

Best use case

bigquery-pipeline-audit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Audits Python + BigQuery pipelines for cost safety, idempotency, and production readiness. Returns a structured report with exact patch locations.

Teams using bigquery-pipeline-audit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/bigquery-pipeline-audit/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/github/awesome-copilot/bigquery-pipeline-audit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/bigquery-pipeline-audit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How bigquery-pipeline-audit Compares

Feature / Agentbigquery-pipeline-auditStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Audits Python + BigQuery pipelines for cost safety, idempotency, and production readiness. Returns a structured report with exact patch locations.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# BigQuery Pipeline Audit: Cost, Safety and Production Readiness

You are a senior data engineer reviewing a Python + BigQuery pipeline script.
Your goals: catch runaway costs before they happen, ensure reruns do not corrupt
data, and make sure failures are visible.

Analyze the codebase and respond in the structure below (A to F + Final).
Reference exact function names and line locations. Suggest minimal fixes, not
rewrites.

---

## A) COST EXPOSURE: What will actually get billed?

Locate every BigQuery job trigger (`client.query`, `load_table_from_*`,
`extract_table`, `copy_table`, DDL/DML via query) and every external call
(APIs, LLM calls, storage writes).

For each, answer:
- Is this inside a loop, retry block, or async gather?
- What is the realistic worst-case call count?
- For each `client.query`, is `QueryJobConfig.maximum_bytes_billed` set?
  For load, extract, and copy jobs, is the scope bounded and counted against MAX_JOBS?
- Is the same SQL and params being executed more than once in a single run?
  Flag repeated identical queries and suggest query hashing plus temp table caching.

**Flag immediately if:**
- Any BQ query runs once per date or once per entity in a loop
- Worst-case BQ job count exceeds 20
- `maximum_bytes_billed` is missing on any `client.query` call

---

## B) DRY RUN AND EXECUTION MODES

Verify a `--mode` flag exists with at least `dry_run` and `execute` options.

- `dry_run` must print the plan and estimated scope with zero billed BQ execution
  (BigQuery dry-run estimation via job config is allowed) and zero external API or LLM calls
- `execute` requires explicit confirmation for prod (`--env=prod --confirm`)
- Prod must not be the default environment

If missing, propose a minimal `argparse` patch with safe defaults.

---

## C) BACKFILL AND LOOP DESIGN

**Hard fail if:** the script runs one BQ query per date or per entity in a loop.

Check that date-range backfills use one of:
1. A single set-based query with `GENERATE_DATE_ARRAY`
2. A staging table loaded with all dates then one join query
3. Explicit chunks with a hard `MAX_CHUNKS` cap

Also check:
- Is the date range bounded by default (suggest 14 days max without `--override`)?
- If the script crashes mid-run, is it safe to re-run without double-writing?
- For backdated simulations, verify data is read from time-consistent snapshots
  (`FOR SYSTEM_TIME AS OF`, partitioned as-of tables, or dated snapshot tables).
  Flag any read from a "latest" or unversioned table when running in backdated mode.

Suggest a concrete rewrite if the current approach is row-by-row.

---

## D) QUERY SAFETY AND SCAN SIZE

For each query, check:
- **Partition filter** is on the raw column, not `DATE(ts)`, `CAST(...)`, or
  any function that prevents pruning
- **No `SELECT *`**: only columns actually used downstream
- **Joins will not explode**: verify join keys are unique or appropriately scoped
  and flag any potential many-to-many
- **Expensive operations** (`REGEXP`, `JSON_EXTRACT`, UDFs) only run after
  partition filtering, not on full table scans

Provide a specific SQL fix for any query that fails these checks.

---

## E) SAFE WRITES AND IDEMPOTENCY

Identify every write operation. Flag plain `INSERT`/append with no dedup logic.

Each write should use one of:
1. `MERGE` on a deterministic key (e.g., `entity_id + date + model_version`)
2. Write to a staging table scoped to the run, then swap or merge into final
3. Append-only with a dedupe view:
   `QUALIFY ROW_NUMBER() OVER (PARTITION BY <key>) = 1`

Also check:
- Will a re-run create duplicate rows?
- Is the write disposition (`WRITE_TRUNCATE` vs `WRITE_APPEND`) intentional
  and documented?
- Is `run_id` being used as part of the merge or dedupe key? If so, flag it.
  `run_id` should be stored as a metadata column, not as part of the uniqueness
  key, unless you explicitly want multi-run history.

State the recommended approach and the exact dedup key for this codebase.

---

## F) OBSERVABILITY: Can you debug a failure?

Verify:
- Failures raise exceptions and abort with no silent `except: pass` or warn-only
- Each BQ job logs: job ID, bytes processed or billed when available,
  slot milliseconds, and duration
- A run summary is logged or written at the end containing:
  `run_id, env, mode, date_range, tables written, total BQ jobs, total bytes`
- `run_id` is present and consistent across all log lines

If `run_id` is missing, propose a one-line fix:
`run_id = run_id or datetime.utcnow().strftime('%Y%m%dT%H%M%S')`

---

## Final

**1. PASS / FAIL** with specific reasons per section (A to F).
**2. Patch list** ordered by risk, referencing exact functions to change.
**3. If FAIL: Top 3 cost risks** with a rough worst-case estimate
(e.g., "loop over 90 dates x 3 retries = 270 BQ jobs").

Related Skills

vertex-ai-pipeline-creator

25
from ComeOnOliver/skillshub

Vertex Ai Pipeline Creator - Auto-activating skill for GCP Skills. Triggers on: vertex ai pipeline creator, vertex ai pipeline creator Part of the GCP Skills skill category.

assisting-with-soc2-audit-preparation

25
from ComeOnOliver/skillshub

This skill assists with SOC2 audit preparation by automating tasks related to evidence gathering and documentation. It leverages the soc2-audit-helper plugin to generate reports, identify potential compliance gaps, and suggest remediation steps. Use this skill when the user requests help with "SOC2 audit", "compliance check", "security controls", "audit preparation", or "evidence gathering" related to SOC2. It streamlines the initial stages of SOC2 compliance, focusing on automated data collection and preliminary analysis.

sklearn-pipeline-builder

25
from ComeOnOliver/skillshub

Sklearn Pipeline Builder - Auto-activating skill for ML Training. Triggers on: sklearn pipeline builder, sklearn pipeline builder Part of the ML Training skill category.

performing-security-audits

25
from ComeOnOliver/skillshub

This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.

preprocessing-data-with-automated-pipelines

25
from ComeOnOliver/skillshub

Process automate data cleaning, transformation, and validation for ML tasks. Use when requesting "preprocess data", "clean data", "ETL pipeline", or "data transformation". Trigger with relevant phrases based on skill purpose.

plugin-auditor

25
from ComeOnOliver/skillshub

Audit automatically audits AI assistant code plugins for security vulnerabilities, best practices, AI assistant.md compliance, and quality standards when user mentions audit plugin, security review, or best practices check. specific to AI assistant-code-plugins repositor... Use when assessing security or running audits. Trigger with phrases like 'security scan', 'audit', or 'vulnerability'.

pipeline-monitoring-setup

25
from ComeOnOliver/skillshub

Pipeline Monitoring Setup - Auto-activating skill for Data Pipelines. Triggers on: pipeline monitoring setup, pipeline monitoring setup Part of the Data Pipelines skill category.

orchestrating-deployment-pipelines

25
from ComeOnOliver/skillshub

Deploy use when you need to work with deployment and CI/CD. This skill provides deployment automation and orchestration with comprehensive guidance and automation. Trigger with phrases like "deploy application", "create pipeline", or "automate deployment".

jenkins-pipeline-intro

25
from ComeOnOliver/skillshub

Jenkins Pipeline Intro - Auto-activating skill for DevOps Basics. Triggers on: jenkins pipeline intro, jenkins pipeline intro Part of the DevOps Basics skill category.

implementing-database-audit-logging

25
from ComeOnOliver/skillshub

Process use when you need to track database changes for compliance and security monitoring. This skill implements audit logging using triggers, application-level logging, CDC, or native logs. Trigger with phrases like "implement database audit logging", "add audit trails", "track database changes", or "monitor database activity for compliance".

http-header-security-audit

25
from ComeOnOliver/skillshub

Http Header Security Audit - Auto-activating skill for Security Fundamentals. Triggers on: http header security audit, http header security audit Part of the Security Fundamentals skill category.

hipaa-audit-helper

25
from ComeOnOliver/skillshub

Hipaa Audit Helper - Auto-activating skill for Security Advanced. Triggers on: hipaa audit helper, hipaa audit helper Part of the Security Advanced skill category.