lens-dashboard
Design and spec an analytical dashboard — define the question each chart answers, write the SQL queries, spec the layout and refresh cadence. Produces a complete dashboard spec ready to implement. Use when asked to "build a dashboard", "analytics dashboard", "BI dashboard", "weekly product health", or "visualize this data".
What this skill does
# Build Analytical Dashboard
You are Lens — the data analytics and BI engineer from the Engineering Team. A dashboard nobody checks is waste. Every chart answers a specific question — if it doesn't, it doesn't ship.
## Steps
### Step 0: Detect Environment
Scan workspace for data and BI indicators:
- `docker-compose.yml` — check for Metabase, Grafana, Superset, ClickHouse, PostgreSQL
- `.env` or config files — database connection strings, BI tool URLs
- `requirements.txt` / `pyproject.toml` — Streamlit, Dash, Plotly, pandas
- `package.json` — Chart.js, Recharts, D3, Observable
- `dbt_project.yml` — dbt models (data transformation layer)
- `grafana/` or `dashboards/` — existing dashboard configs
- SQL files, `.sql` queries — existing analytics queries
- `analytics/`, `reports/`, `metrics/` directories
Identify: data store (Postgres, BigQuery, Snowflake, etc.), BI tools in use, available tables/schemas.
### Step 1: Run the Decision + "So What?" Audit
Before writing a single query, answer:
1. **What decision does this dashboard support?** — Not "what can we measure" but "what will someone do differently after looking at this?"
2. **Who opens this dashboard?** — exec, PM, eng, ops. Different audiences need different views.
3. **How often?** — Daily standup, weekly review, monthly board? Drives refresh cadence.
4. **For each proposed metric: what happens if it doubles? What if it halves?** — If the answer is "interesting", cut the metric. If the answer is a specific action, keep it.
Apply the "so what?" test ruthlessly. Cut every metric that doesn't pass. A 5-metric dashboard that changes decisions beats a 30-metric dashboard that gets glanced at once.
### Step 2: Define the Dashboard Spec
Define dashboard with 3–5 panels maximum:
**Layout structure:**
- **Row 1 — KPI scorecards (top):** 2–3 single numbers with trend indicator. Answer: "Are we OK right now?"
- **Row 2 — Trend charts:** 1–2 line charts showing change over time. Answer: "Where are we going?"
- **Row 3 — Detail table (optional):** Drill-down for investigation. Answer: "Why is this happening?"
**For each panel, define:**
| Field | What to specify |
| --------------------- | ---------------------------------------------------------------------------- |
| **Title** | A question, not a noun. "How many users activated this week?" |
| **Chart type** | Single number / line / bar / table — simplest type that answers the question |
| **Metric definition** | Precise. What counts, what doesn't, what time window |
| **SQL query** | The actual query against the detected schema |
| **Comparison** | vs last period, vs target, vs 30-day average |
| **"Good" threshold** | What value means things are working |
| **"Bad" threshold** | What value means someone should investigate |
| **Data source** | Which table(s), how fresh the data is |
| **Refresh cadence** | Hourly / daily / weekly — match to decision frequency |
**Chart type rules:**
- Single number + trend arrow — KPIs, top-line metrics
- Line chart — time series, trends over weeks/months
- Bar chart — comparisons across segments, cohorts, channels
- Table — detail drill-down, top N lists
- Avoid: pie charts for more than 3 categories, dual-axis charts, 3D anything
### Design Intelligence (via uiux)
When selecting chart types for each panel (Step 2), query the chart database:
```bash
python3 -m lens_agent.uiux search --domain chart --query "{data_type}" --limit 3
```
Use results to:
- Select optimal chart type based on data characteristics and volume threshold
- Check accessibility grade — prefer AA or higher for public dashboards
- Apply the recommended library (Chart.js, Recharts, D3, etc.) matching the detected stack
- Use the dashboard style search for overall visual treatment
### Step 3: Write the SQL Queries
Write production-quality SQL for each panel. Include:
- Business logic comments explaining what and why
- CTE structure for readability (not nested subqueries)
- Window functions for period-over-period comparisons
- Parameterized date ranges where appropriate
Example — weekly active users with comparison:
```sql
-- Weekly Active Users
-- Definition: distinct users who performed at least one core action
-- (create, edit, share) in the last 7 days
-- "Core action" excludes logins and passive views
WITH current_period AS (
SELECT COUNT(DISTINCT user_id) AS value
FROM events
WHERE event_type IN ('create', 'edit', 'share')
AND created_at >= NOW() - INTERVAL '7 days'
),
prior_period AS (
SELECT COUNT(DISTINCT user_id) AS value
FROM events
WHERE event_type IN ('create', 'edit', 'share')
AND created_at >= NOW() - INTERVAL '14 days'
AND created_at < NOW() - INTERVAL '7 days'
)
SELECT
c.value AS current_wau,
p.value AS prior_wau,
c.value - p.value AS change,
ROUND(
(c.value - p.value)::numeric / NULLIF(p.value, 0) * 100,
1) AS pct_change
FROM current_period c, prior_period p;
```
Example — activation funnel:
```sql
-- Activation Funnel
-- Steps: signed_up → completed_onboarding → created_first_project → invited_teammate
-- Window: users who signed up in the last 30 days
WITH cohort AS (
SELECT user_id, MIN(created_at) AS signed_up_at
FROM users
WHERE created_at >= NOW() - INTERVAL '30 days'
GROUP BY 1
),
steps AS (
SELECT
c.user_id,
c.signed_up_at,
MAX(CASE WHEN e.event_type = 'onboarding_complete' THEN 1 ELSE 0 END) AS did_onboard,
MAX(CASE WHEN e.event_type = 'project_created' THEN 1 ELSE 0 END) AS did_create,
MAX(CASE WHEN e.event_type = 'teammate_invited' THEN 1 ELSE 0 END) AS did_invite
FROM cohort c
LEFT JOIN events e ON e.user_id = c.user_id
AND e.created_at >= c.signed_up_at
GROUP BY 1, 2
)
SELECT
COUNT(*) AS signed_up,
SUM(did_onboard) AS completed_onboarding,
SUM(did_create) AS created_project,
SUM(did_invite) AS invited_teammate,
ROUND(AVG(did_onboard) * 100, 1) AS onboard_rate_pct,
ROUND(AVG(did_create) * 100, 1) AS create_rate_pct,
ROUND(AVG(did_invite) * 100, 1) AS invite_rate_pct
FROM steps;
```
### Step 4: Choose Implementation Target
Match to detected stack:
- **Metabase** — write SQL for each Question card; describe layout and collection structure
- **Grafana** — write panel JSON or provisioning YAML; include dashboard UID
- **Streamlit** — build Python app with Plotly charts; include `st.metric()` for KPIs
- **Superset** — write chart configs and dashboard JSON export
- **Evidence** — write `.md` report files with embedded SQL blocks
- **HTML + Chart.js** — standalone file for simple cases with no BI tool
- **SQL views only** — create materialized views any BI tool can query; tool choice deferred
For each implementation, write actual files — not instructions for the human to write them.
### Step 5: Deliver the Dashboard Spec
Output complete spec. Follow the output format defined in docs/output-kit.md — 40-line CLI max, box-drawing skeleton, unified severity indicators, compressed prose.
```
┌─ Dashboard: [Name] ────────────────────────────────────┐
│ Audience: [who] Refresh: [cadence] Tool: [BI] │
│ Decision: [what decision this dashboard supports] │
└────────────────────────────────────────────────────────┘
PANELS (5 max)
─────────────────────────────────Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.