malloy-analyze
Skill116 starsChanged 2 months agoMITView on GitHub
Open-ended exploration with no specific question to answer, and building views/dashboards/notebooks on an existing model. Use when the user asks "what's interesting?", "explore this data", "find insights", "look for patterns", "build a dashboard", or "create views". Not for a specific data question - answering one is `malloy-analysis`, and writing down what the answer assumed is `malloy-model-as-you-go`. For exploration start at Step 1; for views on an existing model jump to View Patterns.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- fix-scan-findingSkill
- publisher-releaseSkill
- eval-answerSkill
- eval-diagnoseSkill
- eval-importSkill
- eval-improveSkill
- eval-judgeSkill
- eval-loopSkill
- eval-reportSkill
- malloy-analysis-pitfallsSkill
- malloy-analysis-reportSkill
- malloy-analysisSkill
- malloy-chartsSkill
- malloy-dashboardsSkill
- malloy-data-app-designSkill
- malloy-debugSkill
- malloy-defineSkill
- malloy-discoverSkill
- malloy-documentSkill
- malloy-getting-startedSkill
- malloy-gotchas-modelingSkill
- malloy-gotchas-queriesSkill
- malloy-gotchas-renderingSkill
- malloy-html-data-app-embeddingSkill
- malloy-html-data-app-runtimeSkill
- malloy-html-data-appsSkill
- malloy-lookml-reviewSkill
- malloy-materializationSkill
- malloy-materialization-tuningSkill
- malloy-model-as-you-goSkill
- malloy-modelingSkill
- malloy-modelSkill
- malloy-notebook-chatSkill
- malloy-notebooksSkill
- malloy-patternsSkill
- malloy-phrase-detectionSkill
- malloy-powerbi-reviewSkill
- malloy-publishSkill
- malloy-queriesSkill
- malloy-reviewSkill
- malloy-scopeSkill
- malloySkill
- malloy-source-unreachableSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 7 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
View/dashboard building: create views, dashboards, notebooks from an existing model
- Very specific: line 23
Call search_malloy_docs liberally: it has powerful analysis patterns (window functions, cohorts, percent-of-total, nested drill-downs).
- Distinctive: line 47
Create a working analysis file (this grows throughout the session):
- Distinctive: line 72
Time range: Check earliest/latest dates, gaps, seasonality.
- Distinctive: line 80
Skip presentation if user already has a clear question: Use profiling to refine it and jump to INVESTIGATE.
- Very specific: line 95
Search search_malloy_docs("window functions") for ranking and percentile patterns.
- Very specific: line 140
Use nest: for multi-level drill-downs in a single query:
- Very specific: line 157
Every useful query should leave an artifact in your .malloy file.
- Distinctive: line 163
Check the denominator (high rate from tiny sample?)
- Very specific: line 165
Look at raw data (select: * where: condition limit: 20)
- Distinctive: line 166
Check for data artifacts (NULLs, duplicates, encoding)
- Very specific: line 185
Document insights as view descriptions: #(doc) Top 10% of customers drive 62% of revenue.
- Distinctive: line 202
DRY rule: Do NOT define measures/dimensions inline in views.
- Very specific: line 218
No fixed scale on measures: use # currency (no scale).
- Very specific: line 219
Place chart annotation on the nested view definition, not on nest: itself
- Very specific: line 264
Use + to modify existing views: run: source -> my_view + { limit: 15, where: status = 'active' }
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!--
Copyright (c) Credible Data Inc.
SPDX-License-Identifier: MIT
-->Analysis with Malloy
This skill covers two workflows:
- EDA exploration (Steps 1-6): iteratively query data, build hypotheses, validate findings
- View/dashboard building: create views, dashboards, notebooks from an existing model
Tool names are written bare here -
get_context,execute_query,search_malloy_docs. The exact prefixed name depends on the host surface; match each against the tools you actually have.
To formalize analysis into a polished semantic model, hand off to the modeling skill's "Starting from Analysis" workflow (skill:malloy-model).
Prerequisites
- The Malloy MCP tools must be configured (
get_context,execute_query,search_malloy_docs). If they are not available, STOP and ensure your host's MCP server is connected. - Call
search_malloy_docsliberally: it has powerful analysis patterns (window functions, cohorts, percent-of-total, nested drill-downs).
EDA WORKFLOW
ORIENT → PROFILE → HYPOTHESIZE → INVESTIGATE → VALIDATE → SYNTHESIZE
(user) (user) (user)Adaptive Checkpoints
The 6-step structure is a framework, not a rigid script.
| Situation | Adaptation |
| User has a clear hypothesis ("what's driving churn?") | Skip HYPOTHESIZE, jump to INVESTIGATE on their question |
| Open-ended ("what's interesting?") | Follow all steps. PROFILE and HYPOTHESIZE are essential |
| User wants you to just go ("explore and show me") | Compress checkpoints, present findings at SYNTHESIZE |
Step 1: ORIENT: Understand the Data
- Ground yourself with
get_context. It returns the package's sources, views, and fields (with their docs), so this is where you learn what data exists. - Note the source names, the connection they sit on, and the key tables/fields they expose.
- Inspect the existing dimensions, measures, and views the model already defines, then query the data to confirm shape and values.
- Create a working analysis file (this grows throughout the session):
source: main_table is conn.table('schema.table') extend { primary_key: pk }
Output to user: Brief summary of available data. Ask: "What questions are you most interested in? Or should I look for what's interesting?"
Step 2: PROFILE: Statistical Profiling
Directed analysis (user has a question): Profile only columns relevant to their question. Open-ended (no question yet): Profile broadly, looking for surprises.
Key Profiling Queries
Column overview: run: source -> { index: * limit: 100 }
Numeric distributions:
run: source -> {
aggregate: min_val is min(col), max_val is max(col), avg_val is avg(col), null_count is count() { where: col is null }
}Categorical breakdown: run: source -> { group_by: col, aggregate: n is count(), order_by: n desc, limit: 20 }
Time range: Check earliest/latest dates, gaps, seasonality.
Duplicates: run: source -> { group_by: pk, aggregate: n is count(), having: n > 1, limit: 10 }
Add useful profiling dimensions/measures to your analysis file as you go. Build incrementally.
Step 3: HYPOTHESIZE: Form Questions
Skip presentation if user already has a clear question. Use profiling to refine it and jump to INVESTIGATE.
| Signal from profiling | Hypothesis type |
| Skewed distribution | Outlier analysis |
| Time patterns | Trend/seasonality |
| Category imbalance | Segment comparison |
| Correlated columns | Driver analysis |
| Unexpected NULLs | Data quality |
CHECKPOINT (open-ended only): Present 3-5 hypotheses ranked by potential impact. Ask which to pursue.
Step 4: INVESTIGATE: Deep-Dive
Outlier Detection
Search search_malloy_docs("window functions") for ranking and percentile patterns.
Trend Analysis
# line_chart
view: trend is { group_by: period is date_col.month, aggregate: key_metric, order_by: period }Segment Comparison
view: segment_comparison is {
group_by: segment_dim
aggregate: row_count, key_metric
nest:
# line_chart
trend is { group_by: period is date_col.month, aggregate: key_metric, order_by: period }
}Driver Analysis
run: source -> {
group_by: candidate_driver
aggregate: row_count, avg_metric is avg(metric_col),
high_rate is count() { where: metric_col > threshold } / nullif(count(), 0)
order_by: high_rate desc
}Multi-Source Comparison (Source vs Group)
Compare each source to its group average using query-as-source. Name the query directly. from(query_name) was removed from the language and no longer parses (unexpected 'from'):
query: team_stats is source -> { group_by: team, season, aggregate: team_avg is avg(points) }
query: driver_stats is source -> { group_by: driver, team, season, aggregate: driver_points is sum(points) }
source: driver_vs_team is driver_stats extend {
join_one: ts is team_stats on team = ts.team and season = ts.season
dimension: advantage is driver_points - ts.team_avg
}Nested Analysis (Malloy's Superpower)
Use nest: for multi-level drill-downs in a single query:
# dashboard { columns=2 }
view: deep_dive is {
nest: # big_value
kpis is { aggregate: # label="Total" total_metric, # label="Count" row_count }
nest: # bar_chart
by_dim is { group_by: dim, aggregate: metric, order_by: metric desc, limit: 10 }
nest: # line_chart
over_time is { group_by: period is date.month, aggregate: metric, order_by: period }
}columns=N is what gives a dashboard a layout. Bare # dashboard is flex mode, where tiles just flow and wrap and # colspan is silently ignored, so if your tiles look wrong, that is usually why. See skill:malloy-charts for the full tag set.
Build As You Go
Every useful query should leave an artifact in your .malloy file. New dimension? Add it. New measure? Add it. Interesting view? Save it. This file becomes the input for formalizing into a model if the user wants one.
Step 5: VALIDATE: Triangulate
For each finding, validate with at least ONE of:
- Cross-check with another metric (revenue spiking? do order counts also?)
- Check the denominator (high rate from tiny sample?)
- Examine time consistency (pattern or one-time event?)
- Look at raw data (
select: * where: condition limit: 20) - Check for data artifacts (NULLs, duplicates, encoding)
CHECKPOINT: Present each finding with: the insight, the evidence, confidence level, and assumptions made.
Step 6: SYNTHESIZE: Compelling Summary
Build a dashboard view that tells the story:
# dashboard { columns=2 }
view: analysis_summary is {
nest: # big_value
headlines is { aggregate: ... }
nest: # line_chart
trend is { ... }
nest: # bar_chart
breakdown is { ... }
}Document insights as view descriptions: #(doc) Top 10% of customers drive 62% of revenue.
Present to user: top 3-5 insights, supporting views, open questions, and recommended next steps (unless your host's instructions say it shows follow-up suggestions of its own, which then carry them).
Ready to formalize? Hand off to the modeling skill's "Starting from Analysis" workflow (skill:malloy-model).
VIEW PATTERNS
For building views on an existing model (base + joined source files already exist).
Starter Views (2-3 max initially)
summary: KPI cards (# big_value)by_time: Time trend (# line_chart)by_category: Category breakdown (# bar_chart)dashboard: Nested view combining the above (# dashboard)
DRY rule: Do NOT define measures/dimensions inline in views. Reference existing ones from base source files.
View Annotations
| Annotation | Use For | Notes |
# big_value | KPI summary | 2-5 metrics with # label on each |
# transpose | Summary with group_by | Swaps rows/columns |
# dashboard | Multi-visualization | Tiles nested views |
# line_chart | Time trend | ONE aggregate only |
# bar_chart | Category breakdown | ONE aggregate only |
| (none) | Detailed table | Supports multiple aggregates |
Rules:
- One tag per line, never combine annotations on one line
- One aggregate per chart view, charts render only the first
- No fixed scale on measures: use
# currency(no scale); fixed scale only in views after confirming ranges - Place chart annotation on the nested view definition, not on
nest:itself
For complete chart reference including scatter_chart, shape_map, sparklines, and all configuration options, see skill:malloy-charts or call search_malloy_docs("rendering").
Field-Level Formatting
| Tag | Use For |
# currency | Monetary values |
# percent | Rates/percentages |
# number=auto | Large counts (K/M/B) |
# number=id | Non-quantity numbers (years, IDs) |
# label="Name" | Custom display name |
# hidden | Internal/helper fields |
# duration=seconds | Time durations |
NOTEBOOKS (.malloy)
A notebook is notebooks/<slug>.malloy with ## artifact { kind=notebook title="..." }. The format to author is a one-column layout of tiles: tiles=[…] in the tag lists prose blocks (intro { kind=text }, body in a ##|(markdown) intro ... |## block) and "source -> view" queries, and skill:malloy-notebooks has the full format. The example below is the older cell form, which Publisher still reads: prose is ##(markdown) text or a ##|(markdown) ... |## block, and each run: is a query cell.
## artifact { kind=notebook title="Sales analysis" }
import "../order_analysis.malloy"
##|(markdown)
# Sales Analysis
|##
run: order_analysis -> summaryA .malloy notebook compiles as a model, so the linter and /compile report its errors before you save. An existing .malloynb is not covered: its errors show only when a cell runs. Never write a new .malloynb.
A notebook is also the home for a polished, narrated report: alternate prose (the story) with queries (the views), and let each view carry its chart tags. For the full format and report-authoring conventions, see skill:malloy-notebooks.
Interactive Filters
Notebooks do NOT define filters themselves. When you import a model, the model's runtime parameters are inherited and displayed automatically: the publisher renders the controls, parses caller parameters, and applies them server-side. You don't redeclare them in the consumer. If the analysis needs a knob the model doesn't expose, the right move is to add it to the source itself, not to wedge filtering into the consumer.
Declare that knob as a given:. #(filter) is deprecated. Never add a #(filter) annotation: every use, including required, implicit, and date/number ranges, has a given: form. See skill:malloy-model § Parameterizing sources with given:.
The notebook-level ##(filters) annotation and the dimension-level #(filter) {"type": "..."} JSON-blob form are unsupported legacy syntax, don't use them.
View Refinement
Use + to modify existing views: run: source -> my_view + { limit: 15, where: status = 'active' }
Done
Step complete. Output: analysis .malloy file with views, insights, and reusable building blocks. For chart/renderer details, see skill:malloy-gotchas-rendering or call search_malloy_docs. To formalize into a model, hand off to the modeling skill (skill:malloy-model).
Publishing is out of scope for now: open-source Publisher serves the model from disk, and self-hosters publish via git plus their host's publish path.
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
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.

