Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

spanner-graph-schema-best-practices

БесплатноБез исполняемых скриптовНе проверен

Designs, reviews, and optimizes physical table schemas, indexes, and graph topologies for Spanner Graph on Google Cloud. Use when creating a new Spanner Graph…

googleот google★ 25 380 звёзд на GitHub

Об этом скилле

Spanner Graph Schema Design & Topology Best Practices

Design and optimize physical table layouts, primary keys, secondary indexes, and graph topologies for Spanner Graph (CREATE PROPERTY GRAPH) to maximize performance.

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.

Safety & Verification Rules

  • Obtain Confirmation Before Mutating Remote Databases: Do not execute gcloud spanner databases ddl update, create, or delete against a remote Spanner instance without explicit user confirmation, because DDL mutations on live databases can trigger long-running schema backfills or break production queries. Always validate candidate DDL on the local Spanner Emulator first or output the DDL commands for user approval.
  • Obtain Confirmation Before Changing the Cloud Environment: Ask the user before running gcloud services enable, changing the active project or billing account, or creating or deleting Spanner instances, because these commands change the user's Google Cloud environment and can incur costs.
  • Inspect Live Catalog Read-Only: When reviewing an existing Spanner database, export the schema with gcloud spanner databases ddl describe {database_id} --instance={instance_id} --project={project_id} rather than guessing column types or key orders.

Prerequisites & Cloud Environment Setup

Before running gcloud spanner or emulator commands, verify that the environment meets these Google Cloud requirements (see spanner-basics for general Spanner instance provisioning and MCP setup):

  1. Google Cloud SDK & Static DDL Fallback: Verify whether the CLI is installed (do not install gcloud without explicit user permission; see Install the gcloud CLI). If gcloud or the local emulator is unavailable, generate and review the Spanner Graph DDL statically using the rules and reference templates below.
  2. Project, Billing & API Enablement: Configure the target project (gcloud config set project {project_id}), ensure an active billing account is attached (required even when provisioning a free trial instance; see Spanner pricing and Google Cloud pricing), and, after the user confirms, enable the API:
    gcloud services enable spanner.googleapis.com --project={project_id}
    
  3. Authentication: Authenticate with gcloud auth login (interactive CLI), gcloud auth application-default login (local SDKs), or GOOGLE_APPLICATION_CREDENTIALS (service accounts).
  4. Required Identity and Access Management (IAM) Roles (Least Privilege):
    • roles/spanner.databaseReader (or roles/spanner.viewer) to inspect DDL via gcloud spanner databases ddl describe.
    • roles/spanner.databaseAdmin to create databases or apply schema updates (gcloud spanner databases ddl update).
  5. Region & Instance Configuration: When creating a new instance, select a supported regional or multi-region configuration such as regional-us-central1 (gcloud config set spanner/instance {instance_id}; see Instance configurations and Cloud locations).

Terminology Glossary

Use these canonical terms consistently when reasoning about and explaining Spanner Graph schemas:

Term Definition
Node table A physical Spanner table projected in NODE TABLES of CREATE PROPERTY GRAPH; each row is one node.
Edge table A physical table (or a node table projected a second time under an alias) listed in EDGE TABLES; each row is one directed edge from SOURCE KEY to DESTINATION KEY.
Node type / Edge type One node or edge table projection in the property graph, identified by its name or alias (for example, IpCard AS HasCard is an edge type).
Label The query-time name attached to a node or edge type via LABEL (static) or DYNAMIC LABEL (schemaless). One type can declare multiple labels, and one label can be shared by multiple types.
Property A column or scalar SQL expression (for example, CAST(...) or LOWER(...)) exposed on a node or edge type via PROPERTIES (...) or DYNAMIC PROPERTIES.
Folded edge A many-to-{0,1} or many-to-1 edge stored as a foreign-key column on the source node table, projected via {node_table} AS {edge_type} instead of a separate edge table.
1:N containment child node A node table interleaved in its parent node table (INTERLEAVE IN PARENT) because each child is owned by exactly one parent; it serves as both a node type and the parent-to-child edge type.
Remote interleaved index A secondary index on an edge table co-loca
Полный SKILL.md на GitHub

Установить spanner-graph-schema-best-practices в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/attribution.mdreferences/edge-traversal-and-indexing.mdreferences/topology-and-edge-folding.md

FAQ

Что делает скилл spanner-graph-schema-best-practices?

Designs, reviews, and optimizes physical table schemas, indexes, and graph topologies for Spanner Graph on Google Cloud. Use when creating a new Spanner Graph schema, selecting node and edge primary key types, optimizing forward, reverse, or per-node Top-K edge traversals, designing interleaved node or edge tables and covering indexes, configuring cascading deletes and row deletion policies (TTL), evaluating schematized versus schemaless dynamic label graphs, or folding 1:1 and N:1 edges into node tables. Don't use for tuning GQL query syntax or execution plans without schema changes (use spanner-graph-query-tuning), or when creating a zero-change graph overlay on existing relational tables (use spanner-relational-to-graph).

Как установить скилл spanner-graph-schema-best-practices?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл spanner-graph-schema-best-practices запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить spanner-graph-schema-best-practices с