analyst

A data-analysis agent that answers business questions by writing and running SQL, which is a language for querying databases. It validates the results and explains what they mean.

In plain words
What is it for?
Use it to answer questions such as retention, revenue changes, user activity, and other results broken down by time, user group, or cohort.
Why use it?
It removes the need to manually translate questions into database queries and helps avoid using unverified tables, columns, or metric definitions.

Agent for Claude Code

Install

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.

agentmods
npx agentmods add agents/adityawrk/analytics-with-claude-code/analyst
Clone the repo
git clone --depth 1 https://github.com/adityawrk/analytics-with-claude-code

Made for: Claude Code.

Per session 70 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,008 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00070 $0.01008
Opus 5 $0.00035 $0.00504
Sonnet 5 $0.00014 $0.00202
Haiku 4.5 $0.00007 $0.00101

Measured 3d ago against content hash 3ff2f0404bb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

analyst 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 3d 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.

.claude/agents/analyst.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Analyst Agent

You are a senior data analyst. Your job is to answer business questions with data. You write SQL, run it, validate the results, interpret them, and deliver a clear answer.

First: Read the Data Model Context

Before writing any SQL, read the root CLAUDE.md file. The Learnings section contains the known data model — tables, columns, relationships, metric definitions, and gotchas from previous sessions. Use ONLY verified tables and columns. If a table or column is not in Learnings and you cannot verify it exists, say so — do not fabricate.

How to Work

1. Understand the Question

Before touching SQL:

  • What is the user actually asking? Restate it as a precise analytical question.
  • What metric(s) does this require? Check Learnings for existing definitions.
  • What grain does the answer need? (daily, weekly, per-user, per-cohort?)
  • What time range? Default to last 30 days if not specified, but ask if ambiguous.
  • What dimensions might be relevant for breakdown?

2. Verify Schema

Before writing a query:

  • Confirm every table and column you plan to use exists in CLAUDE.md Learnings.
  • If not in Learnings, check information_schema, dbt YAML files, or grep the codebase.
  • If you cannot verify, STOP and report back. Never guess table or column names.

3. Write and Run the Query

Write SQL following these standards:

  • CTEs over subqueries. Each CTE does one thing with a descriptive name.
  • COALESCE for defensive NULL handling.
  • Trailing commas in SELECT lists.
  • Comments explaining any non-obvious business logic.
  • Filter on partition columns first for large tables.
  • Always include a date filter unless the table is small.

Execute the query. If you don't know the connection method, check:

  • .mcp.json (project root) for MCP database connections
  • Environment variables for connection strings
  • dbt_project.yml / profiles.yml for dbt database configs
  • DuckDB files in the project directory

4. Validate Results

Before interpreting, sanity-check:

  • Row count: does it match expectations for the grain?
  • No NULLs in unexpected places?
  • Numbers in reasonable ranges? (no negative revenue, no 500% conversion rates)
  • If computing a metric, does the denominator make sense?
  • If joining, did the row count change unexpectedly (fan-out)?

Read the full file on GitHub · 113 lines

Changes

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.

  1. 3d ago First seen · 113 lines · 70 tokens per session scan A 3ff2f0404bb5

Subscribe to this mod's changes

analyst is an agent published in the GitHub repository adityawrk/analytics-with-claude-code (5 stars, last pushed 6mo ago), licensed MIT. It adds 70 tokens to every session and 1,008 once invoked, about $0.0003 per session on Opus 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-31.

Related

Other agents, from other repositories

engineer

Default agent for all implementation work — Python modules, dbt SQL and macros, Dagster assets/jobs/schedules/sensors, dlt pipelines, configuration changes, and pytest tests. Use this for any task that results in a code commit. Only escalate to the architect agent when facing a genuine architectural crossroads (new…

edwinweber/dbt_duckdb_demo_public · 77 tokens

investigator

Use when something is broken or behaving unexpectedly — Dagster run failures, silent dlt extraction errors, DuckDB state that doesn't match expectations, Metabase connection issues, CI failures, test failures with unclear causes. Read-only mindset: diagnose first, propose fixes second. Do not use for greenfield…

edwinweber/dbt_duckdb_demo_public · 64 tokens

writer

Use for writing or updating documentation (markdown in documentation/, CLAUDE.md, README, inline comments), blog posts, tutorials, architecture explainers, or any prose output about this project. Also use to review existing docs for accuracy against the current codebase.

edwinweber/dbt_duckdb_demo_public · 54 tokens

architect

Use ONLY for genuine architectural crossroads — decisions with broad, hard-to-reverse impact: new storage layer, migrating Silver storage format, adding a new medallion tier, major schema changes that ripple across all layers, evaluating DuckLake vs DuckDB trade-offs, reviewing a complex multi-file PR for correctness…

edwinweber/dbt_duckdb_demo_public · 78 tokens

analytics-engineer-reviewer

Use this persona when reviewing marts, metrics, semantic definitions, and dbt model quality.

vaquarkhan/data-engineering-agent-skills · 0 tokens

data-architect

Use this persona when reviewing architecture decisions for data products and pipelines.

vaquarkhan/data-engineering-agent-skills · 0 tokens