Back to Skills

mozilla-query-writing

verified

>

View on GitHub

Marketplace

akomar-mozdata-marketplace

akkomar/mozdata-claude-plugin

Plugin

mozdata

Repository

akkomar/mozdata-claude-plugin

/skills/query-writing/SKILL.md

Last Verified

January 15, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/akkomar/mozdata-claude-plugin/blob/main//skills/query-writing/SKILL.md -a claude-code --skill mozilla-query-writing

Installation paths:

Claude
.claude/skills/mozilla-query-writing/
Powered by add-skill CLI

Instructions

# Mozilla BigQuery Query Writing

You help users write efficient, cost-effective BigQuery queries for Mozilla telemetry data.

## Knowledge References

@knowledge/data-catalog.md
@knowledge/query-writing.md
@knowledge/architecture.md

## Critical Constraints

- ALWAYS check for aggregate tables before suggesting raw tables
- NEVER generate queries without partition filters (DATE(submission_timestamp) or submission_date)
- NEVER call DAU/MAU counts "users" - use "clients" or "profiles"
- NEVER suggest joining across products by client_id (separate namespaces)
- ALWAYS include sample_id filter for development/testing queries
- ALWAYS use events_stream for event queries (never raw events_v1)
- ALWAYS use baseline_clients_last_seen for MAU calculations

## Table Selection Quick Reference

**ALWAYS start from the top of this hierarchy:**

| Query Type | Best Table | Speedup |
|------------|------------|---------|
| DAU/MAU by standard dimensions | `{product}_derived.active_users_aggregates_v3` | 100x |
| DAU with custom dimensions | `{product}.baseline_clients_daily` | 100x |
| MAU/WAU/retention | `{product}.baseline_clients_last_seen` | 28x |
| Event analysis | `{product}.events_stream` | 30x |
| Mobile search | `search.mobile_search_clients_daily_v2` | 45x |
| Specific Glean metric | `{product}.metrics` | 1x (raw) |

## Required Filters

**Aggregate tables** (use DATE):
```sql
WHERE submission_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
```

**Raw ping tables** (use TIMESTAMP):
```sql
WHERE DATE(submission_timestamp) >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
```

**Development queries** (add sample_id):
```sql
AND sample_id = 0  -- 1% sample
```

## Workflow

1. **Identify query type** - What does the user want to measure?
   - User counts (DAU/MAU/WAU)?
   - Specific Glean metric?
   - Event analysis?
   - Search metrics?

2. **Select optimal table** using the hierarchy above

3. **Verify table exists** using DataHub MCP if needed:
   ```
   mcp__dataHub__searc

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
2498 chars

Issues Found:

  • name_directory_mismatch