From ad-migration
Use when stored procedure, view, or materialized-view SQL must be restructured into import/logical/final CTEs before proof-backed migration persistence.
npx claudepluginhub accelerate-data/migration-utilityThis skill uses the workspace's default tool permissions.
Refactor source SQL into import/logical/final CTEs, treat the extracted SQL as ground truth, and persist only proof-backed results.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Builds scalable data pipelines, modern data warehouses, and real-time streaming architectures using Spark, dbt, Airflow, Kafka, and cloud platforms like Snowflake, BigQuery.
Builds production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. For data pipelines, workflow orchestration, and batch job scheduling.
Refactor source SQL into import/logical/final CTEs, treat the extracted SQL as ground truth, and persist only proof-backed results.
Use this skill when:
refactor section must be backed by semantic review and, when available, executable compareDo not use this skill when:
refactor readiness guard fails| Item | Rule |
|---|---|
| Guard | uv run --project "${CLAUDE_PLUGIN_ROOT}/packages/ad-migration-internal" migrate-util ready refactor --object <table_fqn> |
| Context | uv run --project "${CLAUDE_PLUGIN_ROOT}/packages/ad-migration-internal" refactor context --table <table_fqn> |
| Compare gate | Run test-harness sandbox-status; if unavailable or explicitly skipped, persist with --no-compare-required |
| Contracts | Use references/context-fields.md, references/refactor-contracts.md, and ../../lib/shared/refactor_error_codes.md |
| Ground truth | Never modify the extracted SQL during self-correction |
| Style | Apply shared SQL and CTE style only; dbt model layer, YAML, and source-wrapper decisions belong to generating/reviewing model workflows |
ready is false, stop and report the returned code and reason. Do not assemble context, launch sub-agents, compare SQL, or write refactor artifacts after a failed readiness check.refactor context --table <table_fqn>. Use references/context-fields.md for which fields to pass to each sub-agent. If context assembly fails, map the failure using references/refactor-contracts.md and do not expose raw internal labels..staging/, then launch Sub-agent A and Sub-agent B in parallel using references/sub-agent-prompts.md. They must not see each other’s output. Sub-agent B must follow ../_shared/references/sql-style.md and ../_shared/references/cte-structure.md, produce a literal final AS (...) CTE, and end with SELECT * FROM final..staging/<table_fqn>-extracted.sql and .staging/<table_fqn>-refactored.sql.--no-compare-required; this should normally remain partial.test-harness sandbox-status succeeds, run compare-sql with .staging/<table_fqn>-extracted.sql, .staging/<table_fqn>-refactored.sql, and test-specs/<table_fqn>.json, then write .staging/<table_fqn>-compare.json.refactor write: use --compare-sql-file when compare passed, otherwise use --no-compare-required. Do not invent fields or override the persisted status..staging/ and report the extracted SQL, refactored SQL, semantic review result, compare result or skip reason, and final persisted status..staging before creating it.final as a conceptual last step instead of a literal CTE name.SELECT * inside import, logical, or final CTE definitions./refactor contract.ref()/source() placement decisions in this skill. This skill outputs refactored SQL only.