leaflet-expert

Build accessible Leaflet and React Leaflet maps with correct rendering and interactions.

Updated May 3, 2026
One-click install
npx skills add https://github.com/david-nossebro/agent-commons --skill leaflet-expert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: leaflet-expert
Source: https://github.com/david-nossebro/agent-commons/tree/main/shared/skills/leaflet-expert
Command: npx skills add https://github.com/david-nossebro/agent-commons --skill leaflet-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you research, design, implement, and debug interactive web maps using Leaflet (or React Leaflet) so they render correctly, handle data and interactions properly, and remain accessible and compliant.

Core Features & Use Cases

  • Map stack triage: quickly determine whether you’re using Leaflet or React Leaflet, where CSS is loaded, whether SSR is involved, and whether the container has a valid height.
  • Correct primitive selection: choose the right rendering approach for the dataset size and geometry (Marker vs CircleMarker vs GeoJSON, layer groups, panes, overlays, WMS/TMS).
  • Production-grade UX and safety: ensure meaningful initial bounds/viewports, keep tile attribution visible, and treat popup HTML as unsafe by default.

Quick Start

Use the leaflet-expert skill to fix your blank or broken interactive map in React Leaflet by checking CSS, container height, SSR/client-only loading, and then selecting the correct Leaflet primitives for your data size.

Frequently Asked Questions about leaflet-expert

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

FAQPage Schema
Why is my React Leaflet map rendering blank or incomplete?

Blank Leaflet maps often stem from missing CSS imports, invalid container heights, or SSR hydration issues. You must inspect your stack to verify CSS loading, ensure the map container has a defined height, and handle client-only rendering to avoid blank outputs.

How do I select the right Leaflet primitives for a large GeoJSON dataset?

For large GeoJSON layers, selecting performant Leaflet primitives like CircleMarker instead of standard Marker prevents DOM overload. Choosing the correct rendering approach based on dataset size and geometry ensures your interactive map remains responsive.

What is the best way to handle popup HTML safely in Leaflet?

Leaflet popups should treat HTML as unsafe by default to prevent XSS vulnerabilities. Implementing safe popup handling involves sanitizing content before binding it to layers, ensuring interactive popups and tooltips do not introduce security risks.

Does React Leaflet work with server-side rendering?

React Leaflet requires client-side DOM APIs and faces SSR hydration conflicts. You must implement client-only loading patterns and inspect your stack to safely integrate interactive maps within an SSR context without breaking the initial render.

How do I keep tile attribution visible and accessible in interactive web maps?

Tile attribution in Leaflet must remain visible in the UI to comply with provider licensing. Preserving map accessibility involves configuring panes and controls correctly so attribution text is readable and interactive elements meet accessibility standards.

When should I use layer groups and panes in Leaflet?

Layer groups and panes in Leaflet organize map overlays and control stacking order. Use them when managing multiple GeoJSON layers or custom overlays to maintain map performance and ensure interactive elements render in the correct visual hierarchy.