Claude Code + Cost Optimization Agent: Cut Your Snowflake Bill from the Terminal
Find zombie tables, right-size warehouses, and optimize queries
The Claude Code cost optimization agent is an MCP server from Data Workers that identifies wasted Snowflake, BigQuery, and Databricks spend from your terminal. It pinpoints expensive queries, oversized warehouses, and idle clusters — then generates the SQL and config changes to cut your bill, typically by 30-to-40 percent.
The Claude Code cost optimization agent identifies wasted warehouse spend and gives you concrete actions to reduce it — all from a single terminal command. If your Snowflake bill keeps climbing and nobody on the team can explain why, you are not alone. Warehouse costs are the fastest-growing line item in most data budgets, and the optimization tools built into cloud warehouses are designed for DBAs, not data engineers. The cost optimization agent from Data Workers is an MCP server that gives Claude Code visibility into your warehouse spending, identifies waste, and generates the SQL to fix it.
The average enterprise wastes 25-35% of its cloud data warehouse spend on zombie tables nobody queries, oversized warehouses running during off-hours, redundant materializations, and queries that scan entire tables when they should use clustering. The cost optimization agent finds this waste and tells you exactly how to eliminate it.
Why Warehouse Costs Spiral Out of Control
Warehouse costs grow because optimization requires continuous effort that nobody is explicitly accountable for. A data engineer creates a large warehouse for a one-time backfill and forgets to resize it. An analyst schedules a heavy query that runs every hour even though the data only refreshes daily. A dbt model materializes as a table when a view would suffice. Each of these is small on its own, but they compound — and nobody is looking at the aggregate.
Cloud warehouse pricing is also notoriously opaque. Snowflake charges by compute credits, which map to warehouse sizes and run times in non-obvious ways. BigQuery charges by bytes scanned, which depends on query patterns and table clustering. Without a dedicated FinOps engineer (another expensive hire), these costs accumulate unchecked.
Your First Cost Audit from the Terminal
Open Claude Code and ask the question every CFO wants answered:
claude "Which tables and warehouses are wasting money in our Snowflake account?"
The cost optimization agent scans your account metadata, query history, and warehouse utilization and returns a prioritized list of savings opportunities:
| Issue | Details | Monthly Waste | Fix |
|---|---|---|---|
| Zombie tables | 47 tables with zero queries in 90 days | $2,400/mo in storage | Archive or drop — agent lists each table |
| Oversized warehouse | ANALYTICS_WH is XL but avg CPU is 12% | $3,100/mo in compute | Resize to Medium — agent generates ALTER |
| 24/7 warehouse | ETL_WH runs continuously, used 4hrs/day | $1,800/mo in idle time | Enable auto-suspend at 60 seconds |
| Full table scans | 12 queries scan 100% of large tables daily | $900/mo in compute | Add clustering keys — agent generates DDL |
| Redundant materializations | 8 dbt models materialized as tables, queried <1x/week | $600/mo in storage + refresh | Switch to views — agent updates config |
In this example, the agent identified $8,800/month in waste — over $100,000 annually — in a single scan. And every finding comes with the specific SQL or configuration change to fix it.
Deep-Diving into Specific Cost Drivers
After the initial audit, you can drill into specific areas:
claude "Show me the top 20 most expensive queries this month and suggest optimizations"
The agent retrieves query history with cost attribution and analyzes each expensive query for optimization opportunities. Common findings include queries that would benefit from clustering key alignment, queries that scan partitions unnecessarily due to missing filter predicates, and queries that could use materialized views to avoid repeated computation.
For each finding, the agent generates the optimized query or the DDL change that would reduce cost. It also estimates the savings so you can prioritize the highest-impact changes.
Warehouse Scheduling and Right-Sizing
One of the biggest cost levers is warehouse sizing and scheduling. The agent can analyze your warehouse utilization patterns and recommend a schedule:
claude "Analyze the utilization of all our warehouses and recommend sizing and scheduling changes"
The agent examines hourly utilization patterns for each warehouse and produces recommendations:
- •ETL_WH: Upsize to Large during the 2-5am ETL window, downsize to Small during the day for ad-hoc queries. Estimated savings: $2,100/month.
- •ANALYTICS_WH: Current XL size is justified during business hours (9am-6pm) but should auto-suspend after 60 seconds of inactivity. Estimated savings: $1,400/month.
- •DEV_WH: Used only by 3 engineers, primarily during US business hours. Recommend auto-suspend at 30 seconds and size cap at Medium. Estimated savings: $800/month.
The agent generates the SQL to implement these changes, including Snowflake resource monitors and task schedules for automated resizing.
Before and After: Cost Management
| Activity | Without Agent | With Cost Optimization Agent |
|---|---|---|
| Cost visibility | Monthly bill review, no attribution | Real-time cost attribution by query, user, warehouse |
| Waste identification | Manual audit — if it happens at all | Automated scan with prioritized savings |
| Optimization | Generic best practices | Specific to your workload and usage patterns |
| Implementation | Research syntax, write SQL, test carefully | Agent generates ready-to-execute changes |
| Ongoing monitoring | Wait for next bill shock | Continuous monitoring with drift alerts |
| Time investment | Dedicated FinOps engineer or consultant | Terminal commands by anyone on the team |
Continuous Cost Monitoring
Cost optimization is not a one-time exercise. The cost optimization agent supports continuous monitoring to prevent cost regression:
- •
claude "Has our Snowflake spend changed significantly this week compared to last week?"— trend analysis with anomaly detection - •
claude "Alert me if any warehouse exceeds $500 in daily compute"— budget threshold configuration - •
claude "Which team's queries are growing fastest in cost?"— team-level cost attribution for chargeback - •
claude "Are the optimizations we applied last month still saving money?"— optimization impact tracking
These queries give you ongoing cost governance without hiring a FinOps specialist or building custom dashboards. The agent integrates with your existing warehouse metadata, so there is no additional instrumentation required.
Getting Started with Cost Optimization
The cost optimization agent works with Snowflake, BigQuery, Redshift, and Databricks. Follow the Getting Started guide to install Data Workers and the Claude Code Setup guide to connect the agent. It needs read access to your warehouse metadata and query history — no access to your actual data.
Run your first cost audit today. Most teams find five-figure annual savings in the first scan. The Docs cover advanced features including automated optimization scheduling, chargeback reporting, and integration with cloud billing APIs. See all 15 agents on the Product page.
Your warehouse bill does not have to be a mystery. Book a demo to see the cost optimization agent find savings in your own Snowflake, BigQuery, or Redshift account.
Go from data platform to
agentic platform.
With autonomous AI agents working across your entire data stack — MCP-native, open-source, deployed in minutes.
Book a Demo →Related Resources
- Cost Agent Snowflake Optimization — Cost Agent Snowflake Optimization
- Integrating Claude Code with Snowflake for Enhanced Data Workflows — Learn how to integrate Claude Code with Snowflake to enhance your data workflows using AI coding…
- How to Integrate Claude Code with Snowflake for Data Governance — Learn how to integrate Claude Code with Snowflake to enhance your data governance strategy using…
- Creating a Data Catalog Agent with Claude Code — Learn how to create a data catalog agent with Claude Code, enhancing data management capabilities…
- Integrating Claude Code with Snowflake for Enhanced Data Processing — Learn how to integrate Claude Code with Snowflake for efficient data processing using our detaile…