spanner-basics
できること
このスキルは、世界規模で一貫性を保つ Google のデータベース Cloud Spanner の使い方を支援します。強い一貫性を保ちながら、複数のリージョンでスケールするデータベースが必要なチーム向けです。
使う場面
- ✓Cloud Spanner のインスタンスやデータベースを用意したいとき。
- ✓ホットスポットを避けるための主キーやスキーマを設計したいとき。
- ✓Spanner のクエリやクライアントのコードが遅く、原因を調べる必要があるとき。
スキルのリンク
https://github.com/google/skills/blob/main/skills/cloud/spanner-basics/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“注文管理アプリ向けの Cloud Spanner のスキーマを設計し、ホットスポットを生じる恐れのある主キーがあれば警告してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
インスタンスとデータベースの設定方法を説明し、連続的に増える主キーがホットスポットを生むことを警告します。エミュレーター以外のデータベース変更の前には、必ず承認を求めます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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. 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
- Use
gcloud spanner databases ddl updateto apply schema updates (such as CREATE, ALTER, or DROP tables and indexes). - Reference schema-design.md for guidelines on primary key selection and interleaved tables.
Diagnosing Performance Issues
- Use
SPANNER_SYStables to identify slow or resource-intensive queries. - For example, query
SPANNER_SYS.QUERY_STATS_TOP_HOURto find queries with the highest CPU usage.
Reference Directory
- Core Concepts: Explanation of Spanner internals, architecture, and design.
- CLI Usage: Essential
gcloud spannercommand-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.
- Queues Usage: Cloud Spanner Queues: mental model, design constraints, and links related to transactional message queues.
- 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.
よくある質問
本番のデータベースを確認なしで変更しますか?
いいえ。DML や DDL の変更、破壊的な操作の前には、明示的な確認が必要です。
Spanner のホットスポットとは何ですか?
多くの書き込みが、キー範囲の同じ部分に集中する現象です。連続する主キーが原因になることが多いです。
親子テーブルの構成に対応していますか?
はい。一緒に読まれることが多い、強く関連するデータには、インターリーブテーブルを提案します。
詳細
作者による元の説明
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.
repo: google/skills
人気
- GitHubのスター
- 22k
- ランキング
- #10351
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
finding-google-skills
22kセットアップ作業に合うGoogleの公式ガイドを探すようエージェントを支援します。ホスティング、データベース、ストレージ、サインイン、AIモデルの提供などが対象です。
gcloud
22kエージェントが、Google CloudのgcloudコマンドについてWeb検索に頼らず、正確な構文を確かめてから書いたり確認したりできるよう支援します。
google-cloud-recipe-auth
22kエージェントが、Google Cloudのアイデンティティとアクセス(人やサービスがどうサインインし、どの権限を得るか)について、手順を案内できるよう支援します。
google-cloud-recipe-onboarding
22k新しい開発者が、プロジェクトの選択、請求の設定、最初のリソースのデプロイなど、Google Cloudの最初の手順を進められるよう案内します。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。