spanner-basics
Skill này làm gì
Skill này giúp bạn dùng Cloud Spanner, cơ sở dữ liệu có tính nhất quán toàn cầu của Google. Skill dành cho các nhóm cần cơ sở dữ liệu mở rộng qua nhiều vùng với tính nhất quán mạnh.
Khi nào nên dùng
- ✓Khi bạn muốn tạo một instance hoặc database Cloud Spanner.
- ✓Khi bạn cần thiết kế khóa chính hoặc schema tránh điểm nóng.
- ✓Khi truy vấn Spanner hoặc mã client chạy chậm và bạn cần chẩn đoán.
Liên kết skill
https://github.com/google/skills/blob/main/skills/cloud/spanner-basics/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thiết kế schema Cloud Spanner cho ứng dụng đơn hàng của tôi và cảnh báo tôi về mọi khóa chính có thể tạo điểm nóng.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích cách thiết lập instance và database, đồng thời cảnh báo về các khóa chính tăng dần theo thứ tự vì chúng có thể tạo điểm nóng. Skill yêu cầu phê duyệt trước mọi thay đổi database không dùng emulator.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
Câu hỏi thường gặp
Skill có tự thay đổi database đang chạy mà không hỏi không?
Không. Skill cần xác nhận rõ ràng trước mọi thay đổi DML hoặc DDL và mọi thao tác phá hủy.
Điểm nóng trong Spanner là gì?
Là tình huống nhiều lần ghi đều rơi vào cùng một đoạn của dải khóa, thường do khóa chính tuần tự gây ra.
Skill có hỗ trợ cấu trúc bảng cha con không?
Có. Skill gợi ý dùng bảng interleaved cho dữ liệu có liên quan chặt chẽ và thường được đọc cùng nhau.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 22k
- Vị trí xếp hạng
- #10351
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
finding-google-skills
22kGiúp agent của bạn tìm hướng dẫn Google phù hợp cho việc thiết lập, như hosting, cơ sở dữ liệu, lưu trữ, đăng nhập hoặc phục vụ mô hình AI.
gcloud
22kGiúp agent của bạn viết và kiểm tra các lệnh gcloud của Google Cloud, tra cứu cú pháp chính xác trước khi chạy bất cứ thứ gì để không đoán các flag.
google-cloud-recipe-auth
22kHướng dẫn agent của bạn qua quản lý danh tính và quyền truy cập của Google Cloud, gồm cách con người và dịch vụ đăng nhập và những quyền họ nhận được.
google-cloud-recipe-onboarding
22kHướng dẫn một lập trình viên mới qua các bước đầu tiên trên Google Cloud, gồm chọn dự án, liên kết thanh toán và triển khai tài nguyên đầu tiên.
Skill tương tự
discrawl
394kCho phép agent của bạn tìm kiếm và tóm tắt kho lưu trữ tin nhắn Discord trên máy, kiểm tra độ mới của dữ liệu và đọc tin nhắn trực tiếp.
clickhouse-io
280kGiúp agent của bạn tối ưu truy vấn và schema trong ClickHouse theo thực hành tốt nhất cho phân tích dữ liệu hiệu năng cao khi truy vấn chậm.
scientific-db-pubmed-database
280kGiúp agent của bạn tìm bài báo khoa học trong lĩnh vực y sinh. Hữu ích cho nghiên cứu cần thông tin y khoa cụ thể.