enforcing-resource-attribution
Skill240 starsChanged 5 months agoApache-2.0View on GitHub
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.
In this repository39 other files it gives its agents.
- accidental-data-loss-preventionSkill
- bigquery-ai-mlSkill
- bigquery-bigframesSkill
- bigquery-data-transfer-serviceSkill
- bigquery-graph-authorSkill
- bigquery-graph-querySkill
- bigquery-observabilitySkill
- bigquery-optimizationSkill
- bigquery-troubleshootingSkill
- bigtable-basicsSkill
- building-data-appsSkill
- cloud-databases-onboardingSkill
- dak-setupSkill
- data-autocleaningSkill
- dataform-bigquerySkill
- dbt-bigquerySkill
- discovering-gcp-data-assetsSkill
- federate-lakehouse-catalogSkill
- gcp-composer-troubleshootingSkill
- gcp-dataflowSkill
- gcp-data-pipelinesSkill
- gcp-managed-airflow-dag-authoringSkill
- gcp-managed-airflow-migrationsSkill
- gcp-managed-airflow-recommendationsSkill
- gcp-managed-spark-upgradesSkill
- gcp-pipeline-orchestrationSkill
- gcp-pipeline-resource-provisioningSkill
- gcp-spark-observabilitySkill
- gcp-sparkSkill
- gcp-spark-troubleshootingSkill
- gcs-security-assessmentSkill
- google-cloud-storage-basicsSkill
- google-cloud-storage-bucket-architectSkill
- google-cloud-storage-fuseSkill
- managing-python-dependenciesSkill
- ml-best-practicesSkill
- notebook-guidanceSkill
- resolving-mcp-region-configsSkill
- schema-mappingSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Do NOT apply these labels if you are running generic administrative commands or working on infrastructure completely unrelated to Data …
- Very specific: line 34
Do NOT apply --label flags to commands that do not accept labels, as the --label flag is unsupported by these specific bq subcommands.
- Very specific: line 51
Use cloud-shell for GCP Cloud Shell.
- Very specific: line 52
Use workstation for GCP Cloud Workstations.
- Very specific: line 53
If you cannot determine your environment, use ai-agent.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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,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_copyCorrect (assuming you are running in Antigravity):
bq cp --label datacloud:antigravity dataset1.table1 dataset2.table1_copyGoogle 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: prepend commands using the append form. It keeps any attribution another tool or skill already set on the same variable and adds the DAK tag after it, so both values reach the metrics pipeline:
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }datacloud.<ide>"- Deduction Rule: Substitute
<ide>with your actual environment/client (e.g.,vscode,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=10GBCorrect (assuming you are running in VS Code):
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$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).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

