本文へ移動
cccskills
無料GitHub で公開日本語紹介

bigquery

BigQueryの分析データをSQLで調べ、ページ閲覧や登録、契約、利用状況などの指標やユーザー行動を確認するためのクエリ作成を支援します。

原文原文の説明を見る

Query BigQuery for analytics events, signups, pageviews, subscriptions, and user data. Use this skill when the user asks about metrics, funnels, user activity, or customer usage data.

BuilderIO/agent-nativeスター 7,519(GitHub 7,519 + cccskills 0)
連携ツールHubSpotGoogle Cloud

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • 登録数や閲覧数を集計したいとき
  • ユーザーの利用ファネルを調べたいとき
  • 顧客ごとの利用状況を確認したいとき
  • 契約やサブスクリプションを分析したいとき

日本語での紹介

できること

BigQueryのデータをSQLで調べ、ページ閲覧、登録、分析イベント、契約、サブスクリプション、顧客利用状況などの質問に答えるためのクエリ作成を支援します。用途に応じたテーブルや列名、データセットの使い分け、重複の除去、日付型の扱い、テーブル間の結合方法を確認できます。ファネルや指標の集計、顧客に関連するイベントの検索なども対象です。資料には、誤った列名や結合による不一致を避けるための注意点や、分析イベントを絞り込む例も含まれています。

こんなときに便利

登録数やページ閲覧の推移を確認したいとき、ユーザーがどの段階で離脱するかを調べたいときに役立ちます。契約や利用状況を顧客単位で調査したい場合にも、参照するテーブルや結合条件を選ぶ手がかりになります。

使い方の例

  • 「直近の登録数と流入経路を集計してください」
  • 「顧客のAIチャット利用状況を調べてください」
  • 「アクティブな契約のARRを確認するクエリを作ってください」

注意点

BigQueryへの接続と認証が必要です。認証にはGOOGLE_APPLICATION_CREDENTIALS_JSONまたはApplication Default Credentialsを使い、対象プロジェクトはBIGQUERY_PROJECT_IDで指定します。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md12.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

BigQuery Integration

CRITICAL: BigQuery is a Native Agent Tool

bigquery is available directly in the agent's tool list as a native callable tool.

  • If you see bigquery in your available tools — call it directly with your SQL. Do not use HTTP workarounds, web-request hacks, or scripts as a substitute.
  • The server/lib/bigquery.ts description below is the underlying implementation. It does not mean BigQuery is only accessible via terminal commands or scripts.
  • When uncertain if the tool works, call it — don't reason your way to "it won't work". Empirically test by calling the tool.
  • Scripts (pnpm action) and the server lib are for dashboard UI code and CLI use. The agent calls BigQuery directly via its native tool.

Behavioral rule: "When uncertain if a tool works, call it — don't reason your way to 'it won't work'." Escalating to HTTP/web-request hacks before verifying the simple path fails is a bug in agent behavior.

Connection

  • Client: @google-cloud/bigquery Node.js client
  • Auth: GOOGLE_APPLICATION_CREDENTIALS_JSON env var (JSON credentials string), falls back to Application Default Credentials
  • Project: BIGQUERY_PROJECT_ID env var, defaults to your-project-id
  • Caching: 24-hour in-memory cache (sha256 of SQL), max 200 entries
  • Byte limit: maximumBytesBilled: 750GB per query

Server Lib

  • File: server/lib/bigquery.ts
  • Key export: runQuery(sql: string): Promise<QueryResult>
  • Return type: { rows, totalRows, schema, bytesProcessed, cached? } — NOT an array, always access .rows
  • Placeholder: @app_events resolves to analytics.events_partitioned (fully qualified)

General Table Usage Guidelines

Always use these canonical tables for specific use cases:

Use CaseTable to UseKey ColumnsNotes
Customer contractsdbt_mart.dim_contractscontract_id, company_id, start_date, end_date, contract_value, statusCanonical source for all contract data
HubSpot dealsdbt_mart.dim_dealsdeal_id, amount, stage_name, is_closed_won, close_dateNOT deal_amount or deal_stage
Active subscriptionsdbt_mart.dim_subscriptionssubscription_id, root_id, plan, status, subscription_arrFilter status = 'active'
Enterprise customersdbt_mart.enterprise_companiesJoins hubspot_companies + dim_contracts + organizationsHas health_status, renewal dates
ARRfinance.arr_revenue_tracker_latestunique_id, product, plan, status, arr_change, event_datearr changes on unique id level
All Trafficdbt_staging_bigquery.all_pageviews

Schema preferences:

  • Use dbt_mart.* for business-level queries (deals, contracts, subscriptions, customers)
  • Use dbt_staging_bigquery.* for raw event data (pageviews, signups)
  • Use dbt_analytics.* for reporting views
  • Avoid dbt_dev.* - development schema excluded globally

Table Map

