Turn giant legacy SQL into Snowflake and dbt with an agent that chunks the script, converts it, runs it, and self-heals failed validations up to a fixed number of retries: AI agent prompt

Zensar's case study describes an Agentic AI modernization framework for a leading US regional bank moving legacy SQL onto Snowflake and dbt. Many queries were 1,000–1,500 lines and failed when sent as a single model call. Zensar built a LangGraph pipeline with Claude models that decomposes large SQL into chunks, applies curated conversion rules, stitches outputs, executes the converted code in Snowflake, captures errors, and runs up to six automated fix iterations. Newly learned rules are stored in Snowflake so later runs improve. The write-up reports handling 1,500+ line workloads and reducing manual debugging through self-healing; it does not publish a bank-wide percent of scripts converted or hours saved. Treat those benefits as directional until you measure on your own estate.

CodingSQL-to-dbt conversion with self-healing agentsadvanced

The prompt

Plan a SQL-to-Snowflake/dbt conversion agent for my warehouse. Stack: [Snowflake/dbt version], sample object: [paste one complex view or procedure, or describe size]. Constraints: no production writes without my approval; keep business logic comments. 1) Design the agent graph: chunk → convert → stitch → execute-in-dev → capture error → fix (max 6 loops) → human review. 2) Write the conversion rules checklist (dialect changes, temp tables, procedural control flow → dbt models/tests). 3) Define what "validated" means (compiles, row-count check vs source within [tolerance], key column checksum). 4) Specify which failures must stop for a person (permission errors, ambiguous business rules). 5) Give a 5-object pilot plan and the metrics to log (iterations to green, human minutes per object). Do not run against prod.
Open in ChatGPT Open in Claude Perplexity Download as agent skill (SKILL.md)

Fill in the blanks, then copy

This prompt has 3 [bracket]s to fill in. Type your details below and the prompt updates as you go. Your answers stay in this browser and are reused on other prompts with the same blanks. Nothing is sent to us.

How to use it

  1. Copy the prompt above.
  2. Replace every [bracket] with your own details (use the fill-in-the-blanks box above, which remembers your answers for the next prompt).
  3. Paste it into LangGraph, Claude, Snowflake and review the answer before you use it.

Works with: LangGraph, Claude, Snowflake, dbt, ChatGPT

Real-world example: zensar.com/insights/case-study/banking-and-financial-services/data-eng

Featured in: AI prompts for writing SOPs, reports, policies and checklists

Before you use it: what to check

Already built into this prompt

Check yourself

Using an AI agent? Download this prompt as a SKILL.md agent skill with these checks built in, or get the .zip for Claude.ai. How to install skills.

Share:Post on XLinkedInFacebookRedditWhatsApp
</> Embed this prompt on your site

Paste this HTML into your blog or website. It's a plain card with no tracking scripts that links back to this prompt.

Want to make this prompt even better? Grade it with the free prompt grader or build your own with the AI prompt generator.

Get the free Solo Founder Stack pack

32 copy-paste agent prompts (PDF) plus 5 new prompts every week.

Get it free

More Coding prompts

Ship a small feature as a PRFeatures · intermediateBuild a simple internal toolNo-code apps · beginnerAutomation script for a boring taskScripts · beginnerCommit & PR assistantGit workflow · intermediateFix a failed pipelineCI fixes · intermediateCheckpointed long task setupLong-running tasks · intermediate

See all Coding prompts →

Related prompts from other teams

Competitor watch reportMarketing · beginner · worked exampleMarket size & trend reportResearch · beginnerWeekly status reportOperations · beginner · worked exampleWrite an SOP from a messy processOperations · beginner · worked example