En bref
Provisionnement d’instances et de bases Spanner, conception de schémas performants, et requêtes — SQL ou bibliothèques clientes. On l’utilise notamment pour concevoir des clés primaires, écrire des requêtes ou du code client, faire évoluer un schéma (DDL), ou diagnostiquer un problème de performance. Spanner n’est pas une base SQL classique : le choix des clés et le découpage ont un effet direct sur la latence et les points chauds. Ce n’est pas Cloud SQL, AlloyDB ou Bigtable.
Ce que ça fait
- Aide à créer une instance et une base, puis à poser un schéma dont les clés primaires tiennent la charge.
- Guide les requêtes et le code client, ainsi que l’évolution de schéma par DDL, avec prudence sur les changements cassants.
- Diagnostique des soucis de performance typiques d’un mauvais découpage ou d’une clé mal choisie.
- Renvoie le choix d’un autre moteur, et l’administration Cloud SQL ou Bigtable, vers leurs skills.
Pour qui, et un exemple
Développeurs et administrateurs qui conçoivent ou interrogent une base Spanner, en particulier le modèle de clés, pas une instance MySQL gérée.
Exemple de demande : « Propose un schéma Spanner avec des clés primaires adaptées, un exemple de requête, et les points de vigilance si on doit faire évoluer le DDL. »
Le SKILL.md couvre instances, schémas, requêtes, DDL et perf Spanner, distinct des autres bases Google Cloud. Exemple rédigé par iadujour.fr à partir du SKILL.md, non testé.
Installer
npx skills add google/skills, puis sélectionner la skill, les agents cibles et la portée (README).
npx skills add google/skillsNiveau : Avancé
Suppose un projet Google Cloud et la maîtrise de SQL ou de Python pour les données.
Extrait du SKILL.md
La description d’origine, celle que l’agent lit pour décider de charger la skill (en anglais) :
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.
Citée depuis le SKILL.md au commit 793c036 . Le dossier contient aussi 10 fichiers annexes (references/).
Le SKILL.md compte 62 lignes et 5 sections principales :
- Attribution
- Core Principles
- Safety
- Common Workflows
- Reference Directory
Licence : Apache 2.0
Vérifiée le 10 novembre 2026 sur : fichier LICENSE du dépôt .
La licence autorise la reprise : le texte intégral du SKILL.md est reproduit ci-dessous, sans modification, avec sa mention de licence.
Texte intégral du SKILL.md
Reproduit sans modification depuis google/skills (commit 793c036) , © Google, sous licence Apache 2.0 (fichier de licence d’origine ).
Afficher le SKILL.md original (62 lignes, en anglais)
---
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.
Commentaires.
Un retour d’expérience, une question, une précision sur cette skill ? Les commentaires sont relus avant publication.
Commentaires publiés
Chargement des commentaires…
Laisser un commentaire
Charte de modération. Chaque commentaire est relu avant publication. Sont refusés : l’incitation à la haine, les propos injurieux ou discriminatoires, la publicité, le spam et les liens promotionnels, le hors-sujet et les données personnelles d’autrui.