skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
fixmyberlin/fixmyskills84 installs

react-map-gl

react-map-gl/maplibre patterns for FMC geo apps: declarative Source/Layer (never addSource/addLayer), MapProvider + useMap(), interactiveLayerIds, flat Source/Layer, map-loaded guard, window.__mainMap debug exposure, Map event handlers (not useEffect), URL map state, initialViewState, cursor, feature state, missing images. Use when building or reviewing Map components, layers, click/hover handlers, setFeatureState, map URL sync, or agent/test map inspection in TanStack Start / Vite apps. Reference implementation: tilda-geo/app.

How do I install this agent skill?

npx skills add https://github.com/fixmyberlin/fixmyskills --skill react-map-gl
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides coding conventions and best practices for integrating MapLibre and react-map-gl in FixMyBerlin projects. It emphasizes declarative state management, performance optimization, and secure handling of map assets. No security risks or malicious patterns were identified.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

react-map-gl (MapLibre)

Conventions for react-map-gl/maplibre in FixMyBerlin / FMC projects. Import from react-map-gl/maplibre (not react-map-gl alone). Always import maplibre-gl/dist/maplibre-gl.css.

import 'maplibre-gl/dist/maplibre-gl.css'
import { MapProvider, Map, Source, Layer, useMap } from 'react-map-gl/maplibre'

Rules

TopicRule
Sources / layers<Source> + <Layer> in JSX only. Never map.addSource / map.addLayer (or remove*) for app data. Show/hide via layout.visibility or conditional render.
Layer structureFlat siblings: one <Source> per source id, then <Layer> siblings (not nested).
Map eventsCamera, pointer, load, tile lifecycle go on <Map> callback props. Not useEffect + map.on(…). useEffect only for React → map sync after load, or events without a Map prop (styleimagemissing).
Map accessWrap app map UI in <MapProvider>. useMap() keyed by <Map id="…">. Never pass ref to <Map> for child access.
Map readyGuard getStyle, queryRenderedFeatures, setFeatureState with useMapLoaded() (set in onLoad).
Debug exposureIn onLoad, call exposeMainMapForDebugging(event.target) (dev + Playwright only). Agents/tests read window.__mainMap.
ClicksLayer ids in interactiveLayerIds; read event.features. No queryRenderedFeatures for primary click picking unless syncing URL features.
Feature highlightInspector/form truth in React; map tint via setFeatureState (paint) or React filter layer. Clear old state before applying new.
AttributionattributionControl={false} on <Map>, <AttributionControl compact> as child. RTLTextPlugin={false} on every <Map>.
Viewport URLzoom/lat/lng with zoom-aware rounding; write on onMoveEnd with history: 'replace'.
View stateUncontrolled initialViewState seeded from URL; no mirrored viewState in React unless programmatic camera is needed.

Which file to read

Read only the file for your task.

TaskRead
Add or review <Source> / <Layer>, remove addSourcedeclarative-source-layer.md, flat-source-layer.md
Show/hide layerslayer-visibility-vs-unmount.md
Click/hover handler, choose a <Map> callbackmap-event-handlers.md, interactive-layer-ids.md
Cursor over featurescursor-handling.md
Child/sibling needs the map instancemap-provider-wrapper.md
getStyle / queryRenderedFeatures before loadmap-loaded-hook.md
Agent/E2E map inspectionmap-debug-exposure.md
Selected/hovered feature highlight, setFeatureStatefeature-state.md
Initial camera, fitBounds, boundsinitial-view-state.md
?map= URL syncmap-url-state.md
Attribution, locale, RTL text pluginmap-props-attribution-locale.md
Missing or dynamic icons, styleimagemissing, addImagemap-images.md

All files are in references/. Pair with skills tanstack-router-conventions (?map= contract), zustand-state-management (useMapLoaded store), playwright-skill (E2E map helpers).

Review checklist

  • No addSource / addLayer / removeSource / removeLayer / setLayoutProperty for app data; flat <Source> + <Layer>
  • <MapProvider> parent, useMap(), no ref on <Map>
  • No useEffect + map.on for move/click/hover; viewport sync on onMoveEnd / onMove
  • Effects touching the map are React → map sync guarded by mainMap + mapLoaded
  • onLoad sets map-ready flag and calls exposeMainMapForDebugging
  • Every pickable layer id is in interactiveLayerIds; handlers use event.features
  • Old feature state cleared before new applied; features have ids (promoteId for vector)
  • attributionControl={false} + child <AttributionControl>; RTLTextPlugin={false}
  • URL: shared parseMapParam / serializeMapParam, replace on pan/zoom, no encodeURIComponent around the serialized value
  • Fixed icons via useMapImages; dynamic icons via styleimagemissing in useEffect with off() cleanup and hasImage guard

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/fixmyberlin/fixmyskills/react-map-gl">View react-map-gl on skillZs</a>