Logical NameActual TableKey Columns
First pageviewsdbt_staging_bigquery.first_pageviewsvisitorid, url, referrer, created_date (TIMESTAMP), channel, utm*, user_id. No page_type — derive from URL.
All pageviewsdbt_staging_bigquery.all_pageviewsHas page_type, sub_page_type, first_touch_channel, session_channel, c_referrer, full utm fields
Signupsdbt_staging_bigquery.signupsvisitorid, user_id, root_organization_id, utm*, signup_url, created_date
Signups (enriched)dbt_analytics.product_signupsuserid, user_create_d (TIMESTAMP), channel, icp_flag, top_subscription, referrer, utm*
Blog metadatasigma_materialized.SIGDS_82deb8e2_40f8_4fb4_b3cb_caa011a72d29Cryptic column names — see mapping below. 858 rows, deduplicate by blog slug.
Blog content (old)test.builder_blog_contentcontentId, name (blog TITLE not author), handle, topic. Only 75 rows, no author. DO NOT use for author data.
CRM contactsdbt_mart.dim_hs_contactscontact_id (INT64), b_visitor_id, builder_user_id, ql_score, date_entered_mql/sal/s0/s1, lifecycle_stage_name
Dealsdbt_mart.dim_dealsdeal_id, amount (not deal_amount), stage_name (not deal_stage), is_closed_won (string), arr_amount, close_date, create_date
Subscriptionsdbt_mart.dim_subscriptionssubscription_id, root_id, space_id, subscription_arr, start_date, plan, status
Enterprise companiesdbt_mart.enterprise_companiesJoins hubspot_companies + dim_contracts + organizations. Has upcoming_renewal_date, health_status, customer_stage.
HubSpot companiesdbt_staging.hubspot_companiescompany_name, company_id, company_domain_name, upcoming_renewal_date, root_org_id, current_enterprise_arr

Sigma Blog Metadata Column Mapping

Cryptic ColumnMeaningExample Values
SUOHFYGIOGBlog URLhttps://www.example.com/blog/sample-post
H5YIATNDT5AuthorJane Doe, Alex Chen, Sam Patel, Taylor Kim
ZZJ6XRJAIIPublish date (TIMESTAMP)
FTRKLGZM1RPurposeAcquisition, Awareness
IFHWPU1IDOPersonaDevelopers, Product Managers, Engineering Leaders, Designers
Z52LFY52AKTopicAI, CMS, Web Development, Design
_DGCBJNKLESub-typeTooling, Development, Prototyping
JQL-G1QE-BSub-topicAI Design, AI Prototyping, AI Tools

