leaflet

leaflet is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 46 tokens per session (3,591 once invoked), scanned A, original, MIT.

A small open-source JavaScript library for adding interactive two-dimensional maps to web pages. It supports map tiles, markers, shapes, GeoJSON data, popups, and layer switching.

In plain words
What is it for?
Use it to add location maps, marker lists, routes, geographic shapes, clickable popups, and selectable map layers to a website.
Why use it?
It removes the need to implement common map controls and interactions yourself. It works with plain JavaScript as well as React, Vue, and Svelte applications.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add location maps, marker lists, routes, geographic shapes, clickable popups, and selectable map layers to a website.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/leaflet
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.

Any agent
npx skills add znlgis/opengis-skills --skill leaflet
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-skills

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 leaflet

README.md
[![agentmods](https://agentmods.dev/badge/skills/znlgis/opengis-skills/leaflet/github.svg)](https://agentmods.dev/skills/znlgis/opengis-skills/leaflet)
Your own site
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/leaflet"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/leaflet/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for leaflet

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/leaflet"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/leaflet.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,591 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00046 $0.03591
Opus 5.5 $0.00018 $0.01436
Sonnet 5.5 $0.00009 $0.00718
Haiku 4.5 $0.00005 $0.00359

Measured 4d ago against content hash 44238568e068, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

leaflet 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 4d ago.

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.

gis/leaflet/SKILL.md · 351 lines

How it starts

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

项目地址: https://github.com/Leaflet/Leaflet

官方文档: https://leafletjs.com/

API 参考: https://leafletjs.com/reference.html

示例: https://leafletjs.com/examples.html

最新版本: 1.9.4(截至2026-10,npm leaflet)

许可证: BSD-2-Clause

概述

Leaflet 是面向移动端与桌面端的开源 2D 地图库,核心构建体积约 42 KB,提供命令式的类 jQuery API。特性:

  • 瓦片图层:支持 OSM、XYZ、WMS、WMTS、ArcGIS 等栅格底图
  • 矢量叠加:Marker、Popup、Tooltip、Circle、Polygon、Polyline、GeoJSON
  • 图层管理:LayerGroup、FeatureGroup、L.control.layers 切换底图与叠加层
  • 事件系统:Map / Layer / Marker 均继承 Evented,统一 on / off / once
  • 插件生态:绘制、聚合、热力图、矢量瓦片等均有成熟第三方插件
  • 框架无关:可在原生 JS、Vue、React、Svelte 中直接使用

环境准备

方式一:CDN

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
        integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
  <script src="https://unpkg.com/[email protected]/dist/leaflet.js"
          integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
  <style>
    /* 容器必须显式设置高度,否则地图不可见 */
    #map { height: 400px; }
  </style>
</head>
<body>
  <div id="map"></div>
</body>
</html>

方式二:npm

npm install leaflet
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';

验证

打开页面应看到可拖拽、可缩放的 OSM 底图;控制台执行 L.version 返回 "1.9.4"。

console.log(L.version); // "1.9.4"

核心 API

L.map

const map = L.map('map', {
  center: [39.9087, 116.3975], // [纬度, 经度]
  zoom: 12,
  zoomControl: true,
  attributionControl: true
});
选项 类型 默认值 说明
center LatLng 无 初始中心点 [lat, lng]
zoom Number 无 初始缩放级别
zoomControl Boolean true 是否添加缩放控件
attributionControl Boolean true 是否添加版权控件
minZoom / maxZoom Number 无 缩放范围限制

Read the full file on GitHub · 351 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. 4d ago First seen · 351 lines · 46 tokens per session scan A 44238568e068

Subscribe to this mod's changes

leaflet is a skill published in the GitHub repository znlgis/opengis-skills (68 stars, last pushed yesterday), licensed MIT. It adds 46 tokens to every session and 3,591 once invoked, about $0.0002 per session on Opus 5.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-10-16.