# google/skills API Examples: Complete Guide with Code Samples for Google Cloud Services

> Explore the google/skills repository for comprehensive examples and code samples in Python, Java, Go, REST, and Terraform to master Google Cloud APIs. Get hands-on with practical implementations.

- Repository: [Google/skills](https://github.com/google/skills)
- Tags: tutorial
- Published: 2026-08-16

---

**Yes, the google/skills repository provides extensive practical examples for working with Google Cloud APIs, organized as markdown-based Skill definitions with reference implementations in Python, Java, Go, REST, and Terraform.**

The **google/skills** repository serves as a curated knowledge base where each **Skill** contains working code samples, authentication patterns, and Infrastructure-as-Code templates. Every Skill follows a consistent structure: a central [`SKILL.md`](https://github.com/google/skills/blob/main/SKILL.md) file explaining concepts and prerequisites, plus language-specific reference files in `references/*.md` containing copy-paste-ready snippets.

## What the google/skills API Provides

Each Skill in the repository represents a complete learning path for a Google Cloud service. According to the source code analysis, the repository covers Ads, Analytics, Spanner, Workload Manager, Cloud Storage, and other products.

The core components include:

- **Skill definitions ([`SKILL.md`](https://github.com/google/skills/blob/main/SKILL.md))** — High-level documentation listing concepts, OAuth scopes, and step-by-step workflows. Located at paths like [`skills/ads/google-ads-api-quickstart/SKILL.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/SKILL.md).

- **Reference implementations (`references/*.md`)** — Concrete code snippets organized by language or usage style (REST, Terraform, CLI).

- **Authentication patterns** — Standardized examples using `gcloud auth application-default login` or service-account keys.

- **Infrastructure-as-Code** — Terraform modules for provisioning required resources.

## Google Ads API Examples

### Creating a Campaign via REST

The REST reference file at [`skills/ads/google-ads-api-quickstart/references/rest.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/references/rest.md) demonstrates direct HTTP calls using cURL:

```bash
curl -X POST "https://googleads.googleapis.com/v13/customers/INSERT_CUSTOMER_ID/campaigns:mutate" \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json" \
     -d '{
           "operations": [{
             "create": {
               "name": "Example Campaign",
               "advertisingChannelType": "SEARCH",
               "status": "PAUSED",
               "campaignBudget": "customers/INSERT_CUSTOMER_ID/campaignBudgets/INSERT_BUDGET_ID"
             }
           }]
         }'

```

### Listing Campaigns with Python

The Python client library example in [`skills/ads/google-ads-api-quickstart/references/python.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/references/python.md) uses the official `google-ads` package:

```python
from google.ads.googleads.client import GoogleAdsClient

client = GoogleAdsClient.load_from_storage()
service = client.get_service("GoogleAdsService")

query = """
    SELECT campaign.id, campaign.name
    FROM campaign
    ORDER BY campaign.id
"""

response = service.search(customer_id="INSERT_CUSTOMER_ID", query=query)
for row in response:
    print(f"Campaign {row.campaign.id}: {row.campaign.name}")

```

## Cloud Spanner API Examples

### Provisioning with Terraform

The [`skills/cloud/spanner-basics/references/terraform-usage.md`](https://github.com/google/skills/blob/main/skills/cloud/spanner-basics/references/terraform-usage.md) file contains complete Infrastructure-as-Code for creating instances and databases:

```hcl
resource "google_spanner_instance" "example" {
  name         = "example-instance"
  config       = "regional-us-central1"
  display_name = "Example Spanner Instance"
  node_count   = 1
}

resource "google_spanner_database" "example" {
  name     = "example-database"
  instance = google_spanner_instance.example.name
  ddl = [
    "CREATE TABLE Users (UserId STRING(36) NOT NULL, Name STRING(100)) PRIMARY KEY (UserId)"
  ]
}

```

## Google Analytics Data API Examples

### Running Reports in Python

Located in [`skills/analytics/google-analytics-data-api-basics/references/python.md`](https://github.com/google/skills/blob/main/skills/analytics/google-analytics-data-api-basics/references/python.md), this example demonstrates the `BetaAnalyticsDataClient`:

```python
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import RunReportRequest

client = BetaAnalyticsDataClient()
request = RunReportRequest(
    property="properties/INSERT_PROPERTY_ID",
    dimensions=[{"name": "city"}],
    metrics=[{"name": "activeUsers"}],
    date_ranges=[{"start_date": "2024-01-01", "end_date": "2024-01-31"}],
)

response = client.run_report(request)
for row in response.rows:
    print(f"{row.dimension_values[0].value}: {row.metric_values[0].value}")

```

## Cloud Storage API Examples

### Direct HTTP Access with cURL

The [`skills/cloud/google-cloud-storage-basics/references/cli-api-usage.md`](https://github.com/google/skills/blob/main/skills/cloud/google-cloud-storage-basics/references/cli-api-usage.md) file shows how to handle `nextPageToken` for pagination and includes this list-objects example:

```bash
curl -X GET \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://storage.googleapis.com/storage/v1/b/PROJECT_ID/o?prefix=example-folder/"

```

## Key Source Files in the google/skills Repository

| File Path | Purpose |
|-----------|---------|
| [`skills/ads/google-ads-api-quickstart/SKILL.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/SKILL.md) | Google Ads API quickstart guide with OAuth scopes and developer token instructions |
| [`skills/ads/google-ads-api-quickstart/references/rest.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/references/rest.md) | cURL examples for campaigns, budgets, and mutations |
| [`skills/ads/google-ads-api-quickstart/references/python.md`](https://github.com/google/skills/blob/main/skills/ads/google-ads-api-quickstart/references/python.md) | Python client library samples for resource management |
| [`skills/analytics/google-analytics-data-api-basics/SKILL.md`](https://github.com/google/skills/blob/main/skills/analytics/google-analytics-data-api-basics/SKILL.md) | Analytics Data API overview with metrics and dimensions reference |
| [`skills/analytics/google-analytics-data-api-basics/references/python.md`](https://github.com/google/skills/blob/main/skills/analytics/google-analytics-data-api-basics/references/python.md) | `BetaAnalyticsDataClient` usage and report parsing |
| [`skills/cloud/spanner-basics/SKILL.md`](https://github.com/google/skills/blob/main/skills/cloud/spanner-basics/SKILL.md) | Spanner schema design and best practices |
| [`skills/cloud/spanner-basics/references/terraform-usage.md`](https://github.com/google/skills/blob/main/skills/cloud/spanner-basics/references/terraform-usage.md) | `google_spanner_instance` and `google_spanner_database` resources |
| [`skills/cloud/google-cloud-storage-basics/references/cli-api-usage.md`](https://github.com/google/skills/blob/main/skills/cloud/google-cloud-storage-basics/references/cli-api-usage.md) | HTTP API calls with pagination handling |

## Authentication Pattern Across All Examples

Every google/skills API example follows the same authentication model:

1. **For local development**: Run `gcloud auth application-default login` to generate access tokens automatically via `$(gcloud auth print-access-token)`.

2. **For production**: Use service-account keys with `GoogleCredentials.get_application_default()` as shown in the Analytics Data API Python snippet.

3. **For REST calls**: Pass the Bearer token in the `Authorization` header explicitly.

## Summary

- The **google/skills API** organizes examples as Skills with [`SKILL.md`](https://github.com/google/skills/blob/main/SKILL.md) concept guides and `references/*.md` implementation files.
- **Google Ads API** examples cover REST/cURL mutations and Python client library queries.
- **Cloud Spanner** provides Terraform modules for complete infrastructure provisioning.
- **Analytics Data API** demonstrates `BetaAnalyticsDataClient` for metric reporting.
- **Cloud Storage** includes pagination-aware HTTP examples.
- All examples use consistent **OAuth 2.0 authentication** patterns via Application Default Credentials.

## Frequently Asked Questions

### How do I find the right example for a specific Google Cloud service?

Navigate to the `skills/` directory and locate the service folder—examples are grouped by product area (ads, analytics, cloud) with descriptive names like `google-ads-api-quickstart` or `spanner-basics`. Each folder contains a [`SKILL.md`](https://github.com/google/skills/blob/main/SKILL.md) that links to all language-specific reference files.

### Are the google/skills examples production-ready?

The examples demonstrate **core API patterns** with proper authentication and error-handling structures. For production, review the pagination loops in [`cli-api-usage.md`](https://github.com/google/skills/blob/main/cli-api-usage.md) and add your own retry logic, monitoring, and credential management beyond the sample code provided.

### What languages does the google/skills API support?

Reference files exist for **Python, Java, Go, .NET, PHP, Ruby, Node.js**, plus **REST/cURL** for direct HTTP access and **Terraform** for infrastructure provisioning. Not every Skill includes every language; check the `references/` folder contents for your target service.

### How do I authenticate the examples without hardcoding credentials?

All examples expect **Application Default Credentials**. Run `gcloud auth application-default login` before executing Python samples, or use `$(gcloud auth print-access-token)` in shell commands to inject short-lived tokens automatically.