enforcing-resource-attribution
Enforces resource attribution for CLI commands. Use this skill whenever you are running `bq` or `gcloud` commands via `run_command`. It ensures mandatory labeling for supported `bq` operations while avoiding invalid flags on read-only commands.
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-23
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- enforcing-resource-attribution
- license
- Apache-2.0
- metadata
- { "version": "v4", "publisher": "google" }
- description
- Enforces resource attribution for CLI commands. Use this skill whenever you are running `bq` or `gcloud` commands via `run_command`. It ensures mandatory labeling for supported `bq` operations while avoiding invalid flags on read-only commands.
03 SKILL.md 正文
Resource Attribution Enforcement
To track resources created or manipulated by AI agents, you MUST ensure that standard CLI commands are tagged with appropriate attribution labels under relevant conditions.
Applicability
You should apply these attribution labels ONLY under the following conditions:
- DAK Tooling: You are executing Python scripts, running MCP tools, or following workflows provided by the Data Agent Kit.
- Domain Relevance: You are operating on BigQuery datasets, GCS buckets, or Analytics infrastructure (including Spark, Dataproc, or Serverless Spark) intended for data preparation, deduplication, or analysis.
🚫 When to Omit
Do NOT apply these labels if you are running generic administrative commands or working on infrastructure completely unrelated to Data Cloud / Analytics (e.g., managing Compute Engines for web apps, setting up standard IAM policies, etc.).
Do NOT apply --label flags to commands that do not accept labels, as the --label flag is unsupported by these specific bq subcommands. These include:
bq showbq lsbq versionbq rmbq cancelbq head
BigQuery CLI (bq)
You MUST apply --label key:value ONLY to subcommands that accept job or resource labels (bq query, bq load, bq extract, bq mk, bq update, and bq cp).
- Flag Form:
--label key:value - Mandatory Label:
datacloud:<ide> - Deduction Rule: Substitute
<ide>with your actual environment/client (e.g.,vscode,jetski,antigravity,codex,cursor,cloud-shell,workstation,gemini-cli,claude).- Use
cloud-shellfor GCP Cloud Shell. - Use
workstationfor GCP Cloud Workstations. If you cannot determine your environment, useai-agent. Note that BigQuery labels cannot contain dots or spaces.
- Use
Examples
Query Example
Incorrect:
bq query --use_legacy_sql=false "SELECT 1"
Correct (assuming you are running in VS Code):
bq query --use_legacy_sql=false --label datacloud:vscode "SELECT 1"
Copy Example
Incorrect:
bq cp dataset1.table1 dataset2.table1_copy
Correct (assuming you are running in Jetski):
bq cp --label datacloud:jetski dataset1.table1 dataset2.table1_copy
Google Cloud SDK (gcloud)
Whenever you execute any gcloud command via run_command, you MUST
prepend the command with the CLOUDSDK_METRICS_ENVIRONMENT environment
variable to ensure proper resource attribution.
- Environment Variable:
CLOUDSDK_METRICS_ENVIRONMENT=datacloud.<ide> - Deduction Rule: Substitute
<ide>with your actual environment/client (e.g.,vscode,jetski,antigravity,codex,cursor,cloud-shell,workstation,gemini-cli,claude).- Use
cloud-shellfor GCP Cloud Shell. - Use
workstationfor GCP Cloud Workstations. If you cannot determine your environment, useai-agent. Note that values must use dots (e.g.,datacloud.vscode), not colons.
- Use
Examples
Incorrect:
gcloud compute disks create my-disk --size=10GB
Correct (assuming you are running in VS Code):
CLOUDSDK_METRICS_ENVIRONMENT=datacloud.vscode gcloud compute disks create my-disk --size=10GB
[!IMPORTANT]
This applies to ALL
gcloudcommands, whether they are read-only (gcloud ... list) or mutations (gcloud ... create).
04 同仓库更多 Skills
skill-repair
Use this to fix and re-install agent skills that have failed installation. This skill provides the necessary context and permissions to surgically update the `manifest.json` after a fix has been applied.
notebook-guidance
This skill guides the use of Jupyter notebooks for data analysis, exploration, and visualization, particularly with BigQuery. It outlines best practices for notebook execution and validation (supporting both cell-by-cell execution and full notebook generation depending on tool availability), library installation, and structuring notebooks for clarity. It also covers specific rules for data cleaning, plotting, and integrating with BigQuery SQL and machine learning workflows. Relevant when any of the following conditions are true: 1. The user request involves a data analysis, data exploration, data visualization, or data insights task that requires multiple steps, queries, or visualizations to answer. 2. The user explicitly requests a notebook (.ipynb). 3. You are creating, editing, or executing cells in a Jupyter notebook. 4. You need to query BigQuery from within a notebook. DO NOT use the Python BigQuery client library; instead, you MUST use the `%%bqsql` magics explained in this skill.
ml-best-practices
CRITICAL RULE: You MUST use this skill whenever the task involves any machine learning tasks or data analysis. Use this skill if the user's prompt or requirements mention any of the following: * Clustering * Classification * Regression * Time series forecasting * Statistical testing * Model comparison * ML * Data analysis SQL/BigQuery ML HANDOFF: If the user requires a SQL solution, use this skill to dictate the ANALYSIS STEPS (e.g., markdown analysis cells, visualization logic), but defer to `bigquery` for all SQL syntax.
managing-python-dependencies
Ensures proper Python dependency management, avoiding global `pip install` and adhering to project-specific tooling. Use this skill if any of the following are true: 1. Attempting to run `pip install {package_name}`. 2. Python packages or dependencies need to be added or modified. 3. Initiating a new Python project. 4. Creating a new notebook, even if just using BigQuery cells. 5. Generating Python code that includes `import` statements for third-party libraries. 6. Before executing Python scripts via the terminal to ensure the correct virtual environment is active.
google-cloud-storage-basics
Stores, retrieves, and manages data as objects in Cloud Storage (Google Cloud Storage, or GCS) buckets. Use when you need to interact with Cloud Storage — create or configure buckets, upload, download, stream, or transfer data, organize objects with folders, generate signed URLs, control access (IAM, ACLs, public access prevention), set storage classes and tiering (Standard, Nearline, Coldline, Archive), manage cost and lifecycle, protect data (versioning, encryption/CMEK, retention and Bucket Lock, object holds, soft delete), host static websites, trigger Pub/Sub notifications on object changes, mount buckets as a file system (gcsfuse), or optimize storage performance at any scale. Covers the gcloud storage / gsutil CLI, JSON and XML APIs, client libraries, Terraform, and Cloud Storage MCP servers. Don't use for block storage (Persistent Disk), data warehousing/analytics (BigQuery), or databases (Cloud SQL, Spanner, Bigtable, Firestore).
gcs-security-assessment
Assesses security posture, evaluates risks, and checks SAIF compliance for Google Cloud Storage buckets or projects. Use when the user requests security scans, vulnerability checks, or SAIF assessments. Don't use when: The user is asking about non-GCS resources (Compute Engine, GKE, etc.), investigating a live production outage, or asking general security questions not tied to a specific project or bucket.