Deduplication: Table has duplicates (http:// vs https://). Always deduplicate: REGEXP_EXTRACT(SUOHFYGIOG, r'/blog/([^/?#]+)') with ROW_NUMBER or DISTINCT.

Column Name Differences (bug sources)

Spec ColumnActual ColumnTable
first_pageview_datecreated_date (TIMESTAMP)first_pageviews
channel (pageviews)first_touch_channelall_pageviews
referrerc_referrerall_pageviews
referrer_channelsession_channelall_pageviews
user_create_dateuser_create_dproduct_signups
deal_stagestage_namedim_deals
deal_amountamountdim_deals
visitor_id → contactsb_visitor_iddim_hs_contacts
user_id → contactsbuilder_user_iddim_hs_contacts

Join Paths

  • Visitor → Signup: first_pageviews.visitor_id = signups.visitor_id
  • Visitor → Contact: first_pageviews.visitor_id = dim_hs_contacts.b_visitor_id
  • Signup → Contact: CRITICAL: Match on BOTH user_id AND email
    signups.user_id = dim_hs_contacts.builder_user_id
    AND signups.email = dim_hs_contacts.email
    
    Matching on both prevents mismatches from reassigned user IDs or data sync issues.
  • Signup → Subscription: signups.root_organization_id = dim_subscriptions.root_id
  • Contact → Deal: No direct FK. Use dbt_intermediate.deal_first_contact or lifecycle stage dates on dim_hs_contacts.
  • Blog → Author: builder_blog_content.contentId = content_with_models.content_id → dim_users.name

Datasets Overview

dbt_staging_bigquery (raw staged), dbt_analytics (reporting views), dbt_mart (dimensional models), dbt_intermediate (joins/transforms), analytics (raw events), finance (ARR tracking), sigma_materialized (Sigma-generated views with UUID names).

SQL Patterns

Deriving page_type from URL

CASE
  WHEN url LIKE '%/blog/%' THEN 'blog'
  WHEN url LIKE '%/docs/%' THEN 'docs'
  WHEN REGEXP_CONTAINS(url, r'example\.com/?(?:\?|$)') THEN 'marketing'
  WHEN url LIKE '%/sign-up%' THEN 'webapp'
  ELSE 'other'
END

Timestamps vs Dates

  • first_pageviews.created_date is TIMESTAMP — wrap: TIMESTAMP('2025-11-01')
  • product_signups.user_create_d is TIMESTAMP — same
  • dim_hs_contacts.sign_up_time_stamp is DATE — no wrapping
  • Use DATE(timestamp_col) before DATE_TRUNC to avoid type mismatch

Avoid double WHERE

-- WRONG
WHERE date BETWEEN '...' AND '...'
WHERE col IS NOT NULL

-- CORRECT
WHERE col IS NOT NULL AND date BETWEEN '...' AND '...'

Analytics Events (Amplitude)

Event column vs Name column

Agent chat events use event column, NOT name column (often NULL). Use event = 'agent chat message submitted'.

Preferred table for agent chat events

Use Amplitude (amplitude.EVENTS_182198) instead of @app_events — smaller, stays within byte limits:

  • Use event_type (not event) and event_time (not createdDate)
  • rootOrganizationId and organizationId in event_properties JSON
  • builderSpaceId is NULL for agent chat events
  • Always use capTo30Days() helper for Amplitude time series

Enterprise customer identification

  • data.isEnterpriseCompany is unreliable — most enterprise events have it false/missing
  • Preferred: JOIN to dim_subscriptions on rootOrganizationId, filter LOWER(plan) = 'enterprise' AND status = 'active'

Key agent chat event types

EventDescription
agent chat message submittedUser sends message in AI chat
visual editor ai chat message submittedUser sends message in Visual Editor AI
agent chat message completedAI response completed
agent chat code appliedUser applied generated code

Customer agent chat message lookup pipeline

  1. HubSpot deal → company → contacts
  2. dim_hs_contacts (contact_id is INT64) → builder_user_id
  3. signups → root_organization_id
  4. Amplitude events WHERE JSON_VALUE(event_properties, '$.rootOrganizationId') IN (...)
  5. Always filter out internal team emails — internal SEs show up in customer org events

Dashboard Data Fetching (CRITICAL)

NEVER use scripts for dashboard UI data. Use useMetricsQuery(queryKey, sql) with direct BigQuery SQL:

  • Define SQL in queries.ts alongside the dashboard
  • Queries go through authenticated /api/query endpoint
  • For customer lookups, use CTEs with JOINs to dim_hs_contacts
  • Scripts are for CLI/agent use only

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

a2a-assets

無料概要あり

複数のアプリやMCPホストからブランド画像・動画を生成、調整、書き出し、挿入する作業を支援します。ライブラリ選択や修正依頼も扱います。

  • スライド用のブランド画像を作りたいとき
  • 既存素材をフィードバックに合わせて直したいとき
  • 動画素材を生成して書き出したいとき
BuilderIO/agent-native7,5192026年10月26日 更新

account-health

無料概要あり

特定の顧客企業について、契約と製品利用の数値を照らし合わせ、根拠や不足情報を明記した健全性レポートをまとめます。

  • 顧客の健全性を確認したいとき
  • 契約席数と実利用を比べたいとき
  • 更新前に利用状況を整理したいとき
BuilderIO/agent-native7,5192026年10月26日 更新

actions

無料概要あり

アプリの操作をエージェントと画面の両方から呼び出せるアクションとして実装し、API連携や画面のデータ取得を一貫した形で追加するスキルです。

  • 新しいアプリ操作を追加したいとき
  • 外部APIと連携したいとき
  • 画面からデータを取得したいとき
BuilderIO/agent-native7,5192026年10月26日 更新

adding-a-feature

無料概要あり

新機能をUI・エージェント用アクション・説明資料・画面状態の4領域でそろえ、利用者とエージェントのどちらからも一貫して使えるようにするチェックリストです。

  • 新機能追加の作業範囲を整理したいとき
  • UIとエージェント操作をそろえたいとき
  • 画面状態の同期漏れを防ぎたいとき
BuilderIO/agent-native7,5192026年10月26日 更新

adhoc-analysis

無料概要あり

複数のデータソースを照合して、傾向や指標、根拠をまとめた分析結果を作成します。必要に応じて、再実行できるダッシュボードとして保存できます。

  • 商談と通話記録を照合したいとき
  • 顧客の利用状況を横断して調べたいとき
  • 繰り返し更新できる分析を保存したいとき
BuilderIO/agent-native7,5192026年10月26日 更新

admin-surfaces

無料概要あり

Analyticsの管理画面で、機能フラグの状態確認と切り替え、ダッシュボード利用状況の調査、接続先アプリのデータベース管理を行います。

  • アプリごとの機能フラグを確認・変更したいとき
  • ダッシュボードの所有者や利用状況を調べたいとき
  • 接続済みアプリのテーブルを管理したいとき
BuilderIO/agent-native7,5192026年10月26日 更新

BuilderIO のスキルをすべて見る

このスキルの問題を報告する