Spanner Basics

Spanner Basics

Helps provision Cloud Spanner instances and databases, design schemas and primary keys, write queries and client code, and diagnose performance issues, asking before any changes.

Skill files11 files

references/

SKILL.md62 lines
1
---
2
name: spanner-basics
3
metadata:
4
version: "1.1.2"
5
category: Databases
6
description: >-
7
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.
8
---
9
10
# Spanner Basics
11
12
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.
13
14
## Attribution
15
16
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
17
MUST read [Usage Attribution](references/attribution.md). For commands executed
18
directly in the terminal (never in generated scripts, Terraform, or user code),
19
prefix `gcloud` with
20
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:spanner-basics)"`
21
and append `agent-skills/1.0 (skill:spanner-basics)` to `User-Agent` headers.
22
23
## Core Principles
24
25
- **Performance First:** Spanner scales horizontally. Efficiency is tied to
26
Primary Key design. Always warn against using monotonically increasing/decreasing
27
values (like sequential timestamps) as the first part of a primary key to avoid hotspots.
28
- **Schema Design:** Prefer interleaved tables for strongly related parent-child data
29
that is frequently accessed together.
30
31
## Safety
32
33
> [!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.
34
> 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.
35
36
## Common Workflows
37
38
### Schema Evolution & DDL
39
40
1. Use `gcloud spanner databases ddl update` to apply schema updates (such as CREATE, ALTER, or DROP tables and indexes).
41
2. Reference [schema-design.md](references/schema-design.md) for guidelines on primary key selection and interleaved tables.
42
43
### Diagnosing Performance Issues
44
45
1. Use `SPANNER_SYS` tables to identify slow or resource-intensive queries.
46
2. For example, query `SPANNER_SYS.QUERY_STATS_TOP_HOUR` to find queries with the highest CPU usage.
47
48
## Reference Directory
49
50
- [Core Concepts](references/core-concepts.md): Explanation of Spanner internals, architecture, and design.
51
- [CLI Usage](references/cli-usage.md): Essential `gcloud spanner` command-line operations for managing instances and databases.
52
- [IAM Security](references/iam-security.md): Roles, permissions, and data governance best practices for Spanner.
53
- [Client Library Usage](references/client-library-usage.md): Using Google Cloud client libraries for Spanner (Java, Go, Python, Node.js).
54
- [Terraform Usage](references/terraform-usage.md): Infrastructure as Code examples for provisioning Spanner instances and databases.
55
- [MCP Usage](references/mcp-usage.md): Using the Spanner remote MCP server.
56
- [PostgreSQL Dialect](references/postgresql-dialect.md): Best practices and examples for using the PostgreSQL interface in Spanner.
57
- [Queues Usage](references/queues-usage.md): Cloud Spanner Queues: mental model, design constraints, and links related to transactional message queues.
58
- [Schema Design](references/schema-design.md): Guidelines on primary key selection and interleaved tables for performance.
59
60
If you need product information that's not found in these references, use the
61
`search_documents` tool of the Developer Knowledge MCP server.
62

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…