maplibre-expressions

Write MapLibre GL JS expressions with correct match and literal-wrapped array syntax.

4|1|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/boettiger-lab/agent-skills --skill maplibre-expressions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maplibre-expressions
Source: https://github.com/boettiger-lab/agent-skills/tree/main/maplibre-expressions
Command: npx skills add https://github.com/boettiger-lab/agent-skills --skill maplibre-expressions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

MapLibre GL JS expressions trip up LLMs due to legacy syntax and subtle pitfalls in filters and paint expressions; this guide helps you write robust, correct expressions.

Core Features & Use Cases

  • Clear guidance on when to use match vs in for categorical membership and how to structure expressions for filters and paint.
  • Practical examples highlighting common traps and how to fix them, including the legacy in syntax pitfall with bare field names.
  • Quick-start workflows for implementing safe, predictable MapLibre expressions in web maps.

Quick Start

Write a MapLibre paint expression that uses match to color categories and includes a fallback color.

Frequently Asked Questions about maplibre-expressions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do my MapLibre GL JS expressions fail when filtering categorical data?

MapLibre GL JS expressions often fail due to legacy syntax pitfalls, such as using the bare in operator with unwrapped field names instead of the recommended match expression for categorical membership.

What is the best way to write MapLibre paint expressions for coloring map categories?

The best way to write MapLibre paint expressions for categories is using the match operator with a properly structured, literal-wrapped array, ensuring you include a fallback color to handle unmapped values safely.

How do I avoid common gotchas when configuring MapLibre layer filters?

To avoid MapLibre layer filter gotchas, apply recommended syntax rules like preferring match over in for categorical membership and properly wrapping arrays in literal expressions to ensure robust, predictable filtering.

Does the legacy Mapbox in syntax still work for web mapping data visualization filters?

The legacy in syntax with bare field names is a known pitfall in MapLibre GL JS that can cause unexpected failures; transitioning to match expressions is recommended for safe, predictable data visualization.

When should I use match instead of in for MapLibre GL JS categorical membership?

You should use match instead of in for MapLibre GL JS categorical membership whenever you need robust, predictable filtering or paint expressions, as in often introduces legacy syntax traps and bare field name errors.