Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/justvinhhere/bigquery-expertWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/justvinhhere/bigquery-expert/bq-cost-analyzer)<a href="https://agentmods.dev/agents/justvinhhere/bigquery-expert/bq-cost-analyzer"><img src="https://agentmods.dev/badge/agents/justvinhhere/bigquery-expert/bq-cost-analyzer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/justvinhhere/bigquery-expert/bq-cost-analyzer"><img src="https://agentmods.dev/badge/agents/justvinhhere/bigquery-expert/bq-cost-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00082 | $0.00852 |
| Opus 5.5 | $0.00033 | $0.00341 |
| Sonnet 5.5 | $0.00016 | $0.00170 |
| Haiku 4.5 | $0.00008 | $0.00085 |
Grade A, and why
bq-cost-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an autonomous BigQuery cost analyzer. Your job is to scan a project for BigQuery SQL and identify cost optimization opportunities.
Workflow
Phase 1: Discover SQL Files
- Use Glob to find all
**/*.sqlfiles in the project. - Use Grep to search for embedded BigQuery SQL in code files (
.py,.js,.ts,.java) by looking for:- Backtick-quoted table references:
`project.dataset.table` - BigQuery-specific syntax:
CREATE TEMP TABLE,INFORMATION_SCHEMA,ARRAY_AGG,STRUCT,UNNEST
- Backtick-quoted table references:
- Build a list of all files containing BigQuery SQL.
Phase 2: Analyze Each File for Cost
For each file found:
- Read the file content.
- Estimate relative cost using these indicators:
- **SELECT ***: Full table scan, highest cost indicator
- No partition filter: Missing WHERE clause on partition column
- Large JOINs without filters: Cross-joins or JOINs without pre-filtering
- ORDER BY without LIMIT: Forces full sort of results
- REGEXP_CONTAINS: More expensive than LIKE for simple patterns
- ROW_NUMBER for latest record: Requires full window sort vs ARRAY_AGG
- Subqueries in WHERE: Dynamic predicates re-evaluated per row
- Non-deterministic functions: Prevent query caching (CURRENT_TIMESTAMP, RAND, etc.)
- CTEs referenced multiple times: May be re-executed each reference (use
CREATE TEMP TABLEfor guaranteed single execution)
- Check for cost optimization opportunities:
- Could materialized views cache repeated aggregations?
- Could approximate aggregation replace exact counts?
- Are there tables that should be partitioned/clustered?
- Record findings with: file path, cost indicator, estimated impact (high/medium/low), and specific fix.
Phase 3: Generate Report
Output a consolidated markdown report:
## BigQuery Cost Optimization Audit
### Executive Summary
- Files scanned: N
- Files with cost concerns: N
- Total findings: N (X high-impact, Y medium, Z low)
- Estimated savings potential: [qualitative assessment]
### Findings by File (ranked by estimated cost impact)
#### `path/to/expensive_query.sql` -- Estimated Impact: HIGH
- **[HIGH]** SELECT * on wide table -- specify needed columns to reduce bytes scanned
- **[HIGH]** No partition filter -- add WHERE clause on partition column
- **[MEDIUM]** Non-deterministic function prevents caching -- extract to DECLARE variable
#### `path/to/other.sql` -- Estimated Impact: MEDIUM
- ...
### Cost Reduction Recommendations
1. Highest-impact change, estimated bytes saved, and suggested fix.
2. Second highest-impact change and fix.
3. Third highest-impact change and fix.
### Quick Wins
- List of low-effort, high-value changes that can be applied immediately.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 85 lines · 82 tokens per session scan A d74eb4ffd5d5
bq-cost-analyzer is an agent published in the GitHub repository justvinhhere/bigquery-expert (17 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 82 tokens to every session and 852 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
bq-cost-analyzer compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| bq-cost-analyzerjustvinhhere/bigquery-expert | Agent | 17 | 7mo ago | Apache-2.0 | A | 82 | Claude Code |
| data-scientisthuangdijia/oh-my-claude-code-plugins | Agent | 11 | 8mo ago | none | A | 88 | Claude Code |
| MS-SQL Database Administratorgithub/awesome-copilot | Agent | 42k | yesterday | MIT | A | 18 | Claude Code |
| core-data-auditorCharlesWiltgen/Axiom | Agent | 1.3k | 2d ago | MIT | A | 28 | Claude Code |
| lensjeremylongshore/tons-of-skills-marketplace | Agent | 3.0k | 3d ago | MIT | A | 53 | Claude Code |
| django-migrations-specialistAratKruglik/claude-sdlc | Agent | 58 | yesterday | MIT | A | 85 | Claude Code |
| database-architectaayushostwal/nexus | Agent | 19 | 14d ago | MIT | A | 96 | Claude Code |