skills/data-cost-optimizer/SKILL.md
Warehouse cost reduction, auto-scaling, query optimization, and lifecycle policies for data infrastructure. Activate on: data cost, warehouse credits, cost reduction, auto-scaling, lifecycle policy, cold storage, cost monitoring, resource optimization. NOT for: query performance tuning (use data-warehouse-optimizer), batch job optimization (use batch-processing-optimizer).
npx skillsauth add curiositech/windags-skills data-cost-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reduce data infrastructure costs through warehouse right-sizing, storage lifecycle policies, query optimization, and FinOps practices.
Activate on: "data cost", "warehouse credits", "cost reduction", "auto-scaling", "lifecycle policy", "cold storage", "cost monitoring", "Snowflake credits", "BigQuery slots", "FinOps"
NOT for: Query performance tuning → data-warehouse-optimizer | Batch job resource sizing → batch-processing-optimizer | Infrastructure provisioning → relevant DevOps skill
| Domain | Technologies | |--------|-------------| | Snowflake | Resource monitors, auto-suspend, warehouse sizing, credit tracking | | BigQuery | Slot reservations, flat-rate vs on-demand, BI Engine, editions | | Storage | S3 lifecycle (Standard → IA → Glacier), GCS Nearline/Coldline | | Monitoring | Snowflake Account Usage, BigQuery INFORMATION_SCHEMA, Cost Explorer | | FinOps | Kubecost, Datadog Cloud Cost, custom dashboards |
-- 1. Resource monitor: alert at 80%, suspend at 100%
CREATE RESOURCE MONITOR monthly_budget
WITH CREDIT_QUOTA = 5000
FREQUENCY = MONTHLY
START_TIMESTAMP = IMMEDIATELY
TRIGGERS
ON 80 PERCENT DO NOTIFY
ON 100 PERCENT DO SUSPEND;
ALTER WAREHOUSE analytics_wh SET RESOURCE_MONITOR = monthly_budget;
-- 2. Auto-suspend idle warehouses
ALTER WAREHOUSE analytics_wh SET
AUTO_SUSPEND = 60 -- suspend after 60s idle
AUTO_RESUME = TRUE
MIN_CLUSTER_COUNT = 1
MAX_CLUSTER_COUNT = 3 -- auto-scale up to 3 clusters
SCALING_POLICY = 'ECONOMY'; -- prefer queue over new cluster
-- 3. Find expensive queries
SELECT
query_id,
user_name,
warehouse_name,
total_elapsed_time / 1000 AS seconds,
bytes_scanned / (1024*1024*1024) AS gb_scanned,
credits_used_cloud_services
FROM snowflake.account_usage.query_history
WHERE start_time > DATEADD(day, -7, CURRENT_TIMESTAMP)
ORDER BY credits_used_cloud_services DESC
LIMIT 20;
Data Age Storage Tier Cost (S3) Access
────────── ──────────── ───────── ──────
0-30 days Standard $0.023/GB Frequent
30-90 days Infrequent Access $0.0125/GB Occasional
90-365 days Glacier Instant $0.004/GB Rare
1-3 years Glacier Flexible $0.0036/GB Archive
3+ years Glacier Deep Archive $0.00099/GB Compliance only
Savings: moving 10TB from Standard to lifecycle-managed
Before: $230/mo
After: ~$50/mo (78% reduction)
┌─────────────────────────────────────────────────┐
│ Monthly Data Infrastructure Cost: $12,450 │
│ │
│ By Team: │
│ Analytics ████████████████ $5,200 (42%) │
│ Data Eng ██████████ $3,100 (25%) │
│ ML Platform ████████ $2,500 (20%) │
│ Ad-hoc ████ $1,650 (13%) │
│ │
│ By Category: │
│ Compute █████████████ $7,500 (60%) │
│ Storage ██████ $3,200 (26%) │
│ Egress ███ $1,750 (14%) │
│ │
│ Top Optimization Opportunities: │
│ 1. Idle warehouse X-Large: $800/mo savings │
│ 2. Full-scan query by user@co: $400/mo │
│ 3. Duplicate staging tables: $300/mo storage │
└─────────────────────────────────────────────────┘
data-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.