agentleFS
Google CloudKnown publisherGoogleCloudPlatform/DataflowTemplates/v2/datastream-to-spanner/.agents/skills/add-source-datastream-to-spanner/SKILL.md

add-source-datastream-to-spanner

Skill1.3k starsChanged 6 months agoApache-2.0View on GitHub

Guide for implementing a database source connector in the v2/datastream-to-spanner forward migration Dataflow template. Details scope boundaries, prerequisites, connector implementations, registry registrations, unit testing, and smoke testing guidelines.

  • Reads credentials

Trending

Quiet since October.about the whole repository

Jan 2026: 6 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 1 mentionMay 2026: 3 mentionsJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 2 mentionsOct 2026: 1 mentionNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the GoogleCloudPlatform/DataflowTemplates repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about GoogleCloudPlatform/DataflowTemplates

The biggest 5 of 34 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 34

Talked about on GitHub (34 times).

On GitHub · 34

29 more on GitHub

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Datastream Source Compatibility Check: Verify that Google Cloud Datastream natively supports the requested source database type by …

    line 23
  2. Distinctive:

    Datatype Mapping File: Ask the user to provide or point to the Datatype Mapping Matrix for the new source database, defining the mappings …

    line 26
  3. Distinctive:

    Test Setup Details: Ask the user for the test environment details required for live smoke testing, including:

    line 27
  4. Distinctive:

    All implementation for a new source connector MUST be strictly confined to:

    line 35
  5. Distinctive:

    Verify Datastream Support: Check if the requested source database type is supported by Datastream per Datastream Sources.

    line 54
  6. Very specific:

    Update corresponding registries and converter files in v2/spanner-common similar to existing sources.

    line 70
  7. Very specific:

    All unit tests must pass with BUILD SUCCESS.

    line 78
  8. Distinctive:

    UPDATE: Update existing rows in the source database.

    line 97
  9. Distinctive:

    DELETE: Delete test rows from the source database.

    line 98
  10. Distinctive:

    Verify that CDC events flow through Datastream to Cloud Storage and Dataflow.

    line 100
  11. Distinctive:

    If any CRUD operation fails to replicate or produces data discrepancies in Spanner, inspect error logs, modify the connector and converter …

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Implement Source in Datastream to Spanner Template

Overview

This skill provides a step-by-step procedure for adding support for a new database source connector to the v2/datastream-to-spanner template. It details prerequisites, scope boundaries, type mapping requirements, connector implementation, registry registration, unit testing, and smoke testing procedures.


Prerequisites

[!CRITICAL] MANDATORY PREREQUISITE GATE: Before running code searches, inspecting files, or executing unit tests, you MUST verify if the user provided the inputs below. If any required input is missing, STOP IMMEDIATELY and ask the user for clarification before proceeding further.

  1. Datastream Source Compatibility Check: Verify that Google Cloud Datastream natively supports the requested source database type by referencing Datastream Supported Sources.
    • [!CRITICAL]

    • If the requested source database is NOT supported by Datastream, STOP IMMEDIATELY and inform the user that Datastream does not support CDC streaming for this database source. Do NOT proceed with inspection, implementation, or testing.

  2. Datatype Mapping File: Ask the user to provide or point to the Datatype Mapping Matrix for the new source database, defining the mappings to Spanner GoogleSQL and PostgreSQL dialects.
  3. Test Setup Details: Ask the user for the test environment details required for live smoke testing, including:
    • Source Database Instance details (host/instance name, database name, and credentials/connection method).
    • Target Spanner Instance & Database details.
    • Datastream stream / connection profile setup or GCP project information.

Architectural Boundaries & Code Scope

All implementation for a new source connector MUST be strictly confined to:

  1. Source Connector Package: v2/datastream-to-spanner/src/main/java/com/google/cloud/teleport/v2/templates/source/<source_type>/
    • Implementation of IDsToSpSourceConnector (<Source>DsToSpSourceConnector.java)
    • Source-specific change event processing classes in package <source_type> (implemented similar to other existing source connectors in the codebase).
  2. Connector Registry: DatastreamToSpannerSourceConnectorRegistry.java
    • Dynamic connector registration via register(new <Source>DsToSpSourceConnector()).
  3. Shared Core Registries & Configs: v2/spanner-common
    • Registries and configuration files in spanner-common (updated similar to existing sources).

