discovering-gcp-data-assets
Finds and inspects data assets within Google Cloud. Relevant when any of the following conditions are true: 1. The user request involves finding, exploring, or inspecting data assets in Google Cloud, such as: - BigQuery datasets, tables, or views - BigLake catalog or tables - Spanner instances, databases or tables - etc. 2. You need to retrieve the schema, metadata, or governance policies for a GCP data asset. 3. You have a keyword or topic (e.g., "sales data") but lack the specific table or resource ID. 4. You are attempting to find data using `bq ls`, as this skill offers a superior approach. Don't use when: - Assets are outside Google Cloud
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-23
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- discovering-gcp-data-assets
- license
- Apache-2.0
- metadata
- { "version": "v4", "publisher": "google" }
- description
- Finds and inspects data assets within Google Cloud. Relevant when any of the following conditions are true: 1. The user request involves finding, exploring, or inspecting data assets in Google Cloud, such as: - BigQuery datasets, tables, or views - BigLake catalog or tables - Spanner instances, databases or tables - etc. 2. You need to retrieve the schema, metadata, or governance policies for a GCP data asset. 3. You have a keyword or topic (e.g., "sales data") but lack the specific table or resource ID. 4. You are attempting to find data using `bq ls`, as this skill offers a superior approach. Don't use when: - Assets are outside Google Cloud
03 SKILL.md 正文
Instructions
Step 1: Prioritize Assets from the Conversation
If the asset was created or mentioned earlier in the same conversation, then proceed with that asset instead of searching. Skip steps 2, 3, and 4.
Step 2: Handle Public Datasets or Proceed to Search
Dataplex Lookup Context provides the richest metadata for data assets. You MUST prioritize using it for all Google Cloud assets, even if you already know their IDs.
- Public Datasets (Direct Inspection): If the requested asset belongs to
the
bigquery-public-dataproject, Dataplex Lookup Context will fail. You MUST skip Steps 3 and 4 and inspect the table directly using thebqCLI or BigQuery MCP tools instead. - All Other Assets (Proceed to Step 3): For all other BigQuery, Cloud Storage, Spanner, BigLake Iceberg or general GCP data assets (whether their IDs are known or missing), you MUST proceed to Step 3 to search the Dataplex catalog and obtain their full Entry Name.
Step 3: Execute Discovery Search
You MUST use the Dataplex search command to discover assets and retrieve their
full projects/... entry names. This step is required even if you already know
the asset's short ID (e.g., my_dataset.my_table), because Step 4 strictly
requires the full entry name.
[!IMPORTANT]
The
--projectparameter MUST ALWAYS be provided. This project_id is used to attribute the search only and does NOT restrict the search scope. The project must have the dataplex API enabled and user must have thedataplex.entries.getpermissions.
A. Semantic Search (Natural Language Intent)
Use this when the user describes the meaning or intent of the data (e.g., "Find Q4 product sales data").
Use the search_entries MCP tool
OR
gcloud dataplex entries search "<NATURAL_LANGUAGE_QUERY>" \
--project="<PROJECT_ID>" \
--semantic-search \
--limit=50
B. Keyword Search (Technical Strings)
Use this for exact keyword matches or technical strings (e.g., name:order_v2).
Search Query Rules (MANDATORY)
- Mode-Specific Syntax:
- Semantic Search: Logical operators (
AND,OR) MUST be UPPERCASE. Use plurallabels.for label filters (e.g.,labels.env=prod). - Keyword Search: Operators are case-insensitive. Use singular
label.for label filters (e.g.,label.env=prod).
- Semantic Search: Logical operators (
- Abbreviated Logic: Use
|for OR and,for AND within parentheses to shorten queries (e.g.,projectid:(prod|staging)orcolumn:(id,name)). - Exact vs. Token Match:
- Use
:for token/substring matches (e.g.,name:sales). - Use
=for exact matches. REQUIRED forsystem,type, andlocation.
- Use
- Singular Keywords: When performing keyword search, ALWAYS convert plurals to singular (e.g., "product" NOT "products"). Semantic search handles singular/plural variations and synonyms automatically.
- Scope Restriction: You SHOULD restrict the search scope using a
parentfilter if the project or dataset is known (e.g.,parent:projects/<PROJECT_ID>).
Dataplex Search Syntax Reference
name:x: Substring/token match on resource ID.displayname:x: Substring/token match on display name.projectid:x: Substring/token match on GCP project ID.parent:x: Substring match on hierarchical path (e.g.,projects/my-proj).location=x: Exact match on location (e.g.,us-central1,us).column:x: Substring/token match on column names in the schema.system=x: Exact match on source system. Common values:bigquery,storage,biglake,cloud_sql,cloud_spanner,cloud_bigtable,pubsub.type=x: Exact match on entry type (e.g.,bigquery-table,storage-bucket,storage-folder).labels.key=value: (Semantic Mode ONLY) Exact match on a label.label.key=value: (Keyword Mode ONLY) Exact match on a label.createtime[>|<|=]x: Match assets created after/before dateYYYY-MM-DD.fully_qualified_name=x: Exact match on the FQN (e.g.,bigquery:project.dataset.table).
[!TIP]
Dataplex search results rely on metadata being ingested into the Universal Catalog (often via Discovery Scans). If an asset is missing from search, it may not be indexed. - Fallback 1: Try searching by the
fully_qualified_namequalifier. - Fallback 2: Use native tools (e.g.,bq show,gcloud storage) or specific skills for that asset type if you already know the ID.
gcloud dataplex entries search "<KEYWORD_SEARCH_QUERY>" \
--project="<PROJECT_ID>" \
--limit=50
[!IMPORTANT]
Handling Search Results and Avoiding Loops:
- No Results: If the search returns no entries:
- Variation Rule: You may try AT MOST 3 variations of the search query (e.g., switching AND/OR clauses, adding/removing
parent:, removingprojectid:orlocation:, tryingfully_qualified_name=).- Stop Rule: If after 3 attempts no results are found, STOP and inform the user. Ask for clarification, specifically the Dataplex full entry name if known, or identifiers such as project ID, dataset ID, or instance ID to help narrow the search. Example: "I couldn't find any tables matching that description after several attempts. If you know the Dataplex full entry name (
projects/...), please provide it. Otherwise, please provide any identifiers you know, such as project, dataset, or instance name, to help locate the asset."- Multiple Results:
- If more than 10 results are returned, state that many matches were found. Show the names of the first 5 entries and ask for clarification.
- If 2-10 results are returned and you cannot definitively choose, list them and ask the user.
- Single Result: Proceed to Step 3 with the full entry name.
- Avoid Infinite Loops: MUST NOT re-run identical or near-identical queries. If Dataplex fails to return the expected asset, prioritize asking the user for the exact resource ID or using Fallback 2 (Native Tools).
Criteria: Once candidate assets are returned, proceed to Step 4 using the full entry names from the search results.
Step 4: Lookup Context
You MUST use the Lookup Context command to fetch schema and deep metadata for the relevant results obtained from Step 3.
[!IMPORTANT]
The
--resourcesparameter MUST be the full name (starting withprojects/) returned by the search result. Passing short table IDs, GCS URIs, or fully qualifiedbigquery:prefixes is PROHIBITED and will fail.
Command Execution
Use the lookup_context MCP tool
OR
gcloud dataplex context lookup --resources="<FULL_ENTRY_NAME>"
Completion Criteria: The command returns the detailed schema and business context.
Troubleshooting
Context Lookup Fails or "Resource not found"
- Cause: Short table names were used improperly.
- Fix: Ensure you use the correct entry name format from the search
results (starting with
projects/).
Search Returns No Results
- Cause: Plural terms in keyword search or lack of scoping.
- Fix: Switch to singular keywords. For semantic search, try more descriptive natural language.
Context Lookup Fails with "NOT_FOUND" (despite correct format)
- Cause: The table belongs to a project (e.g.,
bigquery-public-data) that has not fully synchronized its metadata with the Dataplex Universal Catalog. While the entry appears in search,context lookupis unavailable. - Fix: Fall back to direct inspection using native tools (e.g.,
bqCLI). - Stop Rule: If the native tool (e.g.,
bq show) also returns "Not Found", STOP. Do not restart the Dataplex discovery loop. Specifically ask the user to verify the project ID and table ID.
Breaking the Research Loop
If you find yourself repeatedly searching for the same asset:
- STOP.
- State what you have tried (e.g., "I tried searching Dataplex with X and Y,
and checked
bq show"). - Ask the user for the exact project, dataset, and table ID.
Search Fails with "--project: Must be specified."
- Cause:
--project <PROJECT_ID>arguments were not provided - Fix: Provide a project which will be used to authorize and attribute the search request.
Search Fails with "PERMISSION_DENIED"
- Cause: The project_id provided in the
--project <PROJECT_ID>arguments does not have the Dataplex API enabled or the user is missing necessary IAM permissions. - Fix: Ask the user if they have a project which has the Dataplex API enabled with the dataplex.entries.get permission
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.