/snowflake-pack:snowflake-cost-leak-hunter [evidence-json-or-output-directory]from snowflake-pack
Audits Snowflake cost evidence across warehouse, serverless, storage, transfer, and AI usage. Produces a typed ledger preventing double counting and exposing attribution gaps. Use when bills increase, credits are unexplained, or chargeback evidence is needed.
Ships in snowflake-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Produce a read-only, evidence-first Snowflake cost investigation. The deterministic
analyzer emits a typed ledger whose total, attribution, context, estimate, and
invoice-only roles cannot silently collapse into one savings claim.
Problem: Cost views answer different questions, arrive at different times, and do not equal invoice truth. Generic advice easily turns observed credits into unsupported prices or promised savings.
Outcome: A reproducible review packet that identifies what the supplied evidence confirms, what was estimated from an approved rate, what remains at risk, and what is unknown.
SNOWFLAKE.ACCOUNT_USAGE surfaces.Write only to create
new local evidence/report files; never use it to alter Snowflake configuration.ACCOUNTADMIN. Use a role already authorized to read the needed
SNOWFLAKE.ACCOUNT_USAGE views. Visibility differs by database role and account
configuration; report missing access rather than escalating privileges.execution_context.observed_at, never
the later CLI completion timestamp. A quiet source with no recent activity is not
thereby stale.estimated until reconciled to the billing statement.Read references/attribution-and-staleness.md before collecting evidence. Read references/warehouse-and-idle-evidence.md for the bounded SQL surfaces. If controls are requested, read references/controls-boundaries.md, but return a review packet only. For Adaptive, storage, transfer, AI, surface-denominator, and typed-ledger rules, read references/cost-ledger-and-surfaces.md.
For a live, model-neutral collection, use the shared read-only collector with an existing Snowflake CLI profile:
python3 "${CLAUDE_SKILL_DIR}/scripts/collect_snowflake_evidence.py" \
--surface cost --connection <approved-readonly-profile> \
--window-start <YYYY-MM-DDTHH:MM:SSZ> \
--window-end <YYYY-MM-DDTHH:MM:SSZ> \
--output /tmp/snowflake-cost-collector.json
Map the baseline receipt's warehouse, query, load, and generic metering datasets into
the analyzer schema. The legacy input key serverless_usage means generic
METERING_HISTORY; public labels use metering:<SERVICE_TYPE>. Preserve every receipt
field and reject out-of-window rows, cap uncertainty, missing integrity fields, and
unscoped fingerprints. A self-checksum proves local consistency, not Snowflake origin.
Collect needed supplemental cost-* surfaces with the same bounded collector and put
each complete receipt under supplemental_receipts.<surface_inventory_name>. Follow
the surface contract for the exact dataset
keys, hashes, latency cutoffs, privacy rules, and unavailable-surface behavior.
Capture:
[window_start, window_end);If the user supplies only an invoice total, state that the audit can explain usage but cannot reconcile the invoice without the corresponding usage statement and contract rates.
Have the operator run the smallest read probes with the approved connection and provide the sanitized results. This skill does not expose the Snowflake CLI namespace. A representative probe is:
SELECT MAX(end_time) AS max_end_time
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= :window_start
AND start_time < :window_end;
Probe QUERY_ATTRIBUTION_HISTORY separately because its availability, latency, and
coverage differ. If either probe fails, preserve the exact sanitized error, name the
missing surface, and stop that branch. Do not propose granting broad imported
privileges automatically.
Use the queries and field definitions in
references/warehouse-and-idle-evidence.md.
Export only the normalized fields accepted by
scripts/analyze_cost_evidence.py; exclude raw SQL text and credentials.
The input accepts baseline warehouse/query/load/metering arrays; supplemental Adaptive, storage, transfer, AI, monitor, and budget evidence; optional invoice rows; and user-supplied credit rates. Read the surface contract for the exact keys and overlap rules. Inventory assertions without matching receipts block completeness.
Record each source's maximum activity timestamp only as descriptive context; it does not prove freshness, and an absent source is not zero usage. Apply the reference's identity-disclosure contract. Never export raw users, tags, query text, notification addresses, contract numbers, credentials, or connection values.
Print the canonical bundle digest in a trusted local terminal and record it separately from the bundle. Never trust a digest copied from inside the evidence itself:
python3 "${CLAUDE_SKILL_DIR}/scripts/analyze_cost_evidence.py" \
--input cost-evidence.json --print-input-sha256
Then pass that separately recorded value back to the analyzer. Live receipts older than one hour are rejected as stale transport evidence; recollect rather than relaxing the bound.
python3 "${CLAUDE_SKILL_DIR}/scripts/analyze_cost_evidence.py" \
--input cost-evidence.json \
--trusted-input-sha256 <recorded-sha256:hex-digest> \
--json-out cost-analysis.json \
--markdown-out cost-analysis.md
The script validates non-negative numeric evidence, sums with decimal arithmetic, and
keeps total, attribution, context, estimate, and invoice-only ledger roles
separate. Their additive and overlap rules are defined in the surface contract.
It does not apply magnitude thresholds, infer a price, or recommend a warehouse size.
Daily average storage snapshots must remain per day or use an explicitly labeled
average/byte-day calculation; summing multiple daily snapshots and labeling the result
bytes is invalid.
When query fingerprints have both attributed credits and elapsed time, it also emits
a non-dominance cost/latency Pareto view. A Pareto point is a comparison aid, not a
proof that a workload should move warehouses. Right-sizing is only a bounded review
proposal when the operator supplies the current size, explicit candidate sizes,
maximum size steps, measurement window, success criteria, and approver; never infer a
target size from credits or queue time.
For each ranked opportunity, record:
Examples of competing explanations include intentionally warm warehouses, SLA-driven capacity, untagged shared-service queries, or usage outside the attribution view's coverage. Do not label those cases waste without workload-owner confirmation.
Follow references/output-contract.md. Lead with the window and coverage, not a sensational savings number. A valid packet contains:
review required;Return cost-analysis.json and cost-analysis.md in the user's chosen working
directory, plus the exact analyzer command used. The JSON is the machine-readable
receipt; Markdown is the human review packet. Both must contain the analysis window,
source freshness, confirmed observations, estimated amounts, at-risk opportunities,
warnings, and non-claims. Do not write runtime output into the skill directory.
Stop and return a bounded partial result when:
| Condition | Meaning | Required response |
|---|---|---|
| Approved role cannot read a required view | Coverage unavailable | Preserve the sanitized error, name the missing surface, and stop that branch without changing grants. |
| Requested end exceeds the fixed source-specific settled cutoff | Recent evidence may be incomplete | Return a partial result; do not enlarge the cutoff from a caller-supplied latency or maximum activity timestamp. |
| Attributed-query credits are NULL | Idle/unattributed calculation is unsupported for that row | Emit COST_ADAPTIVE_ATTRIBUTION_GAP; exclude the row from that calculation and do not substitute zero. |
| Generic AI or warehouse total and detailed attribution both exist | The evidence can overlap by design | Retain one additive total and attach AI Functions detail only beneath an account/window-aligned AI_SERVICES row from METERING_HISTORY; do not assert equality because that parent also covers Cortex Analyst. Otherwise keep the relationship unknown. |
| Storage or transfer evidence has bytes but no contract billing model | Operational context is present without price evidence | Keep bytes as context; do not infer currency or invoice amounts. |
| No applicable contract rate | Currency cannot be defended | Report credits only; do not substitute a public price. |
| Analyzer rejects evidence | Malformed timestamp, negative/non-finite number, or incompatible shape | Correct the input from source evidence; never coerce it into a plausible value. |
| User requests mutation | New authority and impact review are required | Return a proposed change packet and stop before execution. |
Collect the two warehouse surfaces over the same UTC window. The analyzer may report
42.5 confirmed warehouse compute credits and 11.2 credits at risk for idle-time review. It must not call all 11.2 credits waste or convert them to dollars without a
supplied rate.
Aggregate QUERY_ATTRIBUTION_HISTORY by the existing tag. Report tagged and untagged
credits, the view's maximum timestamp, and exclusions such as idle, serverless, storage,
and cloud-services cost. Missing tags are an at-risk attribution gap, not proof of
unowned spend.
Do not create or alter a monitor. Audit current warehouse evidence, explain the warehouse-only coverage and suspension caveats from references/controls-boundaries.md, and return a reviewable control proposal requiring explicit authorization.
scripts/analyze_cost_evidence.py — deterministic
validator, classifier, and renderer.eval-spec.yaml (opens in a new tab)references/attribution-and-staleness.md (opens in a new tab)references/controls-boundaries.md (opens in a new tab)references/cost-ledger-and-surfaces.md (opens in a new tab)references/output-contract.md (opens in a new tab)references/pareto-and-right-sizing.md (opens in a new tab)references/warehouse-and-idle-evidence.md (opens in a new tab)scripts/analyze_cost_evidence.py (opens in a new tab)scripts/collect_snowflake_evidence.py (opens in a new tab)scripts/sql/cost-adaptive.sql (opens in a new tab)scripts/sql/cost-ai-functions.sql (opens in a new tab)scripts/sql/cost-budgets.sql (opens in a new tab)scripts/sql/cost-internal-transfer.sql (opens in a new tab)scripts/sql/cost-resource-monitors.sql (opens in a new tab)scripts/sql/cost-storage.sql (opens in a new tab)scripts/sql/cost-transfer.sql (opens in a new tab)scripts/sql/cost.sql (opens in a new tab)tests/fixtures/cost_evidence.json (opens in a new tab)tests/fixtures/cost_evidence_partial.json (opens in a new tab)tests/fixtures/cost_evidence_v2.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
inherithighThree short reads, in order
snowflake-cost, finops, cost-audit, chargeback, cloud-cost-analysis
10 skills in this plugin
/snowflake-access-guardianAudit Snowflake effective access and produce a safe least-privilege change packet.
Trace account-role inheritance, primary and secondary roles, managed-access
schemas, ownership, direct-to-user/PUBLIC grants, orphaned principals, and
existing-versus-future-grant conflicts. Use when access is unexpectedly broad or
denied, a role graph needs review, or an authorization cleanup needs evidence.
Trigger with phrases like "Snowflake access audit", "trace Snowflake grants",
"why can this user read", "Snowflake RBAC drift", or "future grants conflict".
/snowflake-data-quality-sentinelAssess trusted Snowflake data metric function coverage and expectation evidence
without reading customer rows. Use when evaluations, definitions, schedules,
notifications, anomaly state, or monitoring coverage may be incomplete or
unhealthy. Trigger with "Snowflake data quality", "DMF expectation",
"definition drift", "missing evaluation", or "notification gap".
/snowflake-deploy-medicReview and safely diagnose Snowflake infrastructure and database deployments
across the snowflakedb/snowflake Terraform 2.x provider, grants/state/imports,
schemachange versioned and repeatable migrations, Snowflake CLI/drivers, and
behavior-change releases. Use before a production deploy, when a plan wants
to replace or revoke grants, state is unreadable, a migration checksum drifts,
or a CLI/driver upgrade changes behavior. Produces a zero-change/plan verdict,
ordered remediation, and tested rollback requirements. It never applies,
destroys, deploys, runs mutating SQL, or edits state/history automatically.
Trigger with "Snowflake Terraform plan", "grant import", "terraform state",
"schemachange checksum", "repeatable migration", "Snowflake CLI upgrade",
"driver BCR", or "rollback Snowflake deploy". Use when a production change
needs a current plan, migration-integrity, toolchain, or rollback gate.
/snowflake-failover-readiness-drillAnalyze Snowflake failover-group RPO/RTO readiness from independently trusted,
privacy-preserving live receipts without executing refresh, failover, failback,
redirect, cancellation, resume, or session changes. Use when an owner needs a
Business Critical disaster-recovery preflight, replication failure diagnosis,
dangling-reference check, or operator-executed drill proof. Trigger with "Snowflake
failover drill", "replication RPO", "failback proof", or "secondary refresh".
/snowflake-governance-coverage-auditorAudit trusted Snowflake classification, tags, masking, row access, projection,
join, aggregation, and privacy-policy evidence without reading customer data.
Use when governance enforcement may be missing or ambiguous. Trigger with
"Snowflake governance coverage", "policy precedence", "tag policy gaps",
"classification failure", or "POLICY_CONTEXT verification".
/snowflake-native-app-release-sheriffPreflight Snowflake Native App package releases from trusted, privacy-safe
provider evidence without publishing, upgrading, altering, granting, or
approving anything. Use when reviewing manifest/setup safety, security-scan gates,
version and release-directive validation, App Spec or privilege changes,
upgrade-cohort compatibility, and rollback readiness. Trigger with "Native
App release", "application package scan", "upgrade cohort", or "App Spec".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin snowflake-packOther plugins' skills for the same job