Skip to main content
skill Claude Code Gemini CLI CX Codex official · Google

spanner-basics — Claude Code skill: what it does, how to install

This skill helps design schemas, write queries, and work with Cloud Spanner on Google Cloud. Use it when provisioning databases or investigating slow queries.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add google/skills --skill spanner-basics -a claude-code
Open on GitHub

What spanner-basics does

spanner-basics supports core Cloud Spanner work on Google Cloud. It helps provision instances and databases, choose primary keys, design related tables, write SQL, and create client-library code for Java, Go, Python, and Node.js.

The skill includes workflows and references for DDL, Terraform, IAM, the PostgreSQL interface, queues, and the remote MCP server. For performance checks, it uses SPANNER_SYS tables such as SPANNER_SYS.QUERY_STATS_TOP_HOUR. It warns against putting monotonically increasing values first in a primary key because that can create hotspots.

Install it when your project uses Cloud Spanner and you need guidance for schema or query work. The skill asks for explicit approval before DDL, DML, or destructive changes to a non-emulator database.

What it helps with

  • design a Cloud Spanner primary key
  • provision an instance and database
  • write a SQL query or client-library code
  • find high-load queries with SPANNER_SYS
  • prepare DDL for a schema change

Example prompts for the agent

  • Design a Cloud Spanner schema for related tables and suggest primary keys.
  • Use `SPANNER_SYS.QUERY_STATS_TOP_HOUR` to investigate high CPU usage.
  • Prepare a `gcloud spanner databases ddl update` command and wait for my approval.

How to install spanner-basics

1Skills CLI (Vercel)

npx skills add google/skills --skill spanner-basics -a claude-code

2Manually: put the files in place

~/.claude/skills/spanner-basics/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/spanner-basics/

From the same set172

The whole set →
bigquery-basics official google Manages BigQuery resources and runs SQL queries. Use it to create datasets, tables and views, or handle basic data ingestion and analysis. Claude Code Gemini CLI CX Codex 17,678installs cloud-run-basics official google This skill helps an agent manage Cloud Run services, jobs, and worker pools when a project needs HTTP deployment, scheduled work, or pull-based background processing. Claude Code Gemini CLI CX Codex 17,532installs gemini-api official google Connects Gemini API from Google Cloud Agent Platform to the agent. Gives access to Gemini models, multimodal input, function calling, and context caching. Claude Code Gemini CLI CX Codex 17,116installs google-cloud-recipe-auth official Google LLC This skill explains Google Cloud authentication and permissions. Use it when setting up IAM, ADC, or service accounts for local code and production workloads. Claude Code Gemini CLI CX Codex 15,450installs google-cloud-recipe-onboarding official Google LLC Guides a developer through a first Google Cloud project: CLI checks, sign-in, project setup and billing. It fits a personal first project. Claude Code Gemini CLI CX Codex 15,390installs cloud-sql-basics official google This skill helps create and explain Cloud SQL resources for MySQL, PostgreSQL, and SQL Server. Use it when setting up a database in Google Cloud. Claude Code Gemini CLI CX Codex 14,679installs google-cloud-waf-security official google This skill reviews Google Cloud workloads against the security pillar of the Well-Architected Framework and suggests actions for IAM, networks, data, and operations. Claude Code Gemini CLI CX Codex 14,620installs google-cloud-waf-cost-optimization official google Reviews Google Cloud workloads through the Well-Architected Cost Optimization pillar. Use it to inspect spending, resize resources, assess discounts, or find idle capacity. Claude Code Gemini CLI CX Codex 14,266installs

Similar

fixed-income-portfolio official anthropics Skill for bond portfolio analysis: pricing, duration, DV01, rate scenarios and cashflow projections. Aggregates MCP tool outputs into risk metric reports. Claude Code CX Codex Cursor +1 1,800installs gdpr-data-handling Seth Hobson Guides GDPR data handling with consent management, data subject rights, and privacy by design. Use it when a system processes EU personal data. Claude Code CX Codex Cursor 14,862installs golang-database samber Go database guidelines for database/sql, sqlx, and pgx. Enforces parameterized queries, context passing, and explicit connection pool handling without ORMs. Claude Code CX Codex Cursor +1 40,700installs data-context-extractor official anthropics Extracts tribal knowledge from data analysts about your warehouse and auto-generates reference files. Runs in bootstrap mode for initial setup and iteration mode to add new domains. Claude Code CX Codex Cursor +1 3,100installs firecrawl-search firecrawl This skill finds web sources, returns relevant excerpts, and can fetch full page content. Use it for research and structured data discovery. Claude Code CX Codex Cursor +1 84,400installs write-query official anthropics Writes SQL for a chosen dialect, handles joins and aggregations, and considers partitioning. Use it for analytical queries or performance-sensitive work. Claude Code CX Codex Cursor +1 3,000installs xlsx official anthropics Creates, reads, edits, and converts spreadsheet files. Use it when the requested deliverable is an Excel workbook or another tabular file. Claude Code Claude.ai 187,223installs google-agents-cli-observability official Google This skill guides you through tracing and monitoring AI agents, including ADK agents. Use it when you need to inspect agent execution or monitor a deployed agent. Claude Code CX Codex Cursor +1 509,900installs

