一键导入
dbt-fixer
Fix dbt models via iterative compile-fix loop. Scoped to dbt projects assigned to the current phase. Use when the stabilization skill invokes dbt fixing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fix dbt models via iterative compile-fix loop. Scoped to dbt projects assigned to the current phase. Use when the stabilization skill invokes dbt fixing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Identify SQL Server migration anti-patterns — performance blockers, architecture/security considerations, and behavioral differences — by running `scai assessment anti-patterns`, which buckets SnowConvert's already-recorded issue codes by priority and writes JSON for the parent assessment multi-report. Use for anti-patterns, performance/architecture concerns in SQL Server → Snowflake migrations;
Analyze SSIS packages from SnowConvert ETL.* outputs and source .dtsx files. Classifies packages, scores migration complexity, and produces JSON for the parent assessment multi-report.
Analyze Informatica Power Center workflows/mappings from SnowConvert ETL.* outputs and source XML files. Classifies workflows, scores migration complexity, and produces JSON for the parent assessment multi-report.
Analyzes workloads to be migrated to Snowflake using SnowConvert assessment reports. Routes to specialized sub-skills for high-quality assessments. Use this skill when user wants to do an assessment of their code or ETL workload, waves generation, object exclusion, anti-patterns, sql dynamic and/or ETL analysis (SSIS)
Set up a migration project — connect to source, initialize, extract objects, convert, and assess. Covers steps 1-5 of the migration lifecycle.
End-to-end database migration to Snowflake. Orchestrates the full migration lifecycle from source connection through initial conversion. Triggers: migrate, migration, migrate to snowflake, end to end migration, e2e migration, full migration.
基于 SOC 职业分类
| name | dbt-fixer |
| parent_skill | etl-stabilization |
| description | Fix dbt models via iterative compile-fix loop. Scoped to dbt projects assigned to the current phase. Use when the stabilization skill invokes dbt fixing. |
| license | Proprietary. See License-Skills for complete terms |
Fix dbt projects generated by SnowConvert. Scope includes: model SQL files (staging, intermediate, mart), macros, and project configuration (dbt_project.yml, sources.yml). The fixer first resolves bootstrap issues (placeholder config, broken macros) to make the project compilable, then uses an iterative compile-fix-recompile loop to resolve model-level errors until all dbt nodes pass.
Autonomous mode: When spawned as a team agent, skip all interactive stopping points, make reasonable defaults for user-facing decisions, and document assumptions in the completion report. When done, send a
send_messagetomainsummarizing your results, and respond to anyshutdown_requestwithsend_messageusingtype: "shutdown_response"andapprove: true.
Concurrent execution note: You may be spawned concurrently with other agents fixing different dbt projects in the same ETL unit. Each agent operates on its own project — do not access or modify files belonging to other dbt projects.
This sub-skill expects:
session_status.json — from track_status.py init (contains dbt_projects array with project names and paths, and source_file_path)dbt_projects in session status)source_file_path in session status) — for understanding original ETL intent<UNIT>/stabilization/tests/dbt/<project_name>/test_report.md — required (contains baseline failures and source-to-dbt component mapping). If this file does not exist, tests have not been generated yet — STOP and return to the parent skill to run Step 9 (dbt-test-gen) firstpending instead of dbt-tested, STOP and return to the parent skill to run test generation first.dbt-snowflake installed and available on PATHdbt compile works without a warehouse~/.dbt/profiles.ymlROADMAP.md for current phase. Process only assigned dbt projects; ignore others.session_status.json for dbt_projects arraydbt_project.yml, models/sources.yml, list .sql model files. The orchestrator has already registered nodes via track_status.py init-dbt.<UNIT>/stabilization/original/; create if missingbootstrap_status section. If blockers exist:
a. Fix dbt_project.yml — replace placeholder values (YOUR_PROJECT_NAME → derive from folder name or source definition; YOUR_PROFILE_NAME → use a sensible default based on the Snowflake connection)
b. Fix macro syntax — resolve !!!RESOLVE EWI!!! markers in macros/*.sql, fix unclosed blocks
c. Fix sources.yml — if source definitions reference non-existent schemas or tables, update to match the test environment
d. After each fix, attempt dbt parse to validatedbt compile --project-dir <DBT_PROJECT_PATH> --profiles-dir ~/.dbt; parse errors to identify failing nodesAfter user confirms, work through failing nodes. For each node:
.sql file<UNIT>/stabilization/original/<project_name>/ — to identify original ref()/source() targets and logic to preservedbt_project.yml (variable definitions), sources.yml (source schemas), and the current error message
4b. Read all macro files under macros/ — check for syntax errors and EWI markerssource_file_path if available) — especially useful for EWI markerstracking/fix-log.md for prior successful fixes matching the same error type or EWI codeAnalyze the error and apply a fix directly to the model file. Follow these rules:
Snowflake SQL Rules:
ISNULL(a, b) → NVL(a, b) or COALESCE(a, b)GETDATE() → CURRENT_TIMESTAMP()CONVERT(type, expr) → expr::type or TRY_CAST(expr AS type)SELECT TOP N → SELECT ... LIMIT NWITH (NOLOCK) hints (Snowflake has no lock hints)"GROUP", "ORDER", "TABLE", "TIME", "LOGIN", "DATE", "COMMENT", "COLUMN"Semantic Preservation Rules:
0, NULL, etc. — only as a last resortref() and source() targets from the original file. Read the original from <UNIT>/stabilization/original/ before rewriting a model body. The rewritten code MUST use the same targets — do NOT guess; multiple staging models with similar names may have different column sets.EWI Handling Rules:
!!!RESOLVE EWI!!! markers as bare text produce invalid SQL — resolve them by replacing the entire EWI block (the marker line AND all associated commented-out XML/C#/binary code below it) with working SQL. Do NOT preserve the commented-out component definition — it is dead code that inflates the file and confuses downstream tooling. The original is always available in <UNIT>/stabilization/original/ for reference.{PLATFORM_DIR}/ewi/ for platform-specific guides first, then reference/ewi/. See {PLATFORM_DIR}/element-types.md for unfamiliar element types.dbt-Specific Rules:
;) after SQL expressions — dbt does not want themsource() or ref() to reference a CTE defined within the same model. CTEs are local to the query and should be referenced by name directly (e.g., FROM my_cte, not FROM {{ source('raw', 'my_cte') }})source() for external tables defined in sources.yml and ref() for other dbt modelsvar() references — the variable name must exactly match what is defined in dbt_project.yml. Do not introduce typos or approximate namesLocation-override layer (SnowConvert sc_override_* vars):
dbt_project.yml declares sc_override_* vars — the SnowConvert signal that the
source ETL defined session/mapping location overrides.sc_override_* vars, the generate_*_name macros, the var-driven sources.yml, and the mart
config(database/schema/alias=…) headers are the override layer SnowConvert emits on purpose.
Don't edit their defaults or remove them to resolve a database- or schema-not-found error on such
a model.After applying the fix, re-run compilation:
dbt compile --project-dir <DBT_PROJECT_PATH> --profiles-dir ~/.dbt
Or, if a Snowflake warehouse is available and the user confirmed full validation:
dbt run --project-dir <DBT_PROJECT_PATH> --profiles-dir ~/.dbt
Node passes → record as fixed in your learnings artifact and move to next node
Node still fails with a new error → read the new error, retry the fix (up to 5 attempts per node)
Node still fails after 5 attempts → revert the file to its original content from <UNIT>/stabilization/original/, record as failed in your learnings artifact with the error summary
After all nodes in a project are processed, record the project-level outcome (all-fixed or N-failed) in your learnings artifact.
Do NOT call
track_status.pydirectly. The orchestrator reads your learnings artifact and updatessession_status.jsonafter all dbt agents complete.
After each fix attempt, append a record to your per-project learning file at <UNIT>/stabilization/phases/phase_{N}/dbt_learnings_<project_name>.md. The orchestrator merges these into tracking/fix-log.md after all dbt agents complete.
Do NOT write directly to
tracking/fix-log.md— always use the per-project learning file, regardless of whether you are the only agent or one of many. This ensures consistent behavior and avoids file conflicts.
### Fix Record
- **Unit**: <unit_name>
- **dbt Project**: <dbt_project_name>
- **Node**: <node_id>
- **File**: <model_file_path>
- **Error**: <error message>
- **Fix Applied**: <what you changed>
- **Outcome**: SUCCESS | FAILED | REVERTED
- **Attempt**: <N of 5>
- **Timestamp**: <ISO timestamp>
---
A single ETL unit may contain multiple dbt project subfolders. Process only the projects assigned to the current phase (as listed in ROADMAP.md). Track status per project.
After all dbt projects in the current phase are processed:
Read session_status.json to check per-node and project-level dbt status for projects in this phase.
Present the summary to the user:
dbt fixing complete for <unit_name>:
Projects processed: N
All nodes passing: M projects
Partially fixed: K projects
Failed: J projects
Per-project details:
- <project_name>: X/Y nodes passing (Z fixed by AI)
Fix log: <UNIT>/stabilization/tracking/fix_log.md
Session: <UNIT>/stabilization/tracking/session_status.json
Return to the parent skill (stabilization/SKILL.md) for next steps. The parent skill will run the pre-generated dbt tests to validate fixes. If tests fail, the parent skill will loop back here with the test failure messages.
PACKAGE)N)DBT_PROJECT_PATH)PACKAGE/stabilization/tests/dbt/<project_name>/test_report.mdROADMAP.md path — for identifying current phase and assigned dbt projectssession_status.json path — for reading/writing project and node statusSKILL_DIRPLATFORM_DIR/ewi/ when encountering markersPACKAGE/stabilization/tracking/fix_log.md for prior patternsDBT_PROJECT_PATH/models/DBT_PROJECT_PATH/macros/ (if bootstrap fixes were needed)dbt_project.yml (if placeholder values were replaced)sources.yml (if source definitions were corrected)PACKAGE/stabilization/phases/phase_N/dbt_learnings_<project_name>.md (orchestrator merges into fix_log.md at phase end)needs-user is a LAST RESORT status, valid ONLY after exhausting fix attempts with documented evidence. Before setting needs-user, you MUST:
The --reason flag is mandatory and must include this evidence.
Follow the Main Mode workflow in full. Apply these behavioral overrides:
tracking/fix-log.md — use per-project learning file instead. The orchestrator merges these after all dbt agents complete.If you feel context pressure after completing a node, stop and report partial completion — list which nodes were fixed and which were not. Prefer stopping early over running to exhaustion.
When your work is complete:
send_message to main summarizing: models fixed, compilation status, test results, any nodes still failingshutdown_request, use send_message with type: "shutdown_response" and approve: true