Weekly Database Reports with Claude Code
Once AI can query your database, the useful part is often a Monday report — signups, returning users, cancellations. Prompts and habits for recurring Claude Code jobs on live Postgres.
“Connect AI to your database” usually sounds like an engineer asking random SQL questions in chat.
There’s a quieter use: the same report every week so you stop pinging someone for a CSV.
New signups vs returning users. Cancellations. A short note on what moved. Claude Code can pull that from live tables on a schedule — if the connection is already there and read-only.
What to automate, prompts to paste, and what still belongs in Metabase or Looker:
Setup if you don’t have a connection yet: Connect Claude to PostgreSQL (or Cursor / ChatGPT). Safety: staging first, SELECT-only user, table allowlists.
What Claude Code does vs what the gateway does
| Piece | Job | |--------|-----| | Database | Holds the rows | | MCP gateway (e.g. Synra) | Secure URL, read-only SQL, logs | | Claude Code | Schedule, inspect schema, run SELECTs, write the summary |
If someone says “Synra emails me every Monday,” that’s wrong. Synra answers queries. Claude Code (or cron + a script) decides when to ask.
Good weekly jobs (and bad ones)
Good
- Counts and comparisons you already understand (signups this week vs last)
- Short anomaly notes (“cancellations 2× last week — here are the raw counts”)
- A Slack-sized markdown blurb, not a 20-page deck
Bad
- Inventing “LTV” with no definition in your tables
- Scanning full
usersPII every Monday when you only need aggregates - Hitting the production primary with heavy analytical SQL on a loop
If the metric is already a governed dashboard number, keep the dashboard. AI shines when the question is recurring and a little narrative: what changed, what to look at next. For one-off exploration, plain chat is enough — see talk to your database without an analyst.
Prompt: Monday signup report
Paste into Claude Code (adjust table/column names after it inspects your schema):
You have read-only database access via MCP. Inspect the schema before querying.
Every Monday, produce a short markdown report:
1. New signups this week vs last week (define "signup" from the actual tables — don't invent columns)
2. Returning or repeat activity if the data supports it; if not, say so
3. Cancellations or churn events this week vs last week, if those tables exist
4. Anything that looks like a sharp change (call out the numbers)
Rules:
- SELECT only
- Show the SQL you ran
- If a column is unclear, ask or skip — never guess status enums
- Output under ~400 words so I can paste into Slack
First run: do it manually and verify the numbers against SQL you trust. Then schedule.
Prompt: turn it into a recurring task
Exact scheduling UI changes; the instruction stays stable:
Turn the Monday signup report into a recurring Claude Code task
every Monday at 09:00 in my local timezone.
Reuse the same queries after the first successful run.
If the database connection fails, output a clear error — don't invent numbers.
Save or print the markdown summary each run.
If your Claude Code build uses a different name for scheduled tasks, keep the report prompt and wire the schedule in whatever the product calls it today.
Prompt: traffic / activation add-on
Only if you actually store events or page views in Postgres (many teams don’t — analytics may live in Mixpanel/GA):
If we have an events or sessions table, add to the Monday report:
- weekly active-ish count you can defend from the schema
- week-over-week change
If we don't store traffic in this database, say "not in this DB" and skip.
Do not pull from external analytics APIs unless configured.
Honesty beats a fake “traffic up 12%” from a table that doesn’t exist.
Before you schedule anything
- Staging or replica — not casual prod primary
- SELECT-only DB user + gateway read-only
- Allowlist: aggregates and product tables yes; full identity dumps no
- Three known-answer checks once
- Name the connection
staging-weekly-reportsso you don’t mix endpoints - Glance at Usage after the first two automated runs
A wrong query once is annoying. A wrong query every Monday is a process.
When the report is “wrong”
- Off by a lot — wrong connection or wrong “signup” table. Check Usage for the credential name.
- Status filters weird — ask for
SELECT DISTINCT statusand fix the prompt. - LTV / cohort nonsense — you probably don’t have the columns; define the metric in SQL/BI first, then automate.
For a lot of non-engineers, recurring reports are the reason to connect a database at all. Safe connection, Monday prompt, verify once, then schedule.
Read-only gateway: mcpserver.design (7-day Solo trial). Claude Code owns the calendar.
Related reading:
- Ask AI Why Customers Cancelled — follow-up when the weekly churn line spikes
- Prompts for Talking to Your Database — one-off questions worth saving
- How to Verify AI Answers About Your Database — known-answer checks
- Talk to Your Database Without an Analyst — ad-hoc vs recurring
- Can AI Actually See Your Data? — safety and cost overview