AGENT SKILL

migrate-database

Move an existing Oracle, MySQL or PostgreSQL database to ScalarDB: schema analysis, migration documents, stored procedures and triggers converted to Java. Use for any database-to-ScalarDB migration.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 13
Forks
1

01 前言 Front Matter

model
sonnet
description
Move an existing Oracle, MySQL or PostgreSQL database to ScalarDB: schema analysis, migration documents, stored procedures and triggers converted to Java. Use for any database-to-ScalarDB migration.

03 SKILL.md 正文

Command: migrate-database (Unified Migration Entry Point)

Shared files: a path written @rules/…, @skills/…, @templates/… or @docs/… is relative to the plugin root, ${CLAUDE_PLUGIN_ROOT} — not to the project being worked on. Read it from there.

Purpose

Unified entry point for all database-to-ScalarDB migrations. Asks the user which database type they want to migrate, then delegates to the appropriate database-specific command which handles everything: configuration detection, parameter collection, schema analysis, and migration documentation generation.

Knowledge grounding: the delegated workflows must verify ScalarDB capabilities (supported databases, data types, transaction guarantees, edition-gated features) against the version-pinned OKF knowledge bundle per @rules/okf-knowledge-bundle.md — pin the target ScalarDB version first and cite the concept's resource URL, not memory.

Application SQL: this router migrates schemas, stored procedures and triggers. The SQL the application runs — MyBatis mappers, JDBC and Spring JDBC calls, JPA native queries, batch scripts — is migrated statement by statement by /architect:design-sql-migration → /architect:implement-sql-migration → /architect:verify-sql-migration; point the user there when the question is about queries rather than tables.


Execution Instructions

Follow these steps in order, without skipping either: the first decides which database-specific skill the second delegates to.


STEP 1: Ask Which Database to Migrate

Use the AskUserQuestion tool to determine the source database:

{
  "questions": [
    {
      "question": "Which database do you want to migrate to ScalarDB?",
      "header": "Database",
      "options": [
        {"label": "Oracle", "description": "Migrate Oracle schema to ScalarDB"},
        {"label": "MySQL", "description": "Migrate MySQL schema to ScalarDB"},
        {"label": "PostgreSQL", "description": "Migrate PostgreSQL schema to ScalarDB"}
      ],
      "multiSelect": false
    }
  ]
}

Save the user's response.


STEP 2: Delegate to the Database-Specific Skill

Based on the user's selection, invoke the corresponding skill using the Skill tool:

User Selection Skill to Invoke
Oracle Skill: architect:migrate-oracle
MySQL Skill: architect:migrate-mysql
PostgreSQL Skill: architect:migrate-postgresql

The delegated command handles the entire workflow autonomously:

Phase A: Interactive Configuration (Steps 1-6) — Main Context

  1. Reads or detects missing .claude/configuration/databases.env
  2. Collects connection parameters (Batch 1 of 2) via AskUserQuestion
  3. Collects authentication & options (Batch 2 of 2) via AskUserQuestion
  4. Maps user responses to configuration values
  5. Writes or updates databases.env
  6. Ensures output directory exists

Phase B: Subagent Processing — Isolated Contexts

Oracle (Steps 7-11 — 6 subagents):

Step Subagent Type What It Does
7 Connection Tester Bash Verifies DB is reachable via SQL*Plus
8 Schema Extractor Bash Runs oracle_db_extractor.py
9 Report Generator general-purpose Reads JSON + template, writes schema report
10 Migration Analyst + AQ Migrator + SP/Trigger Migrator general-purpose ×3 Parallel: migration docs + AQ Java code + SP/trigger Java code
11 (main context) — Displays combined summary + metrics table

MySQL / PostgreSQL (Steps 7-11 — 5 subagents):

Step Subagent Type What It Does
7 Connection Tester Bash Verifies DB is reachable via Python connector
8 Schema Extractor Bash Runs *_db_extractor.py
9 Report Generator general-purpose Reads JSON + template, writes schema report
10 Migration Analyst + SP Migrator general-purpose x2 Parallel: migration docs + Java code
11 (main context) — Displays combined summary

Error cascading applies: if any subagent fails, later subagents are not spawned.

Perform no further steps after invoking the skill: the delegated command produces the final output, and anything added here would repeat or contradict it.


STEP 3: Error Handling

  • User selects "Other" with an unrecognized database type: Inform the user: "Currently, only Oracle, MySQL, and PostgreSQL are supported for ScalarDB migration. Please choose one of the three supported databases." Then re-ask the question from Step 1.

  • User cancels or does not respond: Stop execution and inform the user they can restart with /architect:migrate-database or use a direct command (/architect:migrate-oracle, /architect:migrate-mysql, /architect:migrate-postgresql).


Related Commands

Command Description
/architect:migrate-oracle Direct Oracle migration (skips database selection)
/architect:migrate-mysql Direct MySQL migration (skips database selection)
/architect:migrate-postgresql Direct PostgreSQL migration (skips database selection)

Related Files

  • Config: .claude/configuration/databases.env
  • Output: .claude/output/ (generated reports)
  • Subagent Prompts: ${CLAUDE_PLUGIN_ROOT}/skills/common/subagents/{oracle,mysql,postgresql}/

04 同仓库更多 Skills