malloy-materialization

malloy-materialization is a skill for Claude Code, Codex from malloydata/publisher. It costs 61 tokens per session (3,887 once invoked), scanned A, original, MIT.

A guide to Malloy Persistence, which saves the result of an expensive data source in a warehouse table so later queries can reuse it.

In plain words
What is it for?
Use it to add persistence to Malloy sources, run or refresh materializations, and diagnose missing configuration or build steps.
Why use it?
It helps avoid recomputing slow sources and explains why a saved source may not be built or refreshed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/malloydata/publisher/malloy-materialization
Any agent
npx skills add malloydata/publisher --skill malloy-materialization
Clone the repo
git clone --depth 1 https://github.com/malloydata/publisher

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for malloy-materialization

README.md
[![agentmods](https://agentmods.dev/badge/skills/malloydata/publisher/malloy-materialization.svg)](https://agentmods.dev/skills/malloydata/publisher/malloy-materialization)
Your own site
<a href="https://agentmods.dev/skills/malloydata/publisher/malloy-materialization"><img src="https://agentmods.dev/badge/skills/malloydata/publisher/malloy-materialization.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,887 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.03887
Opus 5 $0.00030 $0.01944
Sonnet 5 $0.00012 $0.00777
Haiku 4.5 $0.00006 $0.00389

Measured yesterday against content hash 8a4d3df37f8d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

malloy-materialization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/malloy-materialization/SKILL.md · 176 lines

How it starts

The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Materialization (Malloy Persistence)

Materialize an expensive source once so queries read a pre-built warehouse table instead of recomputing it every time. You tag a source #@ persist, a materialization run builds it into a physical table, and queries against it are rewritten to read that table.

The #1 gotcha, up front: if a persist source isn't materializing, it is almost always one of two things - a .malloy file in the package missing the ##! experimental.persistence flag (which aborts the whole package's build plan), or no build ever ran (a standalone Publisher does not build on publish - see Building and refreshing). Jump to Debugging a no-op build.

The recipe (get this right and it just works)

  1. ##! experimental.persistence on EVERY .malloy file in the package - not only the file that declares the persist source. Either form enables it:

    • ##! experimental.persistence, or
    • ##! experimental { access_modifiers, sql_functions, persistence } (add persistence to the existing list).

    Why every file: the build plan is computed by asking every .malloy file in the package for its persist sources, and that call throws on any file whose model lacks the flag (Model must have ##! experimental.persistence). One unflagged helper or import file, even one with no persist source of its own, aborts the whole package's build plan, so every persist source in the package drops out. This is the most common cause of a no-op build.

  2. #@ persist name="..." on a query-based source, with the name quoted:

    #@ persist name="my_dataset.my_table"
    source: my_rollup is some_source -> { group_by: ...; aggregate: ... }
    
    • Only query_source and sql_select sources are persistable - a source whose definition has a -> { ... } pipeline or a conn.sql("..."). This includes one refined by a trailing extend { ... }. What is not persistable is a plain extend over a bare conn.table(...); a #@ persist on such a source is silently ignored (its annotation is never read) - that one source just won't materialize, and the rest of the package still builds.
    • Quote the name. name="my_table" (or a path name="dataset.table" / name="project.dataset.table") is required. A bare name=my_table always fails the build/publish with persist annotation name must be quoted (a raw-source scan that hard-stops); it never silently no-ops.
    • name= is the target table name. In a standalone Publisher this is the physical table (rebuilt in place); a hosted (control-plane) deployment builds it under a content-addressed generation name. In both, the source's identity for reuse is a content address of its connection and canonical SQL (its sourceEntityId), so republishing unchanged persist logic reuses the existing table and changing the logic builds fresh.

Read the full file on GitHub · 176 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +15 lines 8a4d3df37f8d
  2. 5d ago First seen · 161 lines · 61 tokens per session scan A ec9e170780a9

Subscribe to this mod's changes

malloy-materialization is a skill published in the GitHub repository malloydata/publisher (99 stars, last pushed today), licensed MIT. It adds 61 tokens to every session and 3,887 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

frontend-style-guide

Apply the Lightdash frontend style guide and design principles when working on React components or styling frontend code. Use when editing TSX files, building or reviewing UI, fixing styling issues, or when the user mentions Mantine, design, styling, or CSS modules.

lightdash/lightdash · 56 tokens

reusable-visualization

Build ONE reusable chart visualization component that receives its data and its settings from the host application instead of fetching them, and declares the fields and config options the host exposes to viewers. Use this whenever a single chart component is reused across many different queries rather than built for…

lightdash/lightdash · 102 tokens

debug-local

Debug the Lightdash app using PM2 logs, Maple traces, and browser automation. Use when investigating issues, tracking down bugs, understanding request flow, or correlating frontend actions with backend behavior.

lightdash/lightdash · 42 tokens

lightdash-agent-slack-messaging

Use this skill when writing, designing, or generating Slack messages for Lightdash's in-app analytics agent. Triggers when someone asks to create agent update messages, Slack digests, agent notifications, weekly summaries, daily summaries, or any Slack copy for the Lightdash project agent. Also use when asked to vary…

lightdash/lightdash · 114 tokens

upgrade-preflight

Checks whether a self-hosted Lightdash upgrade is safe to run, and reads the tooling's answer without over-reading it. Use when upgrading a self-hosted instance, planning a maintenance window, answering "is this upgrade safe", or recovering a failed, hung, parked or lock-stuck migration — covers lightdash…

lightdash/lightdash · 101 tokens

breakup-pr

Break up a large PR into vertical feature slices delivered incrementally via Graphite stacked PRs. All verticals share a single feature flag so the entire feature ships atomically. Use when: splitting a large PR, breaking up a diff, vertical slicing, incremental delivery, phased rollout, or when a PR is too large to…

lightdash/lightdash · 72 tokens