From pcore
Write Google BigQuery integration code — read/write DataFrames, schema management, partitioning, Parquet uploads, cost optimization. Triggers when: bigquery, google cloud, GCP, bq, data warehouse, "upload to bigquery", "query bigquery", "load parquet to bigquery", partitioned table, clustering.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pcore:bigqueryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill guides writing correct BigQuery integration code for storing and
This skill guides writing correct BigQuery integration code for storing and querying backtesting results at scale.
Docs URL: https://cloud.google.com/bigquery/docs
# Install Python client
uv add "google-cloud-bigquery[pandas]>=3.0" "google-cloud-bigquery-storage>=2.0"
# Authenticate (one-time)
gcloud auth application-default login
# OR set a service account key
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
from google.cloud import bigquery
import pandas as pd
client = bigquery.Client(project="my-project")
# Simple write
job = client.load_table_from_dataframe(
df, "project.dataset.backtest_results",
job_config=bigquery.LoadJobConfig(
write_disposition="WRITE_APPEND",
),
)
job.result() # wait for completion
job_config = bigquery.LoadJobConfig(
schema=[
bigquery.SchemaField("symbol", "STRING", mode="REQUIRED"),
bigquery.SchemaField("date", "DATE", mode="REQUIRED"),
bigquery.SchemaField("strategy", "STRING"),
bigquery.SchemaField("sharpe", "FLOAT64"),
bigquery.SchemaField("total_return_pct", "FLOAT64"),
bigquery.SchemaField("max_dd_pct", "FLOAT64"),
bigquery.SchemaField("params", "JSON"),
],
time_partitioning=bigquery.TimePartitioning(
type_=bigquery.TimePartitioningType.DAY,
field="date",
),
clustering_fields=["symbol", "strategy"],
write_disposition="WRITE_APPEND",
)
# Most efficient for large datasets — bypass DataFrame conversion
with open("results.parquet", "rb") as f:
job = client.load_table_from_file(
f, "project.dataset.results",
job_config=bigquery.LoadJobConfig(
source_format=bigquery.SourceFormat.PARQUET,
write_disposition="WRITE_APPEND",
),
)
job.result()
query = """
SELECT symbol, strategy, AVG(sharpe) as avg_sharpe
FROM `project.dataset.backtest_results`
WHERE date >= '2024-01-01'
GROUP BY symbol, strategy
ORDER BY avg_sharpe DESC
LIMIT 20
"""
df = client.query(query).to_dataframe()
time_partitioning=bigquery.TimePartitioning(
expiration_ms=90 * 24 * 60 * 60 * 1000, # 90-day TTL
)
npx claudepluginhub petercool/pcore --plugin pcoreGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.