agentleFS
aideploytutoraideploytutor/skill-deploy-share/skills/ops-dashboard/SKILL.md

ops-dashboard

Skill2 starsChanged 35 days agoMITView on GitHub

Add an owner-only ops dashboard (/ops) to a launched site — new users, revenue, payments and emails for the last 14 days with daily bars, plus health checks (database, nightly backup, payment webhooks, email delivery) and a live event feed — read straight from the site's own Postgres, with no tracking script and no outside account. Use when the user says "I launched, now what", "how many people signed up", "show me my numbers", "ops dashboard", "运营看板", "后台数据", "监控网站", or a later monitoring skill requires ops-dashboard.

  • Reads credentials

The file

Files
SKILL.md

ops-dashboard

Goal: after launch, the owner opens one page on their phone and knows in five seconds whether anyone signed up, whether money came in, and whether anything is broken. Follow ../../STACK.md.

Why no PostHog/GA here: everything that matters at this stage is already in the database the earlier skills write (auth_users, pay_payments, pay_subscriptions, pay_webhook_events, pay_grants, core_events with email.sent/email.failed/db.backed_up). Reading it costs nothing, needs no sign-up, and can't be blocked by ad blockers. Visitor analytics come in a later episode.

What it shows

BlockSource
New users · 7 days (+ total, + last 24 h)auth_users.created_at
Revenue · 7 days (current Creem mode only)pay_payments where status = 'paid'
Payments · 7 days (+ active subscriptions, refunds)pay_payments, pay_subscriptions, pay_grants.revoked_at
Emails sent · 7 days (+ failed)core_events email.sent / email.failed
Health: database, nightly backup (warn after 36 h), payment webhooks (failed), email deliveryquery time, db.backed_up, pay_webhook_events.status, email.failed
What happened · 7 days, Latest eventscore_events type, source and time only

Each tile has 14 daily bars (today in the accent colour; hover/tap a bar for its date and value). Tables that aren't installed count as 0, so it works on a bare foundation too.

Free-database quota (learned the hard way, Nov 2026)

Neon's free plan gives 100 CU-hours per project per month and suspends the database until next month when they run out. The compute only sleeps after 5 minutes without queries, so anything that queries the database every ≤5 minutes keeps it awake 24/7 (~180 CU-hours/month) — our own uptime monitor did exactly that. Therefore:

  • /ops shows Database quota (Neon API, never wakes the database) when NEON_API_KEY + NEON_PROJECT_ID are set; orange at 80%.
  • .github/workflows/neon-quota.yml checks daily and fails (GitHub emails the owner) at 80%. Needs the same two values as GitHub repository secrets.
  • .github/workflows/db-cleanup.yml deletes, weekly after the backup: catch-up log lines > 30 days, /db-test rows, expired sign-in codes, sessions expired > 7 days, rate-limit counters > 7 days. Nothing else. Uses the backup's DATABASE_URL secret.
  • In Neon → Compute, cap autoscaling at 0.25 CU so a busy minute can't burn the quota 8× faster.

Rules

  • Read-only. The page never writes to any table.
  • No personal data on the page. Event payloads and subject ids are never shown (they can hold emails). Counts and sums only.
  • Owner only by default. OPS_ADMIN_EMAILS (plain text, comma-separated) decides who can open /ops after signing in. Without it the page says how to set it and shows nothing.
  • OPS_DASHBOARD_PUBLIC=true opens it to everyone. Only for demo sites; never suggest it for a real business.
  • Days are counted in OPS_TIMEZONE (IANA name, default UTC). Use the owner's time zone so "today" matches theirs.

Steps

1. Add the code

node <skill-dir>/scripts/apply.mjs --dir "<project>" --json

Adds src/modules/ops/metrics.ts, src/modules/ops/access.ts, src/app/ops/page.tsx (and src/app/lang/route.ts if missing), documents the variables in .env.example, records the install, commits. No migration.

Optional: link it from the homepage or the account page for admins.

2. Owner: one variable (a phone works)

Cloudflare → Workers & Pages → the worker → Settings → Variables and Secrets → Add → Text: OPS_ADMIN_EMAILS = the email they sign in with. Optional: OPS_TIMEZONE = e.g. America/Los_Angeles, Asia/Shanghai. Save (it redeploys by itself). On Vercel: Settings → Environment Variables, then redeploy.

3. Verify

  1. Signed out, /ops says "Owner only" with a Sign in button.
  2. Signed in with the admin email, /ops shows the four tiles and the health list. Another email sees "for the site owner only".
  3. Sign up with a new email (or write a test row on /db-test), reload: the user count / event feed moves, today's bar grows.
  4. Health is green when backups ran in the last 36 h and no webhook or email failed in 7 days.

Troubleshooting

What you seeFix
"Add OPS_ADMIN_EMAILS…"The variable is missing or empty on the host (runtime variable, not build)
"This page is for the site owner only"The signed-in email isn't in OPS_ADMIN_EMAILS (comma-separated, case doesn't matter)
Revenue stays at $0 after a test paymentRevenue counts only the current mode: a creem_test_ key shows test payments, a live key shows live ones
"Today" seems a day offSet OPS_TIMEZONE to the owner's time zone
Backup says "Not set up"db-backup isn't installed, or its GitHub secrets aren't set so it never ran
"Couldn't load the numbers"Worker → Logs shows [ops] load failed: with the database error

Using it in code

import { loadOps, lastDays } from "@/modules/ops/metrics"; // read-only numbers, safe to reuse (e.g. a daily email report)
import { opsAccess } from "@/modules/ops/access";          // gate any owner-only page the same way

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.