malloy-gotchas-rendering
Skill116 starsChanged 2 months agoMITView on GitHub
Common Malloy renderer mistakes, for adding chart annotations and formatting tags or building dashboards - tag syntax, scale rules, sparkline setup, big_value 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-analyzeSkill
- 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-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
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Use # currency (no scale) on measure definitions.
- Very specific: line 43
Add scale (e.g., # currency=usd0m) only in views after confirming value ranges with queries.
- Very specific: line 81
If the sparkline doesn't show: check that # hidden is on the nested view AND the view name matches .sparkline=.
- Very specific: line 97
Use down_is_good=true for metrics where decrease is positive (churn, defects).
- Very specific: line 127
defaultModeandallowUserToggleare instance-only: No per-chart annotation controls the light/dark default or the toggle lock. - Very specific: line 128
Environment-level theming is not applied yet: Only the instance theme and the # theme.* / ## theme.* per-chart annotations take effect …
≈ “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
-->Rendering Gotchas
Read this before adding renderer annotations. These patterns cause most rendering issues.
One Tag Per Line
Each # annotation must be on its own line directly above the field. Never combine tags on one line.
// WRONG, will not work
# label="Revenue" # currency
revenue
// RIGHT
# label="Revenue"
# currency
revenueNo Fixed Scale on Measures
Use # currency (no scale) on measure definitions. The same measure renders at many granularities: usd0m turns $500 into $0.0M.
// WRONG on a measure definition
# currency=usd0m
measure: revenue is sum(total)
// RIGHT, no scale on measure
# currency
measure: revenue is sum(total)Add scale (e.g., # currency=usd0m) only in views after confirming value ranges with queries.
# big_value Needs # label on Each Measure
# big_value
view: summary is {
aggregate:
# label="Revenue"
# currency
revenue
# label="Orders"
# number=auto
order_count
}Without # label, big_value cards show raw field names which are often unclear.
Sparkline Setup
Sparklines in # big_value require TWO things: a # hidden nested view AND a .sparkline= reference.
# big_value { sparkline=trend }
view: revenue_kpi is {
aggregate:
# label="Revenue"
# currency
revenue
nest:
# line_chart { size=spark }
# hidden
trend is { group_by: order_date, aggregate: revenue, order_by: order_date }
}If the sparkline doesn't show: check that # hidden is on the nested view AND the view name matches .sparkline=.
Comparison Deltas
# big_value { comparison_field=prior_month comparison_label="vs Last Month" }
view: rev_delta is {
aggregate:
# label="Revenue"
# currency
revenue
# hidden
prior_month
}Use down_is_good=true for metrics where decrease is positive (churn, defects).
# dashboard Layout
In a # dashboard view, fields render by role: group_by -> a repeating row header, aggregate measures -> KPI cards, each nest: -> a tile. Put each tile tag on its own line above the nested view. A lone renderer tag also works on the nest: line, but a tile usually carries several tags (# break, # colspan, # subtitle, then # bar_chart), and only the own-line form keeps each tag on its own line.
// RIGHT: tag above the nested view; the measure auto-renders as a card
# dashboard
view: overview is {
group_by: category
# currency
aggregate: avg_retail is retail_price.avg()
nest:
# bar_chart
by_brand is { group_by: brand, aggregate: avg_retail is retail_price.avg(), limit: 10 }
}# colspanonly works in columns mode. Set# dashboard { columns=N }first; in flex mode# colspanis ignored.# break(new row) works in both modes.gapis spacing, not a mode.columns=Nenters columns mode;# dashboard { gap=24 }only changes tile spacing.# dashboardneeds a row-producing view (no effect on a scalar). A flat view of top-levelaggregate:measures still renders KPI cards; addnest:for chart and table tiles.- Use
# colspan, not the old# span. Tile styling comes from the instance theme.
Theming
- Per-chart theme keys are nested, not flat. In Publisher,
# theme.palette.tableHeader.dark = "#94a3b8"works; a flat# theme.tableHeaderColor = "#94a3b8"is silently dropped. Publisher's annotation reader only understands the structuredpalette.*/font.*form (the same vocabulary as the config), not the renderer's flatMalloyExplicitThemekey names. - A per-chart annotation OVERRIDES the instance theme. Precedence, highest to lowest, per key:
# theme.*(view), then## theme.*(model), then the instance theme (config / Settings, then Theme editor), then built-in defaults. A# theme.*view tag beats a## theme.*model default, and both beat the instance theme for the keys they set. This is the opposite of a bare@malloydata/renderembed, where the embedder wins. - Only seven palette keys take light/dark.
background,tableHeader,tableHeaderBackground,tableBody,tile,tileTitle, andmapColoreach accept a.lightand/or.darkvariant.palette.series,font.family, andfont.sizeare single values shared across modes; a.light/.darkon them does nothing. # theme.palette.mapColor.{light,dark}recolors choropleths only. It sets the saturated end of the# shape_map/# segment_mapgradient (per mode). Rect-mark heatmaps keep their built-in scheme.defaultModeandallowUserToggleare instance-only. No per-chart annotation controls the light/dark default or the toggle lock; set them in the configthemeblock or the editor.- Environment-level theming is not applied yet. Only the instance theme and the
# theme.*/## theme.*per-chart annotations take effect today.
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.

