Agent Skillsgoogle/skills › spanner-basics

spanner-basics

GitHub

提供 Google Cloud Spanner 的核心工作流与指导,涵盖实例配置、高性能 Schema 设计(如主键选择)、SQL 查询编写及性能诊断。旨在辅助开发与管理 Spanner 数据库,确保数据一致性与系统高效运行。

skills/cloud/spanner-basics/SKILL.md google/skills

Trigger Scenarios

Spanner 数据库 Schema 设计与优化 编写 Spanner SQL 或客户端库代码 诊断 Spanner 查询性能问题 管理 Spanner 实例与数据库资源

Install

npx skills add google/skills --skill spanner-basics -g -y
More Options

Non-standard path

npx skills add https://github.com/google/skills/tree/main/skills/cloud/spanner-basics -g -y

Use without installing

npx skills use google/skills@spanner-basics

指定 Agent (Claude Code)

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

安装 repo 全部 skill

npx skills add google/skills --all -g -y

预览 repo 内 skill

npx skills add google/skills --list

SKILL.md

Frontmatter
{
    "name": "spanner-basics",
    "metadata": {
        "category": "Databases"
    },
    "description": "Assists in provisioning instances and databases, designing performant schemas, and querying data in Spanner. 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 Google Cloud Spanner, a fully managed, mission-critical database service offering global transactional consistency and automatic, synchronous replication for high availability.

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 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: Explanation of Spanner internals, architecture, and design.
  • CLI Usage: Essential gcloud spanner command-line operations for managing instances and databases.
  • IAM Security: Roles, permissions, and data governance best practices for Spanner.
  • Client Library Usage: Using Google Cloud client libraries for Spanner (Java, Go, Python, Node.js).
  • Terraform Usage: Infrastructure as Code examples for provisioning Spanner instances and databases.
  • MCP Usage: Using the Spanner remote MCP server.
  • PostgreSQL Dialect: Best practices and examples for using the PostgreSQL interface in Spanner.
  • Schema Design: 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.

Version History

  • 05679aa Current 2026-07-31 08:02

Same Skill Collection

skills/ads/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api-setup/SKILL.md
skills/ads/data-manager-api/data-manager-api-audience-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-event-ingestion/SKILL.md
skills/ads/data-manager-api/data-manager-api-setup/SKILL.md
skills/ads/google-ads-api-mcp-setup/SKILL.md
skills/ads/google-ads-api/google-ads-api-mcp-setup/SKILL.md
skills/ads/google-mobile-ads-android-migrate-to-next-gen/SKILL.md
skills/ads/google-mobile-ads-banner/SKILL.md
skills/ads/google-mobile-ads-get-started/SKILL.md
skills/ads/google-mobile-ads-interstitial/SKILL.md
skills/ads/google-mobile-ads-rewarded/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-android-migrate-to-next-gen/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-banner/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-get-started/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-interstitial/SKILL.md
skills/ads/google-mobile-ads/google-mobile-ads-rewarded/SKILL.md
skills/ads/ima-sdk-basics/SKILL.md
skills/ads/interactive-media-ads/ima-sdk-basics/SKILL.md
skills/analytics/google-analytics-admin-api-basics/SKILL.md
skills/cloud/agent-platform-alert-configuration/SKILL.md
skills/cloud/agent-platform-endpoint-management/SKILL.md
skills/cloud/agent-platform-migrate-from-ai-studio/SKILL.md
skills/cloud/agent-platform-model-registry/SKILL.md
skills/cloud/agent-platform-prompt-management/SKILL.md
skills/cloud/agent-platform-rag-engine-management/SKILL.md
skills/cloud/agent-platform-skill-registry/SKILL.md
skills/cloud/agent-platform-troubleshooting/SKILL.md
skills/cloud/agent-platform-tuning-management/SKILL.md
skills/cloud/agent-platform-tuning/SKILL.md
skills/cloud/alloydb-basics/SKILL.md
skills/cloud/bigquery-basics/SKILL.md
skills/cloud/bigquery-bigframes/SKILL.md
skills/cloud/bigtable-basics/SKILL.md
skills/cloud/cloud-logging-configuration-basics/SKILL.md
skills/cloud/cloud-logging-cross-project-configuration/SKILL.md
skills/cloud/cloud-logging-query-generation/SKILL.md
skills/cloud/cloud-monitoring-metric-selection/SKILL.md
skills/cloud/cloud-run-basics/SKILL.md
skills/cloud/datalineage-summary/SKILL.md
skills/cloud/detection-engineering-coverage-evaluation/SKILL.md
skills/cloud/developer-device-platform-basics/SKILL.md
skills/cloud/firebase-basics/SKILL.md
skills/cloud/gcloud/SKILL.md
skills/cloud/gemini-agents-api/SKILL.md
skills/cloud/gemini-api/SKILL.md
skills/cloud/gemini-interactions-api/SKILL.md
skills/cloud/gke-ai-troubleshooting-jobset-interruption/SKILL.md
skills/cloud/gke-app-onboarding/SKILL.md

Metadata

Files
0
Version
777fb8e
Hash
69360a00
Indexed
2026-07-31 08:02

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-07 16:35
浙ICP备14020137号-1 $Гость$