Datatype Mapping Matrix Requirements

Consult the Datatype Mapping Matrix provided in the prerequisites to verify correct datatype conversion to Spanner GoogleSQL and PostgreSQL dialects. Ensure proper alignment for character, numeric, temporal, binary, boolean, JSON and any other datatypes as specified in the mapping file.


Step-by-Step Implementation Workflow

Step 0: Mandatory Prerequisite Gate

  1. Verify Datastream Support: Check if the requested source database type is supported by Datastream per Datastream Sources. If unsupported, STOP IMMEDIATELY and notify the user.
  2. Verify Inputs: Inspect the request for the required inputs. If the Datatype Mapping Matrix and Test Setup Details are not provided in the user request, DO NOT run any inspection or execution tools. Stop and ask the user for the missing details first.

Step 1: Implement <Source>DsToSpSourceConnector

Implement IDsToSpSourceConnector in com.google.cloud.teleport.v2.templates.source.<source_type>:

  1. Define CDC metadata key constants required by the source.
  2. Implement any other methods in this class to work for GoogleSQL and PostgreSQL Spanner dialects similar to other supported sources.

Step 2: Implement Source Processing Classes

Implement remaining source-specific change event context and sequence classes in package com.google.cloud.teleport.v2.templates.source.<source_type> similar to other existing source connectors. Skip the types that are not supported by Datastream. These are mentioned in the type mapping skill.

Step 3: Register Source in Registries & Config Files

  1. Register connector in DatastreamToSpannerSourceConnectorRegistry.java:
    register(new <Source>DsToSpSourceConnector());
  2. Update corresponding registries and converter files in v2/spanner-common similar to existing sources.

Step 4: Unit Testing & Verification

Execute Maven unit tests for the template:

mvn test -pl v2/datastream-to-spanner \
  -Dtest=<Source>DsToSpSourceConnectorTest,DatastreamToSpannerSourceConnectorRegistryTest

All unit tests must pass with BUILD SUCCESS.

Step 5: Mandatory Live Smoke Testing & Verification

[!CRITICAL] MANDATORY EXECUTION REQUIREMENT: Immediately after unit tests pass, you MUST AUTOMATICALLY PROCEED to execute live end-to-end smoke testing using the test environment details provided in the prerequisites. Do NOT stop, pause, or declare completion after unit testing without running the live smoke tests.

[!IMPORTANT] WORKER MACHINE TYPE DIRECTIVE & FALLBACK RULE: When submitting the Dataflow job for live smoke testing, you MUST explicitly specify a worker machine type of the correct size with at least 4 vCPUs. If --worker-machine-type (or WORKER_MACHINE_TYPE) is not explicitly specified by the user or .env.testing, you MUST ALWAYS default to --worker-machine-type=n2-standard-4. Omitting this parameter or submitting null/blank will cause Dataflow job launch validation to fail with a machine specification policy violation.

  1. Environment Setup:
    • Connect to the live source database instance and target Spanner instance configured in the test setup.
  2. Perform CRUD Operations:
    • INSERT: Execute INSERT statements covering supported datatypes in the source database.
    • UPDATE: Update existing rows in the source database.
    • DELETE: Delete test rows from the source database.
  3. Verify Replication Flow:
    • Verify that CDC events flow through Datastream to Cloud Storage and Dataflow.
    • Query Cloud Spanner tables to confirm that INSERT, UPDATE, and DELETE operations are accurately reflected in Spanner.
  4. Retry Loop on Failure:
    • If any CRUD operation fails to replicate or produces data discrepancies in Spanner, inspect error logs, modify the connector and converter code, rebuild, and re-test until all operations pass cleanly.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.