Agent skill

bigquery

Instructions for querying Google BigQuery using the bq command-line tool. Useful for running SQL queries, exploring datasets, and exporting results.

Stars 16
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/sourcegraph/amp-contrib/tree/main/bigquery

SKILL.md

BigQuery Skill

This skill enables you to query Google BigQuery using the bq command-line tool.

Authentication is already configured. The default project is project_id.

Use the project_id_exploration dataset as scratch space for temporary tables and experimentation.

The public dataset contains tables synced from the production Postgres database.

1. Explore Available Datasets

List datasets in the current project (defaults to project_id):

bash
bq ls

List datasets in a specific project:

bash
bq ls --project_id=PROJECT_ID

List tables in a dataset:

bash
bq ls PROJECT_ID:DATASET_NAME

Get table schema:

bash
bq show --schema --format=prettyjson PROJECT_ID:DATASET_NAME.TABLE_NAME

2. Run Queries

Run a simple query:

bash
bq query --use_legacy_sql=false 'SELECT * FROM `project.dataset.table` LIMIT 10'

Run a query with formatted output:

bash
bq query --use_legacy_sql=false --format=prettyjson 'YOUR_QUERY'

Run a query and save to a destination table:

bash
bq query --use_legacy_sql=false --destination_table=PROJECT:DATASET.NEW_TABLE 'YOUR_QUERY'

Run a dry run to estimate costs:

bash
bq query --use_legacy_sql=false --dry_run 'YOUR_QUERY'

3. Export Results

Export to CSV:

bash
bq query --use_legacy_sql=false --format=csv 'YOUR_QUERY' > results.csv

4. Best Practices

  • Always use --use_legacy_sql=false for standard SQL syntax
  • Use LIMIT clauses when exploring data to reduce costs
  • Use --dry_run to estimate query costs before running expensive queries
  • Use backticks around table references: `project.dataset.table`

5. Common Patterns

Preview table data:

bash
bq head -n 10 PROJECT:DATASET.TABLE

Get table info (row count, size):

bash
bq show --format=prettyjson PROJECT:DATASET.TABLE

Query with parameters:

bash
bq query --use_legacy_sql=false --parameter='name:STRING:value' 'SELECT * FROM `table` WHERE col = @name'

Expand your agent's capabilities with these related and highly-rated skills.

sourcegraph/amp-contrib

web-browser

Allows to interact with web pages by performing actions such as clicking buttons, filling out forms, and navigating links. It works by remote controlling Google Chrome or Chromium browsers using the Chrome DevTools Protocol (CDP). When Claude needs to browse the web, it can use this skill to do so.

16 0
Explore
mattpocock/skills

git-guardrails-claude-code

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

111,310 9,758
Explore
mattpocock/skills

obsidian-vault

Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.

111,310 9,758
Explore
mattpocock/skills

scaffold-exercises

Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.

111,310 9,758
Explore
mattpocock/skills

edit-article

Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.

111,310 9,758
Explore
mattpocock/skills

setup-pre-commit

Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.

111,310 9,758
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results