Generated banner for Spanner Data
Generated logo for Spanner Data

Spanner Data

ClineOfficialPublished by Cline

  • Skill
  • Tool integration
  • Data and AI
  • Apache-2.0
  • Low risk
  • Has scripts

From the author

Use these skills when you need to explore the database structure, discover schema objects like tables and graphs, and execute custom SQL queries to interact with your data.
— the description by Cline

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The spanner-data skill provides a set of utilities for developers to manage and query Google Cloud Spanner databases. It enables users to inspect database structures by listing tables and graph schemas, and supports executing both DML and DQL SQL queries using the GoogleSQL interface.

What it does

  • Executes DML SQL statements against a Spanner database.
  • Runs DQL SQL queries to retrieve data.
  • Lists detailed schema information for tables, including columns, constraints, and indexes.
  • Retrieves graph schema details such as node tables, edge tables, and property declarations.
  • Supports filtering schema discovery by specific table or graph names.
  • Provides flexible output formats for schema discovery, ranging from simple lists to detailed metadata.

When to use it

  • When you need to perform ad-hoc data retrieval or updates in a Spanner database.
  • When you need to verify table structures, indexes, or constraints during development.
  • When exploring the schema of graph-based data models within Spanner.
  • When you need to programmatically inspect database objects via an AI agent.

Advantages

  • Simplifies database interaction by providing direct execution tools.
  • Automates the discovery of complex schema objects like graphs and partitioned tables.
  • Integrates seamlessly into Node.js environments with automatic environment variable loading.
  • Supports both simple and detailed schema reporting for better readability.

Usage examples

“List all tables in my Spanner database.”
The agent calls list_tables to retrieve and display the schema details for all user-created tables.
“Run a query to select all users from the Users table.”
The agent uses execute_sql_dql to run the provided SELECT statement and returns the result set.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/cline/spanner-data/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip spanner-data.zip -d .agents/skills

Documentation by Cline

Usage

All scripts can be executed using Node.js. Replace <param_name> and <param_value> with actual values.

Bash: node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'

PowerShell: node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'

Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.

Scripts

execute_sql

Use this tool to execute DML SQL. Please use the googlesql interface for Spanner.

Parameters
NameTypeDescriptionRequiredDefault
sqlstringThe sql to execute.Yes

execute_sql_dql

Use this tool to execute DQL SQL. Please use the googlesql interface for Spanner.

Parameters
NameTypeDescriptionRequiredDefault
sqlstringThe sql to execute.Yes

list_graphs

Lists detailed graph schema information (node tables, edge tables, labels and property declarations) as JSON for user-created graphs. Filters by a comma-separated list of graph names. If names are omitted, lists all graphs. The output can be 'simple' (graph names only) or 'detailed' (full schema).

Parameters
NameTypeDescriptionRequiredDefault
graph_namesstringOptional: A comma-separated list of graph names. If empty, details for all graphs in user-accessible schemas will be listed.No``
output_formatstringOptional: Use 'simple' to return graph names only or use 'detailed' to return the full information schema.Nodetailed

list_tables

Lists detailed schema information (object type, columns, constraints, indexes) as JSON for user-created tables (ordinary or partitioned). Filters by a comma-separated list of names. If names are omitted, lists all tables in user schemas. The output can be 'simple' (table names only) or 'detailed' (full schema).

Parameters
NameTypeDescriptionRequiredDefault
table_namesstringOptional: A comma-separated list of table names. If empty, details for all tables in user-accessible schemas will be listed.No``
output_formatstringOptional: Use 'simple' to return table names only or use 'detailed' to return the full information schema.Nodetailed

Files

scripts/execute_sql_dql.js

#!/usr/bin/env node

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const { spawn, execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const os = require('os');

const toolName = "execute_sql_dql";
const configArgs = ["--prebuilt", "spanner"];

const OPTIONAL_VARS_TO_OMIT_IF_EMPTY = [
    'SPANNER_DIALECT',
];


function mergeEnvVars(env) {
	if (process.env.GEMINI_CLI === '1') {
		const envPath = path.resolve(__dirname, '../../../.env');
		if (fs.existsSync(envPath)) {
			const envContent = fs.readFileSync(envPath, 'utf-8');
			envContent.split('\n').forEach(line => {
				const trimmed = line.trim();
				if (trimmed && !trimmed.startsWith('#')) {
					const splitIdx = trimmed.indexOf('=');
					if (splitIdx !== -1) {
						const key = trimmed.slice(0, splitIdx).trim();
						let value = trimmed.slice(splitIdx + 1).trim();
						value = value.replace(/(^['"]|['"]$)/g, '');
						if (env[key] === undefined) {
							env[key] = value;
						}
					}
				}
			});
		}
	} else if (process.env.CLAUDECODE === '1') {
		const prefix = 'CLAUDE_PLUGIN_OPTION_';
		for (const key in process.env) {
			if (key.startsWith(prefix)) {
				env[key.substring(prefix.length)] = process.env[key];
			}
		}
	}
}

function prepareEnvironment() {
	let env = { ...process.env };
	let userAgent = "skills";
	if (process.env.GEMINI_CLI === '1') {
		userAgent = "skills-geminicli";
	} else if (process.env.CLAUDECODE === '1') {
		userAgent = "skills-claudecode";
	} else if (process.env.CODEX_CI === '1') {
        userAgent = "skills-codex";
    }
	mergeEnvVars(env);
	
	OPTIONAL_VARS_TO_OMIT_IF_EMPTY.forEach(varName => {
		if (env[varName] === '') {
			delete env[varName];
		}
	});
	

	return { env, userAgent };
}

function main() {
    const { env, userAgent } = prepareEnvironment();
    const args = process.argv.slice(2);
		
		const command = os.platform() === 'win32' ? 'npx.cmd' : 'npx';
		const processedArgs = os.platform() === 'win32' ? args.map(arg => arg.includes('"') ? '"' + arg.replace(/"/g, '""') + '"' : arg) : args;
		const npxArgs = ["--yes", "@toolbox-sdk/[email protected]", "--log-level", "error", ...configArgs, "invoke", toolName, "--user-agent-metadata", userAgent, ...processedArgs];

		const child = spawn(command, npxArgs, { shell: os.platform() === 'win32', stdio: 'inherit', env });
		

    child.on('close', (code) => {
        process.exit(code);
    });

    child.on('error', (err) => {
        console.error("Error executing toolbox:", err);
        process.exit(1);
    });
}

main();

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Cline
Publisher
Cline (Official)
Source
cline/skills · skills/spanner-data · commit 2637846
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Cline or Cline.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download spanner-data.zip