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.
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.
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.
Example values are fictional, just to show how a filled-in prompt reads. Replace them with your real details.How to use it
- Copy the prompt above.
- Replace every [bracket] with your own details (use the fill-in-the-blanks box above, which remembers your answers for the next prompt).
- 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
- Constraints: no production writes without my approval; keep business logic comments.
- Do not run against prod.
Check yourself
- Remove names, contact details, account numbers and other personal data the task doesn't need before you paste, and check your AI tool's data and training settings.
- Read and edit the draft before it reaches a customer or goes public. If you later automate this prompt, start with "draft and notify me", not "send automatically".
- Check names, dates, numbers and any claim against your own source material before you use the answer. AI can misread or invent details.
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.
Want to make this prompt even better? Grade it with the free prompt grader or build your own with the AI prompt generator.
32 copy-paste agent prompts (PDF) plus 5 new prompts every week.
Get it free