Questions about spanner-basics

How do I install spanner-basics in Claude Code?

Run npx skills add google/skills --skill spanner-basics -a claude-code. The skill file is placed at ~/.claude/skills/spanner-basics/SKILL.md.

What does spanner-basics do?

It guides Cloud Spanner provisioning, schema design, SQL queries, and client-library code. It also helps investigate performance with SPANNER_SYS tables.

Does it ask before changing a database?

Yes. The skill must get explicit user approval before DDL, DML, or destructive operations on a non-emulator database.

Source text

SKILL.md · Apache-2.0
---
name: spanner-basics
metadata:
  version: "1.1.2"
  category: Databases
description: >-
  Assists in provisioning instances and databases, designing performant schemas, and querying data in Cloud Spanner on Google Cloud. Use when designing primary keys, writing SQL queries or client library code, or diagnosing performance issues.
---

# Spanner Basics

This skill provides core workflows and guidance for administering and developing with Cloud Spanner on Google Cloud, a fully managed, mission-critical database service offering global transactional consistency and automatic, synchronous replication for high availability.

## Attribution

**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
MUST read [Usage Attribution](references/attribution.md). For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix `gcloud` with
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:spanner-basics)"`
and append `agent-skills/1.0 (skill:spanner-basics)` to `User-Agent` headers.

## Core Principles

-   **Performance First:** Spanner scales horizontally. Efficiency is tied to
    Primary Key design. Always warn against using monotonically increasing/decreasing
    values (like sequential timestamps) as the first part of a primary key to avoid hotspots.
-   **Schema Design:** Prefer interleaved tables for strongly related parent-child data
    that is frequently accessed together.

## Safety

> [!CAUTION] **CRITICAL INSTRUCTION:** You MUST obtain explicit user confirmation before making any non-emulator database changes (DML or DDL) or destructive operations (such as dropping tables, indexes, or any other Spanner resources). Do not execute them automatically; instead, output the command (e.g., `gcloud spanner databases ddl update`) and ask for explicit user approval.
> When database access is unavailable or authentication fails, do not block on trying to verify the existence of the instance, database, or table. Assume the provided resources exist and directly generate the DDL commands.

## Common Workflows

### Schema Evolution & DDL

1.  Use `gcloud spanner databases ddl update` to apply schema updates (such as CREATE, ALTER, or DROP tables and indexes).
2.  Reference [schema-design.md](references/schema-design.md) for guidelines on primary key selection and interleaved tables.

### Diagnosing Performance Issues

1.  Use `SPANNER_SYS` tables to identify slow or resource-intensive queries.
2.  For example, query `SPANNER_SYS.QUERY_STATS_TOP_HOUR` to find queries with the highest CPU usage.

## Reference Directory

- [Core Concepts](references/core-concepts.md): Explanation of Spanner internals, architecture, and design.
- [CLI Usage](references/cli-usage.md): Essential `gcloud spanner` command-line operations for managing instances and databases.
- [IAM Security](references/iam-security.md): Roles, permissions, and data governance best practices for Spanner.
- [Client Library Usage](references/client-library-usage.md): Using Google Cloud client libraries for Spanner (Java, Go, Python, Node.js).
- [Terraform Usage](references/terraform-usage.md): Infrastructure as Code examples for provisioning Spanner instances and databases.
- [MCP Usage](references/mcp-usage.md): Using the Spanner remote MCP server.
- [PostgreSQL Dialect](references/postgresql-dialect.md): Best practices and examples for using the PostgreSQL interface in Spanner.
- [Queues Usage](references/queues-usage.md): Cloud Spanner Queues: mental model, design constraints, and links related to transactional message queues.
- [Schema Design](references/schema-design.md): Guidelines on primary key selection and interleaved tables for performance.

If you need product information that's not found in these references, use the
`search_documents` tool of the Developer Knowledge MCP server.

© google · Apache-2.0 · google/skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor