Skip to content

Guide · Agent skill

How to use the Cloud Trace Querying agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The cloud-trace-querying skill is a set of instructions and bash tools that lets an AI agent search Google Cloud Trace for slow or failing requests, pull the full span tree for a trace, and fetch related Cloud Logging entries. It is aimed at engineers on Google Cloud who are investigating why a request such as a checkout or booking is slow. After this guide you will know what the skill does, how to install it, how to phrase a request so the agent uses it, and what it needs before it can run.

Cloud Trace Queryinggoogle/skills · Apache-2.0

Quick start

  1. 1Install the gcloud SDK and sign in. Install the Google Cloud SDK, then run gcloud auth login and gcloud auth application-default login.
  2. 2Set your project and enable APIs. Run gcloud config set project <PROJECT_ID>, then enable cloudtrace.googleapis.com and logging.googleapis.com.
  3. 3Download and unzip the skill. Download the ZIP from the directory page and unzip it into ~/.claude/skills/ or your project's .claude/skills/ folder.
  4. 4Ask a plain-language question. Describe the slow or failing request and name the project, for example a booking route taking over 1.5 seconds.
  5. 5Review the commands. Check each bash script call the agent proposes before approving it.
  6. 6Drill into a trace. Use a trace ID from the search results to fetch the full span tree and correlated logs.

What is an agent skill, and what does this one do?

An agent skill is a folder containing a SKILL.md file and supporting files. When a skill is installed, the agent reads its instructions and uses them for tasks that match its description. This skill equips the agent with standard Cloud Trace query patterns, diagnostic workflows for latency and errors, and scripts that fetch and inspect trace hierarchies.

  • Search traces by root span and latency threshold, or by error status.
  • Fetch the entire span tree for one trace ID, or a single span.
  • Fetch application log entries correlated with a trace ID from Cloud Logging.
  • Generate Cloud Console links for a trace or span.
  • Present span trees as indented ASCII timelines, or as A2UI JSON graph structures when a UI is needed.

Install the skill from the ZIP or upload it

Download the ZIP for google/skills / skills/cloud/cloud-trace-querying from the directory page and unzip it. For a personal install, place the folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder. In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

After installing, the folder should contain SKILL.md along with its assets and scripts. The skill is licensed under Apache-2.0.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project
  • Claude apps: Settings → Capabilities → Skills, then upload

Set up Google Cloud access first

Every command the skill runs needs a working Google Cloud setup. The SKILL.md walks the agent through these prerequisites, but you should confirm them yourself before starting. You need the Google Cloud SDK (gcloud), authentication for the CLI and application default credentials, a project with billing enabled, and the Cloud Trace and Cloud Logging APIs enabled. Your account also needs permission to read traces and logs in the target project.

  • Verify gcloud is installed (the SDK installation guide is linked from the skill).
  • Authenticate with gcloud auth login and gcloud auth application-default login.
  • Set the project with gcloud config set project <PROJECT_ID>.
  • Enable the APIs with gcloud services enable cloudtrace.googleapis.com logging.googleapis.com.
gcloud auth login && gcloud auth application-default login

Trigger the skill with natural requests

You do not need to type script names. Describe the problem in plain language and name the project and, if you have it, the route or trace ID. The skill's description tells the agent to use it when investigating slow requests, analysing trace hierarchies, or resolving latency regressions.

If you do not give a project ID, the agent is instructed to find one by running the project lookup script. Name the project yourself when you can, because it avoids a lookup step.

  • Why is the /v1/booking/book route slow in project my-project today?
  • Find traces for /v1/booking/book that took at least 1.5 seconds.
  • Here is trace ID <TRACE_ID>. Show me the full span tree and any error logs.
  • Give me Cloud Console links for this trace.

Example: search for slow traces and drill in

The search script takes a filter. The example below finds traces whose root span is /v1/booking/book with a duration of at least 1.5 seconds. The filter is required; to list traces without narrowing, the source says to pass an empty filter or root: alone.

The output is JSON. Each cluster's examples array lists sample traces with trace_id, duration_seconds, span count, and error status. Copy a trace_id into the next step to fetch the full hierarchy, then fetch correlated logs for that same trace.

  • Filter syntax uses latency:<duration>, for example latency:1.5s for 1.5 seconds or more. This matches "Span duration" in Trace Explorer.
  • Other filter forms in the skill include root:, +span:, and error:true.
  • Look for severity: "ERROR" in correlated log entries when diagnosing failures.
bash scripts/search_traces/run.sh --filter 'root:/v1/booking/book latency:1.5s' --projects '<PROJECT_ID>'

Once you have a trace ID, the agent can fetch every span and its status with the entire-trace script. Correlated logs are fetched separately using the same trace ID. Be aware that the log query searches the default _Default log scope, so an empty result can mean there are no matching entries, the caller lacks permission, or the entries live in a log view outside that scope.

Terminal output uses indented |-- trees. For a UI, ask for A2UI JSON. The skill also ships example templates for single spans, trace charts, trace flows and heat maps in both formats.

  • Fetch the full trace: bash scripts/fetch_entire_trace/run.sh --trace-id '<TRACE_ID>' --project '<PROJECT_ID>'
  • Fetch correlated logs: bash scripts/fetch_related_logs/run.sh --trace-id '<TRACE_ID>' --trace-projects '<PROJECT_ID>'
  • Fetch one span: bash scripts/fetch_trace_span/run.sh --trace-id '<TRACE_ID>' --span-id '<SPAN_ID>' --project '<PROJECT_ID>'
  • Generate links: bash scripts/generate_links/run.sh --trace-id '<TRACE_ID>' --project '<PROJECT_ID>'

Safety notes before you approve commands

This skill runs scripts and uses the network. Its instructions tell the agent to execute bash tools directly and report the exact results rather than only describing them. Read each command before you approve it, especially when the agent is working in a project with other sensitive data. The skill also tells the agent to report upstream API errors such as 500 or 503 responses instead of debugging local libraries, so an outage will show up as a report, not a fix.

The skill asks the agent to read its attribution reference before running gcloud, REST or MCP commands, and to prefix terminal gcloud calls with a CLOUDSDK_METRICS_REQUEST_ATTRIBUTION setting. Expect to see that prefix in commands you review.

  • Review every bash command before approving it.
  • Use a project you are allowed to read traces and logs from.
  • Do not expect non-GCP telemetry or general database tuning from this skill; it says it does not cover them.

What people use it for

  • Finding which downstream call makes a checkout request slow by reading the span tree.
  • Checking Cloud Logging for ERROR entries that match a failing trace.
  • Building a repeatable query for slow booking or payment routes using the same filter each time.
  • Sharing a Cloud Console link for a specific trace with a teammate.
  • Producing an ASCII timeline of a trace to paste into an incident note.

Frequently asked questions

How do I install the cloud trace querying agent skill?

Download the ZIP from the skill's page and unzip it into ~/.claude/skills/ for personal use or a project's .claude/skills/ folder. In the Claude apps, you can upload it under Settings → Capabilities → Skills instead.

What do I need to use the cloud-trace-querying skill?

You need the Google Cloud SDK (gcloud), gcloud authentication and application default credentials, a Google Cloud project with billing enabled, the Cloud Trace and Cloud Logging APIs enabled, and permission to read traces and logs in that project.

Is the Cloud Trace Querying skill free?

The skill is licensed under Apache-2.0. Google Cloud usage that the commands make against your project is governed by your own Google Cloud account and billing, which this page does not cover.

Does this skill work outside Google Cloud?

No. The skill says it is not for querying non-GCP telemetry or database query optimization outside Cloud Trace.

Why does fetch_related_logs return nothing?

The source lists three causes: no log entries match, the caller lacks IAM permission to view them, or the matching entries sit in log views outside the default _Default scope the script searches.

How does this compare with using the Trace Explorer in the console?

The skill lets an agent run the queries, fetch span trees and correlated logs, and format results in one conversation. The Trace Explorer is the browser interface; the skill can also generate Console links so you can open a specific trace there.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are an engineer or on-call person on Google Cloud who wants an agent to run Cloud Trace searches, read span trees and check related logs for slow or failing requests. Pick something else if you lack a GCP project with billing and API access, need non-GCP telemetry or database tuning, or want an agent that cannot run commands without close review.

Download the skill