Guide · Agent skill
How to use the Cloud Spanner Basics agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The spanner-basics skill is a set of instructions and reference guides that teaches an AI coding agent the conventions of Google Cloud Spanner, a fully managed relational database. It is for developers designing or reviewing a Spanner schema, engineers diagnosing slow queries, and teams writing Spanner client code or Terraform. After this guide you will know how to install the skill, how to ask for help in plain language, and which safety rules the agent follows.
Quick start
- 1Download the ZIP. Get the spanner-basics ZIP file from the skill page on this site.
- 2Unzip it into a skills folder. Unzip into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project folder.
- 3Or upload it in the Claude apps. Open Settings, go to Capabilities, then Skills, and upload the ZIP.
- 4Install the tools you need. Set up the gcloud CLI, and the Spanner client library or Terraform if your task needs them.
- 5Ask in plain language. Describe your Spanner task, such as a primary key question or a slow query, and review each command before approving it.
What does the spanner-basics skill make the agent do?
Once installed, the agent follows Spanner guidance when you ask about provisioning instances and databases, designing schemas, writing SQL or client library code, or diagnosing performance problems. The skill covers primary key design that avoids hotspots, when to use interleaved parent-child tables, and how to write gcloud, client library, Terraform and PostgreSQL-dialect code.
For performance work, the skill points the agent to the SPANNER_SYS tables, such as SPANNER_SYS.QUERY_STATS_TOP_HOUR, to find the queries using the most CPU.
- Design primary keys that avoid monotonically increasing values, such as sequential timestamps, as the first part of the key.
- Prefer interleaved tables for strongly related parent-child data that is accessed together.
- Generate gcloud spanner, client library, Terraform and PostgreSQL-dialect examples.
- Look for slow or resource-intensive queries in SPANNER_SYS statistics.
How do you install the spanner-basics skill?
Download the ZIP file from the skill page on this site. You can install it in one of two ways: unzip it into your personal skills folder, or into a project folder, or upload it in the Claude apps.
For a personal install, unzip it into ~/.claude/skills/. For a single project, unzip it into the .claude/skills/ folder inside that project. In the Claude apps, open Settings, go to Capabilities, then Skills, and upload the ZIP there.
- Personal: ~/.claude/skills/
- Project: .claude/skills/ inside your project folder
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
How do you trigger the skill with natural requests?
You do not need a special command. Describe the task in plain language that mentions Spanner and the kind of help you need. The skill's description covers primary key design, SQL queries, client library code, and performance diagnosis, so requests on those topics are the ones it is meant to handle.
Name the database or instance when you can. The agent cannot always check that resources exist, so specific names help it write correct commands.
- Help me choose a primary key for an Orders table in Cloud Spanner that will not create hotspots.
- Should Invoices be interleaved under Customers in my Spanner schema?
- Find the slowest queries in my Spanner database over the last hour.
- Write Python client code to read rows from my Spanner database.
- Write Terraform for a regional Spanner instance with one node.
What does a typical session look like?
For a schema change, the agent suggests the DDL and the gcloud command to apply it. It will not run that change on its own. For example, the skill uses gcloud spanner databases ddl update to apply CREATE, ALTER, or DROP statements for tables and indexes.
For a read-only command such as listing instances, the same approach applies: the agent gives you the command to run. The skill's reference files include CLI commands for creating instances and databases, listing them, and running queries with execute-sql.
gcloud spanner databases list --instance=my-instanceWhat does the skill need to work?
You need a Google Cloud account and the gcloud CLI for command-line operations. The gcloud install instructions are at docs.cloud.google.com/sdk/docs/install-sdk. If you write code, you need the Spanner client library for your language: Java, Go, Python or Node.js. For Python, the source gives pip install google-cloud-spanner. Terraform is needed only if you use the Terraform examples. The Spanner remote MCP server and the Developer Knowledge MCP server are optional and used only if you set them up.
The skill makes network calls. It does not run scripts.
- Google Cloud account and gcloud CLI for command-line work
- Spanner client library for Java, Go, Python or Node.js, if writing code
- Terraform, if using the Terraform examples
- Spanner remote MCP server and Developer Knowledge MCP server, if used
pip install google-cloud-spannerWhat safety rules does the skill enforce?
The skill tells the agent to get your explicit confirmation before any non-emulator database change, whether DML or DDL, and before any destructive operation such as dropping tables, indexes or other Spanner resources. The agent should output the command, for example gcloud spanner databases ddl update, and ask for approval rather than run it.
The skill also tells the agent to read the usage attribution guide before running gcloud, REST or MCP commands. For terminal commands, it adds the metrics variable CLOUDSDK_METRICS_REQUEST_ATTRIBUTION inline on each command, and does not use gcloud config set for this.
- Expect approval prompts before any schema or data change.
- If the agent cannot verify that an instance, database or table exists, it may assume the resources exist and write DDL. Check the target project and names before running anything.
- Its reference files are guides, not executable tools.
What tips help you get the best results?
Review every generated DDL statement before you approve it, especially the project, instance and database names. Use the skill for design and review, and test changes in a non-production environment first. If the skill lacks a product detail, the skill directs the agent to the search_documents tool of the Developer Knowledge MCP server.
- Give the agent your instance and database names and the language you use.
- Ask for the reasoning behind a primary key choice, not just the answer.
- Check generated Terraform and client code against your own environment before use.
What people use it for
- Reviewing a primary key for a new Spanner table to avoid hotspots from sequential values.
- Deciding whether a child table should be interleaved under a parent table.
- Finding the highest-CPU queries in the last hour using SPANNER_SYS statistics.
- Drafting gcloud, client library or Terraform code for a Spanner instance and database.
Frequently asked questions
Is the spanner-basics skill free to use?
The source does not state a price or licence terms for using the skill beyond its licence of Apache-2.0. Cloud Spanner itself is a Google Cloud service, so check Google Cloud's pricing for database costs.
What do I need before I install spanner-basics?
You need the skill ZIP file from this site and a folder where your agent loads skills. For command-line work you also need a Google Cloud account and the gcloud CLI, and a Spanner client library if you write code.
Where do I put the spanner-basics skill folder?
Unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project. You can also upload the ZIP in the Claude apps under Settings, Capabilities, Skills.
Does the skill run commands on my database by itself?
No. The skill tells the agent to get your explicit approval before any non-emulator DDL or DML change or destructive operation, and to output the command instead of running it.
Does spanner-basics work for Cloud SQL, Postgres or MySQL?
No. The guidance covers Cloud Spanner only, so it does not apply to other databases such as Cloud SQL, Postgres or MySQL.
Why does the agent sometimes write DDL for resources it cannot find?
When database access is unavailable or authentication fails, the skill tells the agent to assume the instance, database and table exist. This can produce DDL that fails or targets the wrong project, so check names before running anything.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use spanner-basics if you design, review or debug Cloud Spanner schemas and queries and want an agent that knows Spanner conventions and asks before changing anything. Pick something else if you use Cloud SQL, Postgres or MySQL, or if you need an unattended tool that makes database changes without confirmation.
Download the skill