[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HR993R520NRCNZ0P54GSZ5":3,"skill-same:01M6HR993R520NRCNZ0P54GSZ5":99},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":46,"ownerHtmlUrl":47,"ownerBlogUrl":48,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M6HR993R520NRCNZ0P54GSZ5","migrate-oracle-aq-to-scalardb",null,"Generates Oracle AQ setup SQL (payload types, queues, enqueue triggers\u002FSPs) and Java consumer files that dequeue messages and process them using the ScalarDB Java Transaction API.","wfukatsu\u002Fnexus-architect","wfukatsu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11712747?v=4","01M6HR128TEJY1WD0C36TDQD7S","Wataru Fukatsu","01M6HR12D55WNY36YSW845YXZ1",13,"MIT","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"migrate oracle aq to scalardb","migrate oracle","aq","migrate","oracle","payload","opus","types","triggers","transaction","files","process","api","messages","java","sql","setup","2026-11-10 10:12:30",false,"---\ndescription: Generates Oracle AQ setup SQL (payload types, queues, enqueue triggers\u002FSPs) and Java consumer files that dequeue messages and process them using the ScalarDB Java Transaction API.\nmodel: opus\n---\n\n# Migrate Oracle Stored Procedures & Triggers to AQ + ScalarDB Consumer Skill\n\n## Purpose\n\nConvert Oracle triggers and stored procedures into an **event-driven architecture** using Oracle Advanced Queuing (AQ) as the messaging layer and ScalarDB Java Transaction API as the consumer layer.\n\n**Producer side (Oracle SQL):** Triggers and stored procedures are replaced with AQ enqueue operations — triggers contain no business logic and simply call enqueue SPs.\n\n**Consumer side (Java):** Message consumer classes dequeue from AQ using JMS and write to ScalarDB-managed tables using the Java Transaction API.\n\nThis skill produces:\n1. A **complete SQL file** (`aq_setup.sql`) for the Oracle producer side\n2. **Java consumer files** for the ScalarDB consumer side\n3. An **AQ migration report** documenting all conversions\n\n---\n\n## Skill Responsibility\n\nThis skill is responsible for:\n- Analyzing triggers and stored procedures from extracted schema JSON\n- Determining which triggers\u002FSPs should be converted to AQ enqueue patterns\n- Generating SQL for payload types, queue tables, queues, modified triggers, and enqueue SPs\n- Generating Java consumer service classes (dequeue + ScalarDB Transaction API)\n- Generating message POJO classes and helper utilities\n- Producing an AQ migration report\n\nThis skill is **NOT** responsible for:\n- Orchestration or command handling (handled by `\u002Foracle-to-scalardb` command)\n- Schema extraction (handled by Subagent 1)\n- Schema report generation (handled by Subagent 2)\n- General migration analysis (handled by Subagent 3)\n- Direct SP\u002Ftrigger to Java conversion without AQ (handled by Subagent 5)\n- Creating a full consumer application (build files, main class, deployment config)\n\n---\n\n## Input Contract\n\n| Input | Type | Required | Description |\n|-------|------|----------|-------------|\n| `raw_schema_data.json` | File | YES | Extracted Oracle schema data (specifically the `plsql` section) |\n| `oracle_schema_report.md` | File | YES | Schema report (for table\u002Fcolumn context needed for accurate Key builders) |\n| `aq-migration-strategy-guide.md` | File | YES | Reference doc with AQ conversion patterns and code examples |\n| `aq-exception-handling-strategy.md` | File | YES | Exception classification and retry\u002Fcommit strategy for consumer error handling |\n| `output_directory` | Directory | YES | Where to write generated files |\n\n---\n\n## Output Contract\n\n| Output | Location | Description |\n|--------|----------|-------------|\n| AQ Setup SQL | `\u003COUTPUT_DIR>\u002Faq_setup.sql` | Complete SQL file: payload types, queues, triggers, enqueue SPs |\n| Java Consumer Classes | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002F\u003CQueueName>Consumer.java` | One consumer per queue\u002Fmessage-type |\n| Java Message POJOs | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002F\u003CPayloadName>Message.java` | One POJO per payload type |\n| Java Helper Utility | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002FAqStructHolder.java` | Reusable Oracle STRUCT wrapper for ojdbc11 |\n| Exception Classifier | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002FExceptionClassifier.java` | Classifies exceptions into RETRIABLE \u002F NON_RETRIABLE \u002F UNKNOWN_TX_STATE for AQ session handling |\n| AQ Migration Report | `\u003COUTPUT_DIR>\u002Fscalardb_aq_migration_report.md` | Report documenting all conversions |\n\n---\n\n## How to Parse the JSON\n\nRead `raw_schema_data.json` and extract these sections from `plsql`:\n\n| JSON Path | Contains |\n|-----------|----------|\n| `plsql.procedures` | Procedure metadata (name, deterministic, parallel, authid) |\n| `plsql.functions` | Function metadata (name, return_type, deterministic) |\n| `plsql.packages` | Package metadata (name, authid, spec\u002Fbody status) |\n| `plsql.triggers` | Trigger metadata (name, table, timing, event, status) |\n| `plsql.arguments` | Parameters for procedures\u002Ffunctions |\n| `plsql.source` | PL\u002FSQL source code (grouped by NAME, TYPE, ordered by LINE) |\n| `plsql.trigger_source` | Trigger body source code |\n| `plsql.procedure_ddl` | Full DDL for procedures |\n| `plsql.function_ddl` | Full DDL for functions |\n| `plsql.trigger_ddl` | Full DDL for triggers |\n\nAlso read `oracle_schema_report.md` to extract:\n- Table names and their columns with data types\n- Primary key definitions (needed to build correct `Key.of*()` calls)\n- Foreign key relationships (needed for multi-table operations)\n\n---\n\n## Conversion Decision Logic\n\n### Which triggers\u002FSPs get converted to AQ?\n\nAnalyze each trigger and stored procedure to determine if it should be converted to AQ:\n\n| Object | Convert to AQ? | Rationale |\n|--------|---------------|-----------|\n| Trigger with DML (INSERT\u002FUPDATE\u002FDELETE on another table) | YES | The DML becomes a consumer-side ScalarDB operation |\n| Trigger that calls an SP doing DML | YES | Both trigger and SP are converted |\n| Trigger with only validation\u002Fdefaults (no cross-table DML) | NO | Keep as application-layer validation |\n| SP that INSERTs\u002FUPDATEs\u002FDELETEs records | YES | The DML moves to the consumer |\n| SP with only SELECT\u002Fcomputation | NO | Convert to direct Java (Subagent 5 handles) |\n| SP called by a trigger | YES | Becomes the enqueue SP; trigger just calls it |\n\n### Trigger conversion rules\n\n1. **If a trigger has NO business logic** (just calls an SP): The trigger calls the enqueue SP with appropriate parameters. The business logic lives in the consumer.\n2. **If a trigger HAS business logic**: Extract the logic. The trigger calls an enqueue SP passing all needed data (OLD\u002FNEW values). The consumer Java code implements the business logic.\n3. **Original triggers are DISABLED** — new triggers replace them.\n4. **Preserve the original trigger structure** — do not split a single trigger into multiple triggers. If the original trigger fires on multiple events (e.g., `UPDATE OF job_id, department_id`), the AQ replacement is a single trigger with the same event specification. The replacement trigger should call the enqueue SP once, passing all relevant OLD\u002FNEW values.\n\n### Stored procedure conversion rules\n\n1. **SPs that do DML**: Converted to enqueue SPs (`DBMS_AQ.ENQUEUE` with `ON_COMMIT` visibility). The actual DML moves to the consumer.\n2. **SPs called by triggers**: Become enqueue SPs. The trigger just calls the enqueue SP.\n3. **SPs with only SELECT\u002Fcomputation**: Not converted to AQ (handled by Subagent 5 as direct Java).\n\n---\n\n## SQL Generation Rules\n\n### 1. Payload Type\n\nCreate one Oracle Object Type per distinct message schema. Include all data the consumer needs:\n\n```sql\nCREATE OR REPLACE TYPE \u003Cschema>.\u003Cpayload_type_name> AS OBJECT (\n    -- Include all columns the consumer needs to write\n    -- Include operation_type VARCHAR2(20) as a routing key\n    \u003Ccolumn_name>    \u003Coracle_type>,\n    ...\n    operation_type   VARCHAR2(20)   -- routing key: identifies what the consumer should do\n);\n```\n\n**Naming convention:** `\u003Ctable_name>_change_t` (e.g., `job_history_change_t`)\n\n### 2. Queue Table\n\n```sql\nBEGIN\n    DBMS_AQADM.CREATE_QUEUE_TABLE(\n        queue_table        => '\u003Cschema>.\u003Cqueue_table_name>',\n        queue_payload_type => '\u003Cschema>.\u003CPAYLOAD_TYPE_NAME>'\n    );\nEND;\n\u002F\n```\n\n**Naming convention:** `\u003Ctable_name>_qt` (e.g., `job_history_qt`)\n\n### 3. Queue\n\n```sql\nBEGIN\n    DBMS_AQADM.CREATE_QUEUE(\n        queue_name  => '\u003Cschema>.\u003Cqueue_name>',\n        queue_table => '\u003Cschema>.\u003Cqueue_table_name>',\n        max_retries => 5,\n        retry_delay => 0\n    );\nEND;\n\u002F\n\nBEGIN\n    DBMS_AQADM.START_QUEUE('\u003Cschema>.\u003Cqueue_name>');\nEND;\n\u002F\n\nBEGIN\n    DBMS_AQADM.GRANT_QUEUE_PRIVILEGE(\n        privilege  => 'ALL',\n        queue_name => '\u003Cschema>.\u003Cqueue_name>',\n        grantee    => '\u003Cschema>'\n    );\nEND;\n\u002F\n```\n\n**Naming convention:** `\u003Ctable_name>_queue` (e.g., `job_history_queue`)\n\n### 4. Enqueue Stored Procedures\n\n```sql\nCREATE OR REPLACE PROCEDURE \u003Cschema>.SP_ENQUEUE_\u003Coperation_name> (\n    \u003Cparameters matching trigger OLD\u002FNEW values>\n) AS\n    l_enq_opts    DBMS_AQ.ENQUEUE_OPTIONS_T;\n    l_msg_props   DBMS_AQ.MESSAGE_PROPERTIES_T;\n    l_payload     \u003Cpayload_type>;\n    l_msgid       RAW(16);\nBEGIN\n    l_payload := \u003Cpayload_type>(\n        \u003Cfield> => \u003Cparam>,\n        ...\n        operation_type => '\u003COPERATION_TYPE>'   -- routing key\n    );\n    l_enq_opts.visibility := DBMS_AQ.ON_COMMIT;\n    DBMS_AQ.ENQUEUE(\n        queue_name         => '\u003Cschema>.\u003Cqueue_name>',\n        enqueue_options    => l_enq_opts,\n        message_properties => l_msg_props,\n        payload            => l_payload,\n        msgid              => l_msgid\n    );\nEND SP_ENQUEUE_\u003Coperation_name>;\n\u002F\n```\n\n### 5. Modified Triggers\n\nPreserve the original trigger structure: do not split a single trigger into multiple triggers. If the original trigger fires on `UPDATE OF col1, col2`, the replacement trigger uses the same event specification as a single trigger.\n\n```sql\n-- Disable original trigger\nALTER TRIGGER \u003Cschema>.\u003Coriginal_trigger_name> DISABLE;\n\n-- New trigger: no business logic, just calls the enqueue SP\n-- Preserve the SAME event specification as the original trigger\nCREATE OR REPLACE TRIGGER \u003Cschema>.TRG_AQ_\u003Cdescriptive_name>\n    \u003CTIMING> \u003CEVENT> ON \u003Cschema>.\u003Ctable_name>\n    FOR EACH ROW\nBEGIN\n    SP_ENQUEUE_\u003Coperation_name>(\n        p_col1 => :OLD.col1,   -- or :NEW.col1 depending on timing\n        p_col2 => :NEW.col2,\n        ...\n    );\nEND TRG_AQ_\u003Cdescriptive_name>;\n\u002F\n```\n\n### SQL File Structure\n\nThe generated `aq_setup.sql` is organized in this order:\n\n```sql\n-- =============================================================================\n-- Oracle AQ Setup for \u003CSCHEMA_NAME> Schema\n-- Generated: \u003CTIMESTAMP>\n-- =============================================================================\n\n-- Section 1: Payload Type Definitions\n-- Section 2: Queue Table Creation\n-- Section 3: Queue Creation & Configuration\n-- Section 4: Disable Original Triggers\n-- Section 5: Enqueue Stored Procedures\n-- Section 6: New AQ Triggers\n-- Section 7: Verification Queries\n```\n\n**Note:** Keep the AQ setup SQL minimal — only create the necessary payload types, queues, triggers, and enqueue SPs. Avoid unnecessary idempotent cleanup blocks unless the script is designed to be re-runnable.\n\n---\n\n## Java Consumer Generation Rules\n\n### Target Java Version: 17\n\nAll generated Java files target **Java 17**. Use Java 17 features where appropriate: `var`, records, `instanceof` pattern matching, switch expressions, text blocks, `List.of()`, `String.formatted()`.\n\n**Do not use** preview features or anything requiring Java 21+: the generated code has to compile on Java 17.\n\n### Required Dependencies (document in report)\n\nThe following JAR files are required for AQ consumer functionality:\n\n| Dependency | Source | Notes |\n|------------|--------|-------|\n| `aqapi.jar` | Oracle DB (`$ORACLE_HOME\u002Frdbms\u002Fjlib\u002Faqapi.jar`) | Must be extracted from Oracle DB installation or container |\n| `javax.jms-api-2.0.1.jar` | Maven Central or Oracle DB | JMS 2.0 API |\n| `ojdbc11-23.x.jar` | Maven Central (`com.oracle.database.jdbc:ojdbc11`) | Oracle JDBC driver |\n| `scalardb-3.19.x.jar` | Maven Central (`com.scalar-labs:scalardb`) | ScalarDB Core (Transaction API) |\n\n**Note:** ScalarDB Core is the default component (open source\u002Fcommunity edition). Only add ScalarDB Cluster dependencies if the SQL interface is needed. For the Java Transaction API used by these consumers, ScalarDB Core is sufficient.\n\n**Note:** `aqapi.jar` is NOT available in Maven Central for most versions. It must be obtained from inside the Oracle DB installation directory and added to the project's `libs\u002F` folder.\n\n### File Naming\n\n- **Consumer classes**: `\u003CQueueName>Consumer.java` (PascalCase)\n  - Example: `job_history_queue` → `JobHistoryQueueConsumer.java`\n- **Message POJOs**: `\u003CPayloadType>Message.java` (PascalCase)\n  - Example: `job_history_change_t` → `JobHistoryChangeMessage.java`\n- **Helper**: `AqStructHolder.java` (always this name)\n\nWrite every file listed in the Output Contract to disk, and make the Generated File Index in the report match the actual files in `generated-java\u002F`. A report that references a file that was never written sends its reader looking for code that does not exist.\n\n### Class templates\n\nThe shape of each generated class is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fjava-consumer-templates.md`: `AqStructHolder` (generated once), the message POJO (one per payload type) and the consumer service class (one per queue). Read it before writing any Java file, and fill its `\u003C...>` placeholders from the payload type and the queue. The rules below — writes, keys, error handling, namespace — apply to what those templates produce.\n\n### ScalarDB Write Patterns\n\n**Upsert (recommended for idempotency):**\n```java\nvar upsert = Upsert.newBuilder()\n    .namespace(NAMESPACE)\n    .table(\"\u003CTABLE>\")\n    .partitionKey(Key.of\u003CType>(\"\u003CPK>\", value))\n    .clusteringKey(Key.of\u003CType>(\"\u003CCK>\", value))\n    .\u003Ctype>Value(\"\u003Ccol>\", value)\n    .build();\ntx.upsert(upsert);\n```\n\nUsing Upsert is recommended because it provides idempotency during message redelivery: if the consumer crashes after the ScalarDB commit but before the AQ session commit, AQ redelivers the message and the Upsert simply overwrites with identical data. However, Upsert is not mandatory — Insert can be used if duplicate handling is managed differently.\n\n**Insert (alternative):**\n```java\nvar insert = Insert.newBuilder()\n    .namespace(NAMESPACE)\n    .table(\"\u003CTABLE>\")\n    .partitionKey(Key.of\u003CType>(\"\u003CPK>\", value))\n    .\u003Ctype>Value(\"\u003Ccol>\", value)\n    .build();\ntx.insert(insert);\n```\n\n### Key Building Rules\n\nUse the schema report to determine correct key types:\n\n| Oracle Type | Key Builder |\n|-------------|------------|\n| NUMBER(p,0) p\u003C=9 | `Key.ofInt(\"col\", value)` |\n| NUMBER(p,0) p\u003C=18 | `Key.ofBigInt(\"col\", value)` |\n| NUMBER(p,s) s>0 | `Key.ofDouble(\"col\", value)` |\n| VARCHAR2, CHAR | `Key.ofText(\"col\", value)` |\n| DATE | `Key.ofDate(\"col\", value)` — use `java.time.LocalDate` |\n\n### Error Handling Pattern\n\nThe generated consumer code classifies exceptions to determine whether the AQ session should be rolled back (retriable) or committed (non-retriable \u002F poison message removal). The classification is what the consumer's correctness rests on: a retriable failure committed removes a message that would have succeeded on redelivery, and a poison message rolled back is redelivered until `max_retries` is spent before it reaches the exception queue. Refer to `aq-exception-handling-strategy.md` for the full classification taxonomy.\n\n#### Exception Classification Summary\n\n| Verdict | AQ Action | Exceptions |\n|---------|-----------|------------|\n| **RETRIABLE** | `session.rollback()` | `CrudConflictException`, `CommitConflictException`, `TransactionNotFoundException`, `CrudException` (base), `CommitException` (base), `TransactionException` (base) |\n| **NON_RETRIABLE** | `session.commit()` (remove poison message) | `UnsatisfiedConditionException`, `IllegalArgumentException`, `ClassCastException`, `NullPointerException`, `ArrayIndexOutOfBoundsException`, `NumberFormatException` |\n| **UNKNOWN_TX_STATE** | `session.commit()` + operator alert | `UnknownTransactionStatusException` |\n\n#### Generated ExceptionClassifier Utility\n\nGenerate an `ExceptionClassifier.java` file in `generated-java\u002F` for every AQ migration. This utility classifies exceptions into the three verdicts above. The `instanceof` check order goes from most-specific to least-specific subclass, because of the ScalarDB exception hierarchy — a superclass checked first would catch its subclasses:\n\n```\nTransactionException\n├── TransactionNotFoundException            → RETRIABLE\n├── CrudException\n│   ├── CrudConflictException               → RETRIABLE\n│   └── UnsatisfiedConditionException       → NON_RETRIABLE\n├── CommitException\n│   ├── CommitConflictException             → RETRIABLE\n│   └── UnknownTransactionStatusException   → UNKNOWN_TX_STATE\n└── RollbackException                       → (internal, not classified)\n```\n\nThe class itself is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Faq-exception-handling-strategy.md` § ExceptionClassifier; generate it as written there, in the same check order.\n\n#### ScalarDbWriter — Preserve Exception Types\n\nThe writer does not call `tx.abort()` on `UnknownTransactionStatusException` — the TX may have committed:\n\n```java\ntry {\n    tx.upsert(\u002F* ... *\u002F);\n    tx.commit();\n} catch (UnknownTransactionStatusException e) {\n    \u002F\u002F DO NOT abort — TX may have committed successfully\n    throw e;\n} catch (Exception e) {\n    try { tx.abort(); } catch (RollbackException ignored) {}\n    throw e;  \u002F\u002F preserve original type for classifier\n}\n```\n\n#### Consumer Loop — Two-Phase Error Handling\n\nSeparate message parsing (always non-retriable on failure) from processing (classified):\n\n```java\n\u002F\u002F PHASE 1: Parse — failure = broken payload, always non-retriable\nJobChangeMessage parsed;\ntry {\n    parsed = parseAdtMessage(msg);\n} catch (Exception e) {\n    log.error(\"Parse failed (NON_RETRIABLE): {}\", e.getMessage(), e);\n    session.commit();  \u002F\u002F remove unparseable message\n    continue;\n}\n\n\u002F\u002F PHASE 2: Process — classify the outcome\ntry {\n    writer.writeMessage(parsed);\n    session.commit();\n} catch (Exception e) {\n    switch (ExceptionClassifier.classify(e)) {\n        case RETRIABLE       -> { session.rollback(); }\n        case NON_RETRIABLE   -> { log.error(\"Poison message removed: {}\", e.getMessage(), e); session.commit(); }\n        case UNKNOWN_TX_STATE -> { log.error(\"VERIFY SCALARDB DATA: {}\", e.getMessage(), e); session.commit(); }\n    }\n}\n```\n\n### Namespace Handling\n\n- Use the `ORACLE_SCHEMA` or `ORACLE_USER` value as-is for the ScalarDB namespace. Use table and column names exactly as they appear in `raw_schema_data.json` — do not convert to lowercase.\n- If `ORACLE_SCHEMA` is empty, use the `ORACLE_USER` value as-is.\n- Set as a class constant: `private static final String NAMESPACE = \"\u003Cvalue>\";`\n\n---\n\n## How the Generated Files Should Be Used\n\nDocument this section in the AQ migration report for the user. Its text — the prerequisites and the integration steps — is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fgenerated-files-usage.md`; read it when writing the report and adjust it to the files and names this migration generated.\n\n---\n\n## Complexity Assessment\n\nFor each trigger\u002FSP being converted to AQ, assess complexity:\n\n| Factor | Low | Medium | High |\n|--------|-----|--------|------|\n| Tables touched by consumer | 1 | 2-3 | 4+ |\n| Payload fields | 1-5 | 6-10 | 11+ |\n| Operation types per queue | 1 | 2-3 | 4+ |\n| Cross-table dependencies | None | Simple FK | Complex chains |\n| Data transformations | None | Simple mapping | Complex logic |\n\n---\n\n## Report Generation\n\nAfter generating all files, produce `scalardb_aq_migration_report.md` using the template. The report includes:\n\n1. **Executive Summary** — counts of queues, payload types, triggers\u002FSPs converted\n2. **AQ Architecture Diagram** — producer\u002Fconsumer flow\n3. **Queue Configuration** — all queues created with settings\n4. **Trigger\u002FSP Conversion Table** — original → AQ mapping for each object\n5. **Generated SQL Summary** — sections in `aq_setup.sql`\n6. **Generated Java File Index** — all consumer, POJO, and helper files\n7. **Prerequisites & Integration Guide** — how to use the generated files\n8. **Required Dependencies** — JAR files with sources\n\n---\n\n## Files in This Skill\n\n```\nskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002F\n├── SKILL.md                              # This file\n├── reference\u002F\n│   ├── aq-migration-strategy-guide.md    # AQ conversion patterns and code examples\n│   ├── aq-exception-handling-strategy.md # Exception classification for consumer retry\u002Fcommit decisions\n│   ├── java-consumer-templates.md        # Class templates: AqStructHolder, message POJO, consumer service\n│   ├── generated-files-usage.md          # Report text: prerequisites and integration steps\n│   └── AQ-official-docs\u002F                 # Oracle AQ official documentation\n│       ├── 23 - Oracle Database Advanced Queuing (AQ)_Html.txt\n│       ├── 24 - Oracle Database Advanced Queuing (AQADM)_Html.txt\n│       └── 25 - Oracle Advanced Queuing (AQ) DBMS_AQELM.txt\n└── templates\u002F\n    └── scalardb_aq_migration_report.md   # AQ migration report template\n```\n\n---\n\n## Related\n\n- **Command**: `commands\u002Foracle-to-scalardb.md` (orchestration — Step 11)\n- **Schema Extraction**: `skills\u002Fmigrate-oracle\u002Fanalyze-oracle-schema\u002F` (provides raw_schema_data.json)\n- **Schema Report**: `skills\u002Fmigrate-oracle\u002Fanalyze-oracle-schema\u002F` (provides oracle_schema_report.md)\n- **Migration Analysis**: `skills\u002Fmigrate-oracle\u002Fmigrate-oracle-to-scalardb\u002F` (general migration docs)\n- **SP & Trigger Migration**: `skills\u002Fmigrate-oracle\u002Fmigrate-oracle-sp-trigger-to-scalardb\u002F` (direct Java conversion without AQ)\n\n---\n\n*Skill Version: 1.0*\n*Compatible with: ScalarDB 3.17+*\n*Target Java Version: 17*\n","# Migrate Oracle Stored Procedures & Triggers to AQ + ScalarDB Consumer Skill\n\n## Purpose\n\nConvert Oracle triggers and stored procedures into an **event-driven architecture** using Oracle Advanced Queuing (AQ) as the messaging layer and ScalarDB Java Transaction API as the consumer layer.\n\n**Producer side (Oracle SQL):** Triggers and stored procedures are replaced with AQ enqueue operations — triggers contain no business logic and simply call enqueue SPs.\n\n**Consumer side (Java):** Message consumer classes dequeue from AQ using JMS and write to ScalarDB-managed tables using the Java Transaction API.\n\nThis skill produces:\n1. A **complete SQL file** (`aq_setup.sql`) for the Oracle producer side\n2. **Java consumer files** for the ScalarDB consumer side\n3. An **AQ migration report** documenting all conversions\n\n---\n\n## Skill Responsibility\n\nThis skill is responsible for:\n- Analyzing triggers and stored procedures from extracted schema JSON\n- Determining which triggers\u002FSPs should be converted to AQ enqueue patterns\n- Generating SQL for payload types, queue tables, queues, modified triggers, and enqueue SPs\n- Generating Java consumer service classes (dequeue + ScalarDB Transaction API)\n- Generating message POJO classes and helper utilities\n- Producing an AQ migration report\n\nThis skill is **NOT** responsible for:\n- Orchestration or command handling (handled by `\u002Foracle-to-scalardb` command)\n- Schema extraction (handled by Subagent 1)\n- Schema report generation (handled by Subagent 2)\n- General migration analysis (handled by Subagent 3)\n- Direct SP\u002Ftrigger to Java conversion without AQ (handled by Subagent 5)\n- Creating a full consumer application (build files, main class, deployment config)\n\n---\n\n## Input Contract\n\n| Input | Type | Required | Description |\n|-------|------|----------|-------------|\n| `raw_schema_data.json` | File | YES | Extracted Oracle schema data (specifically the `plsql` section) |\n| `oracle_schema_report.md` | File | YES | Schema report (for table\u002Fcolumn context needed for accurate Key builders) |\n| `aq-migration-strategy-guide.md` | File | YES | Reference doc with AQ conversion patterns and code examples |\n| `aq-exception-handling-strategy.md` | File | YES | Exception classification and retry\u002Fcommit strategy for consumer error handling |\n| `output_directory` | Directory | YES | Where to write generated files |\n\n---\n\n## Output Contract\n\n| Output | Location | Description |\n|--------|----------|-------------|\n| AQ Setup SQL | `\u003COUTPUT_DIR>\u002Faq_setup.sql` | Complete SQL file: payload types, queues, triggers, enqueue SPs |\n| Java Consumer Classes | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002F\u003CQueueName>Consumer.java` | One consumer per queue\u002Fmessage-type |\n| Java Message POJOs | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002F\u003CPayloadName>Message.java` | One POJO per payload type |\n| Java Helper Utility | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002FAqStructHolder.java` | Reusable Oracle STRUCT wrapper for ojdbc11 |\n| Exception Classifier | `\u003COUTPUT_DIR>\u002Fgenerated-java\u002FExceptionClassifier.java` | Classifies exceptions into RETRIABLE \u002F NON_RETRIABLE \u002F UNKNOWN_TX_STATE for AQ session handling |\n| AQ Migration Report | `\u003COUTPUT_DIR>\u002Fscalardb_aq_migration_report.md` | Report documenting all conversions |\n\n---\n\n## How to Parse the JSON\n\nRead `raw_schema_data.json` and extract these sections from `plsql`:\n\n| JSON Path | Contains |\n|-----------|----------|\n| `plsql.procedures` | Procedure metadata (name, deterministic, parallel, authid) |\n| `plsql.functions` | Function metadata (name, return_type, deterministic) |\n| `plsql.packages` | Package metadata (name, authid, spec\u002Fbody status) |\n| `plsql.triggers` | Trigger metadata (name, table, timing, event, status) |\n| `plsql.arguments` | Parameters for procedures\u002Ffunctions |\n| `plsql.source` | PL\u002FSQL source code (grouped by NAME, TYPE, ordered by LINE) |\n| `plsql.trigger_source` | Trigger body source code |\n| `plsql.procedure_ddl` | Full DDL for procedures |\n| `plsql.function_ddl` | Full DDL for functions |\n| `plsql.trigger_ddl` | Full DDL for triggers |\n\nAlso read `oracle_schema_report.md` to extract:\n- Table names and their columns with data types\n- Primary key definitions (needed to build correct `Key.of*()` calls)\n- Foreign key relationships (needed for multi-table operations)\n\n---\n\n## Conversion Decision Logic\n\n### Which triggers\u002FSPs get converted to AQ?\n\nAnalyze each trigger and stored procedure to determine if it should be converted to AQ:\n\n| Object | Convert to AQ? | Rationale |\n|--------|---------------|-----------|\n| Trigger with DML (INSERT\u002FUPDATE\u002FDELETE on another table) | YES | The DML becomes a consumer-side ScalarDB operation |\n| Trigger that calls an SP doing DML | YES | Both trigger and SP are converted |\n| Trigger with only validation\u002Fdefaults (no cross-table DML) | NO | Keep as application-layer validation |\n| SP that INSERTs\u002FUPDATEs\u002FDELETEs records | YES | The DML moves to the consumer |\n| SP with only SELECT\u002Fcomputation | NO | Convert to direct Java (Subagent 5 handles) |\n| SP called by a trigger | YES | Becomes the enqueue SP; trigger just calls it |\n\n### Trigger conversion rules\n\n1. **If a trigger has NO business logic** (just calls an SP): The trigger calls the enqueue SP with appropriate parameters. The business logic lives in the consumer.\n2. **If a trigger HAS business logic**: Extract the logic. The trigger calls an enqueue SP passing all needed data (OLD\u002FNEW values). The consumer Java code implements the business logic.\n3. **Original triggers are DISABLED** — new triggers replace them.\n4. **Preserve the original trigger structure** — do not split a single trigger into multiple triggers. If the original trigger fires on multiple events (e.g., `UPDATE OF job_id, department_id`), the AQ replacement is a single trigger with the same event specification. The replacement trigger should call the enqueue SP once, passing all relevant OLD\u002FNEW values.\n\n### Stored procedure conversion rules\n\n1. **SPs that do DML**: Converted to enqueue SPs (`DBMS_AQ.ENQUEUE` with `ON_COMMIT` visibility). The actual DML moves to the consumer.\n2. **SPs called by triggers**: Become enqueue SPs. The trigger just calls the enqueue SP.\n3. **SPs with only SELECT\u002Fcomputation**: Not converted to AQ (handled by Subagent 5 as direct Java).\n\n---\n\n## SQL Generation Rules\n\n### 1. Payload Type\n\nCreate one Oracle Object Type per distinct message schema. Include all data the consumer needs:\n\n```sql\nCREATE OR REPLACE TYPE \u003Cschema>.\u003Cpayload_type_name> AS OBJECT (\n    -- Include all columns the consumer needs to write\n    -- Include operation_type VARCHAR2(20) as a routing key\n    \u003Ccolumn_name>    \u003Coracle_type>,\n    ...\n    operation_type   VARCHAR2(20)   -- routing key: identifies what the consumer should do\n);\n```\n\n**Naming convention:** `\u003Ctable_name>_change_t` (e.g., `job_history_change_t`)\n\n### 2. Queue Table\n\n```sql\nBEGIN\n    DBMS_AQADM.CREATE_QUEUE_TABLE(\n        queue_table        => '\u003Cschema>.\u003Cqueue_table_name>',\n        queue_payload_type => '\u003Cschema>.\u003CPAYLOAD_TYPE_NAME>'\n    );\nEND;\n\u002F\n```\n\n**Naming convention:** `\u003Ctable_name>_qt` (e.g., `job_history_qt`)\n\n### 3. Queue\n\n```sql\nBEGIN\n    DBMS_AQADM.CREATE_QUEUE(\n        queue_name  => '\u003Cschema>.\u003Cqueue_name>',\n        queue_table => '\u003Cschema>.\u003Cqueue_table_name>',\n        max_retries => 5,\n        retry_delay => 0\n    );\nEND;\n\u002F\n\nBEGIN\n    DBMS_AQADM.START_QUEUE('\u003Cschema>.\u003Cqueue_name>');\nEND;\n\u002F\n\nBEGIN\n    DBMS_AQADM.GRANT_QUEUE_PRIVILEGE(\n        privilege  => 'ALL',\n        queue_name => '\u003Cschema>.\u003Cqueue_name>',\n        grantee    => '\u003Cschema>'\n    );\nEND;\n\u002F\n```\n\n**Naming convention:** `\u003Ctable_name>_queue` (e.g., `job_history_queue`)\n\n### 4. Enqueue Stored Procedures\n\n```sql\nCREATE OR REPLACE PROCEDURE \u003Cschema>.SP_ENQUEUE_\u003Coperation_name> (\n    \u003Cparameters matching trigger OLD\u002FNEW values>\n) AS\n    l_enq_opts    DBMS_AQ.ENQUEUE_OPTIONS_T;\n    l_msg_props   DBMS_AQ.MESSAGE_PROPERTIES_T;\n    l_payload     \u003Cpayload_type>;\n    l_msgid       RAW(16);\nBEGIN\n    l_payload := \u003Cpayload_type>(\n        \u003Cfield> => \u003Cparam>,\n        ...\n        operation_type => '\u003COPERATION_TYPE>'   -- routing key\n    );\n    l_enq_opts.visibility := DBMS_AQ.ON_COMMIT;\n    DBMS_AQ.ENQUEUE(\n        queue_name         => '\u003Cschema>.\u003Cqueue_name>',\n        enqueue_options    => l_enq_opts,\n        message_properties => l_msg_props,\n        payload            => l_payload,\n        msgid              => l_msgid\n    );\nEND SP_ENQUEUE_\u003Coperation_name>;\n\u002F\n```\n\n### 5. Modified Triggers\n\nPreserve the original trigger structure: do not split a single trigger into multiple triggers. If the original trigger fires on `UPDATE OF col1, col2`, the replacement trigger uses the same event specification as a single trigger.\n\n```sql\n-- Disable original trigger\nALTER TRIGGER \u003Cschema>.\u003Coriginal_trigger_name> DISABLE;\n\n-- New trigger: no business logic, just calls the enqueue SP\n-- Preserve the SAME event specification as the original trigger\nCREATE OR REPLACE TRIGGER \u003Cschema>.TRG_AQ_\u003Cdescriptive_name>\n    \u003CTIMING> \u003CEVENT> ON \u003Cschema>.\u003Ctable_name>\n    FOR EACH ROW\nBEGIN\n    SP_ENQUEUE_\u003Coperation_name>(\n        p_col1 => :OLD.col1,   -- or :NEW.col1 depending on timing\n        p_col2 => :NEW.col2,\n        ...\n    );\nEND TRG_AQ_\u003Cdescriptive_name>;\n\u002F\n```\n\n### SQL File Structure\n\nThe generated `aq_setup.sql` is organized in this order:\n\n```sql\n-- =============================================================================\n-- Oracle AQ Setup for \u003CSCHEMA_NAME> Schema\n-- Generated: \u003CTIMESTAMP>\n-- =============================================================================\n\n-- Section 1: Payload Type Definitions\n-- Section 2: Queue Table Creation\n-- Section 3: Queue Creation & Configuration\n-- Section 4: Disable Original Triggers\n-- Section 5: Enqueue Stored Procedures\n-- Section 6: New AQ Triggers\n-- Section 7: Verification Queries\n```\n\n**Note:** Keep the AQ setup SQL minimal — only create the necessary payload types, queues, triggers, and enqueue SPs. Avoid unnecessary idempotent cleanup blocks unless the script is designed to be re-runnable.\n\n---\n\n## Java Consumer Generation Rules\n\n### Target Java Version: 17\n\nAll generated Java files target **Java 17**. Use Java 17 features where appropriate: `var`, records, `instanceof` pattern matching, switch expressions, text blocks, `List.of()`, `String.formatted()`.\n\n**Do not use** preview features or anything requiring Java 21+: the generated code has to compile on Java 17.\n\n### Required Dependencies (document in report)\n\nThe following JAR files are required for AQ consumer functionality:\n\n| Dependency | Source | Notes |\n|------------|--------|-------|\n| `aqapi.jar` | Oracle DB (`$ORACLE_HOME\u002Frdbms\u002Fjlib\u002Faqapi.jar`) | Must be extracted from Oracle DB installation or container |\n| `javax.jms-api-2.0.1.jar` | Maven Central or Oracle DB | JMS 2.0 API |\n| `ojdbc11-23.x.jar` | Maven Central (`com.oracle.database.jdbc:ojdbc11`) | Oracle JDBC driver |\n| `scalardb-3.19.x.jar` | Maven Central (`com.scalar-labs:scalardb`) | ScalarDB Core (Transaction API) |\n\n**Note:** ScalarDB Core is the default component (open source\u002Fcommunity edition). Only add ScalarDB Cluster dependencies if the SQL interface is needed. For the Java Transaction API used by these consumers, ScalarDB Core is sufficient.\n\n**Note:** `aqapi.jar` is NOT available in Maven Central for most versions. It must be obtained from inside the Oracle DB installation directory and added to the project's `libs\u002F` folder.\n\n### File Naming\n\n- **Consumer classes**: `\u003CQueueName>Consumer.java` (PascalCase)\n  - Example: `job_history_queue` → `JobHistoryQueueConsumer.java`\n- **Message POJOs**: `\u003CPayloadType>Message.java` (PascalCase)\n  - Example: `job_history_change_t` → `JobHistoryChangeMessage.java`\n- **Helper**: `AqStructHolder.java` (always this name)\n\nWrite every file listed in the Output Contract to disk, and make the Generated File Index in the report match the actual files in `generated-java\u002F`. A report that references a file that was never written sends its reader looking for code that does not exist.\n\n### Class templates\n\nThe shape of each generated class is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fjava-consumer-templates.md`: `AqStructHolder` (generated once), the message POJO (one per payload type) and the consumer service class (one per queue). Read it before writing any Java file, and fill its `\u003C...>` placeholders from the payload type and the queue. The rules below — writes, keys, error handling, namespace — apply to what those templates produce.\n\n### ScalarDB Write Patterns\n\n**Upsert (recommended for idempotency):**\n```java\nvar upsert = Upsert.newBuilder()\n    .namespace(NAMESPACE)\n    .table(\"\u003CTABLE>\")\n    .partitionKey(Key.of\u003CType>(\"\u003CPK>\", value))\n    .clusteringKey(Key.of\u003CType>(\"\u003CCK>\", value))\n    .\u003Ctype>Value(\"\u003Ccol>\", value)\n    .build();\ntx.upsert(upsert);\n```\n\nUsing Upsert is recommended because it provides idempotency during message redelivery: if the consumer crashes after the ScalarDB commit but before the AQ session commit, AQ redelivers the message and the Upsert simply overwrites with identical data. However, Upsert is not mandatory — Insert can be used if duplicate handling is managed differently.\n\n**Insert (alternative):**\n```java\nvar insert = Insert.newBuilder()\n    .namespace(NAMESPACE)\n    .table(\"\u003CTABLE>\")\n    .partitionKey(Key.of\u003CType>(\"\u003CPK>\", value))\n    .\u003Ctype>Value(\"\u003Ccol>\", value)\n    .build();\ntx.insert(insert);\n```\n\n### Key Building Rules\n\nUse the schema report to determine correct key types:\n\n| Oracle Type | Key Builder |\n|-------------|------------|\n| NUMBER(p,0) p\u003C=9 | `Key.ofInt(\"col\", value)` |\n| NUMBER(p,0) p\u003C=18 | `Key.ofBigInt(\"col\", value)` |\n| NUMBER(p,s) s>0 | `Key.ofDouble(\"col\", value)` |\n| VARCHAR2, CHAR | `Key.ofText(\"col\", value)` |\n| DATE | `Key.ofDate(\"col\", value)` — use `java.time.LocalDate` |\n\n### Error Handling Pattern\n\nThe generated consumer code classifies exceptions to determine whether the AQ session should be rolled back (retriable) or committed (non-retriable \u002F poison message removal). The classification is what the consumer's correctness rests on: a retriable failure committed removes a message that would have succeeded on redelivery, and a poison message rolled back is redelivered until `max_retries` is spent before it reaches the exception queue. Refer to `aq-exception-handling-strategy.md` for the full classification taxonomy.\n\n#### Exception Classification Summary\n\n| Verdict | AQ Action | Exceptions |\n|---------|-----------|------------|\n| **RETRIABLE** | `session.rollback()` | `CrudConflictException`, `CommitConflictException`, `TransactionNotFoundException`, `CrudException` (base), `CommitException` (base), `TransactionException` (base) |\n| **NON_RETRIABLE** | `session.commit()` (remove poison message) | `UnsatisfiedConditionException`, `IllegalArgumentException`, `ClassCastException`, `NullPointerException`, `ArrayIndexOutOfBoundsException`, `NumberFormatException` |\n| **UNKNOWN_TX_STATE** | `session.commit()` + operator alert | `UnknownTransactionStatusException` |\n\n#### Generated ExceptionClassifier Utility\n\nGenerate an `ExceptionClassifier.java` file in `generated-java\u002F` for every AQ migration. This utility classifies exceptions into the three verdicts above. The `instanceof` check order goes from most-specific to least-specific subclass, because of the ScalarDB exception hierarchy — a superclass checked first would catch its subclasses:\n\n```\nTransactionException\n├── TransactionNotFoundException            → RETRIABLE\n├── CrudException\n│   ├── CrudConflictException               → RETRIABLE\n│   └── UnsatisfiedConditionException       → NON_RETRIABLE\n├── CommitException\n│   ├── CommitConflictException             → RETRIABLE\n│   └── UnknownTransactionStatusException   → UNKNOWN_TX_STATE\n└── RollbackException                       → (internal, not classified)\n```\n\nThe class itself is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Faq-exception-handling-strategy.md` § ExceptionClassifier; generate it as written there, in the same check order.\n\n#### ScalarDbWriter — Preserve Exception Types\n\nThe writer does not call `tx.abort()` on `UnknownTransactionStatusException` — the TX may have committed:\n\n```java\ntry {\n    tx.upsert(\u002F* ... *\u002F);\n    tx.commit();\n} catch (UnknownTransactionStatusException e) {\n    \u002F\u002F DO NOT abort — TX may have committed successfully\n    throw e;\n} catch (Exception e) {\n    try { tx.abort(); } catch (RollbackException ignored) {}\n    throw e;  \u002F\u002F preserve original type for classifier\n}\n```\n\n#### Consumer Loop — Two-Phase Error Handling\n\nSeparate message parsing (always non-retriable on failure) from processing (classified):\n\n```java\n\u002F\u002F PHASE 1: Parse — failure = broken payload, always non-retriable\nJobChangeMessage parsed;\ntry {\n    parsed = parseAdtMessage(msg);\n} catch (Exception e) {\n    log.error(\"Parse failed (NON_RETRIABLE): {}\", e.getMessage(), e);\n    session.commit();  \u002F\u002F remove unparseable message\n    continue;\n}\n\n\u002F\u002F PHASE 2: Process — classify the outcome\ntry {\n    writer.writeMessage(parsed);\n    session.commit();\n} catch (Exception e) {\n    switch (ExceptionClassifier.classify(e)) {\n        case RETRIABLE       -> { session.rollback(); }\n        case NON_RETRIABLE   -> { log.error(\"Poison message removed: {}\", e.getMessage(), e); session.commit(); }\n        case UNKNOWN_TX_STATE -> { log.error(\"VERIFY SCALARDB DATA: {}\", e.getMessage(), e); session.commit(); }\n    }\n}\n```\n\n### Namespace Handling\n\n- Use the `ORACLE_SCHEMA` or `ORACLE_USER` value as-is for the ScalarDB namespace. Use table and column names exactly as they appear in `raw_schema_data.json` — do not convert to lowercase.\n- If `ORACLE_SCHEMA` is empty, use the `ORACLE_USER` value as-is.\n- Set as a class constant: `private static final String NAMESPACE = \"\u003Cvalue>\";`\n\n---\n\n## How the Generated Files Should Be Used\n\nDocument this section in the AQ migration report for the user. Its text — the prerequisites and the integration steps — is in `${PLUGIN_ROOT}\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fgenerated-files-usage.md`; read it when writing the report and adjust it to the files and names this migration generated.\n\n---\n\n## Complexity Assessment\n\nFor each trigger\u002FSP being converted to AQ, assess complexity:\n\n| Factor | Low | Medium | High |\n|--------|-----|--------|------|\n| Tables touched by consumer | 1 | 2-3 | 4+ |\n| Payload fields | 1-5 | 6-10 | 11+ |\n| Operation types per queue | 1 | 2-3 | 4+ |\n| Cross-table dependencies | None | Simple FK | Complex chains |\n| Data transformations | None | Simple mapping | Complex logic |\n\n---\n\n## Report Generation\n\nAfter generating all files, produce `scalardb_aq_migration_report.md` using the template. The report includes:\n\n1. **Executive Summary** — counts of queues, payload types, triggers\u002FSPs converted\n2. **AQ Architecture Diagram** — producer\u002Fconsumer flow\n3. **Queue Configuration** — all queues created with settings\n4. **Trigger\u002FSP Conversion Table** — original → AQ mapping for each object\n5. **Generated SQL Summary** — sections in `aq_setup.sql`\n6. **Generated Java File Index** — all consumer, POJO, and helper files\n7. **Prerequisites & Integration Guide** — how to use the generated files\n8. **Required Dependencies** — JAR files with sources\n\n---\n\n## Files in This Skill\n\n```\nskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002F\n├── SKILL.md                              # This file\n├── reference\u002F\n│   ├── aq-migration-strategy-guide.md    # AQ conversion patterns and code examples\n│   ├── aq-exception-handling-strategy.md # Exception classification for consumer retry\u002Fcommit decisions\n│   ├── java-consumer-templates.md        # Class templates: AqStructHolder, message POJO, consumer service\n│   ├── generated-files-usage.md          # Report text: prerequisites and integration steps\n│   └── AQ-official-docs\u002F                 # Oracle AQ official documentation\n│       ├── 23 - Oracle Database Advanced Queuing (AQ)_Html.txt\n│       ├── 24 - Oracle Database Advanced Queuing (AQADM)_Html.txt\n│       └── 25 - Oracle Advanced Queuing (AQ) DBMS_AQELM.txt\n└── templates\u002F\n    └── scalardb_aq_migration_report.md   # AQ migration report template\n```\n\n---\n\n## Related\n\n- **Command**: `commands\u002Foracle-to-scalardb.md` (orchestration — Step 11)\n- **Schema Extraction**: `skills\u002Fmigrate-oracle\u002Fanalyze-oracle-schema\u002F` (provides raw_schema_data.json)\n- **Schema Report**: `skills\u002Fmigrate-oracle\u002Fanalyze-oracle-schema\u002F` (provides oracle_schema_report.md)\n- **Migration Analysis**: `skills\u002Fmigrate-oracle\u002Fmigrate-oracle-to-scalardb\u002F` (general migration docs)\n- **SP & Trigger Migration**: `skills\u002Fmigrate-oracle\u002Fmigrate-oracle-sp-trigger-to-scalardb\u002F` (direct Java conversion without AQ)\n\n---\n\n*Skill Version: 1.0*\n*Compatible with: ScalarDB 3.17+*\n*Target Java Version: 17*\n",{"model":25,"description":7},"main","fed4c7ebb79ed82ce5c961f944a1ab0ab21bae26","skills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb",1,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect","https:\u002F\u002Fnexus-architect-docs-070772.gitlab.io\u002F","https:\u002F\u002Fgithub.com\u002Fwfukatsu","https:\u002F\u002Fwww.scalar-labs.com\u002F","Wataru Fukatsu | Co-Founder and CEO, Scalar, Inc.","2026-11-14 22:03:27",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add wfukatsu\u002Fnexus-architect --skill migrate-oracle-aq-to-scalardb",{"tool":57,"command":58},"bunx","bunx skills add wfukatsu\u002Fnexus-architect --skill migrate-oracle-aq-to-scalardb",{"tool":60,"command":61},"pnpm","pnpm dlx skills add wfukatsu\u002Fnexus-architect --skill migrate-oracle-aq-to-scalardb","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002FSKILL.md",true,[65,71,75,79,83,87,91,95],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"reference\u002Faq-exception-handling-strategy.md","REFERENCE","参考文档",11866,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Faq-exception-handling-strategy.md",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"reference\u002Faq-migration-strategy-guide.md",18939,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Faq-migration-strategy-guide.md",{"path":76,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":77,"sourceHtmlUrl":78},"reference\u002FAQ-official-docs\u002F23 - Oracle Database Advanced Queuing (AQ)_Html.txt",28544,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002FAQ-official-docs\u002F23 - Oracle Database Advanced Queuing (AQ)_Html.txt",{"path":80,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":81,"sourceHtmlUrl":82},"reference\u002FAQ-official-docs\u002F24 - Oracle Database Advanced Queuing (AQADM)_Html.txt",84045,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002FAQ-official-docs\u002F24 - Oracle Database Advanced Queuing (AQADM)_Html.txt",{"path":84,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":85,"sourceHtmlUrl":86},"reference\u002FAQ-official-docs\u002F25 - Oracle Advanced Queuing (AQ) DBMS_AQELM.txt",2799,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002FAQ-official-docs\u002F25 - Oracle Advanced Queuing (AQ) DBMS_AQELM.txt",{"path":88,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":89,"sourceHtmlUrl":90},"reference\u002Fgenerated-files-usage.md",3957,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fgenerated-files-usage.md",{"path":92,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":93,"sourceHtmlUrl":94},"reference\u002Fjava-consumer-templates.md",4878,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Freference\u002Fjava-consumer-templates.md",{"path":96,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":97,"sourceHtmlUrl":98},"templates\u002Fscalardb_aq_migration_report.md",13031,"https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fmigrate-oracle\u002Fmigrate-oracle-aq-to-scalardb\u002Ftemplates\u002Fscalardb_aq_migration_report.md",[100,108,134,156,179,200],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":107},"01M7DTDMYVAWFXAYJHXN5687Z2","doctor","Check the install and a project: plugins at the repository's version, hooks and skills in\nplace, the two knowledge bundles present and fresh, the project's registry, question store,\naudit log, learned rules and claims readable. Run it first when a command misbehaves.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fdoctor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":36},"01M6HRH10GPAVTZ8W90WD9HJK1","verify-sql-migration","Prove a SQL migration on data: golden checks against an authorized source database and\ndifferential tests against ScalarDB. Never touches production.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fverify-sql-migration\u002FSKILL.md",[],[115,116,34,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133],"verify sql migration","verify","migration","sonnet","tests","golden","source","Production","fetcher","data","properties","id","database","auto","true","mode","en","core","never",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":36},"01M6HRGWK643YKN0QVRQSNSDCR","verify-implementation","Check code against the design (API contract, transactions, security, requirements, the example\nchain) and report every divergence; optionally runs the eight-stage quality gate.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fverify-implementation\u002FSKILL.md",[],[141,116,142,128,143,144,145,129,146,147,131,148,149,150,151,152,153,31,154,155],"implementation","verify implementation","quality gate","contract","design","chain","api contract","scope","backlog","repo","example","stage","check","code","requirements",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":36},"01M6HRGS929NK1B5WG1ZANSXQ1","update-knowledge","Fetch or update an OKF knowledge bundle: ScalarDB\u002FScalarDL, or the vendored Kubernetes\u002FTerraform\nbundle.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fupdate-knowledge\u002FSKILL.md",[],[163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178],"update knowledge","update","knowledge","root","plugin","bundle","Bash","terraform","status","okf","latest","kubernetes","name","haiku","Tools","fetch",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":185,"publishedAt":36},"01M6HRGNMYSK70R8Y9BY41E74D","start","Interactive entry point for system architecture work: refactor a legacy application into services,\nor design a new system from requirements; picks the path from the project's state. To move a\ndatabase to ScalarDB, use migrate-database.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fstart\u002FSKILL.md",[],[181,155,127,186,187,145,188,189,190,191,22,192,193,194,195,196,197,198,199],"Legacy","use","system","move","project","for","path","application","refactor","services","work","state","architecture","interactive",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":206,"publishedAt":36},"01M6HRGHZXK0NXF6W62MMNS46H","select-scalardb-edition","Choose the ScalarDB edition (Community, Enterprise Standard or Premium, plus Enterprise Options),\ndeployment mode and cluster topology through a short interview.","https:\u002F\u002Fgithub.com\u002Fwfukatsu\u002Fnexus-architect\u002Fblob\u002Fmain\u002Fskills\u002Fselect-scalardb-edition\u002FSKILL.md",[],[207,208,209,118,210,130,211,212,213,214,215,216,217],"select scalardb edition","select","topology","short","Enterprise","choose","deployment","options","cluster","interview","community"]