Skip to content

Commit e279a15

Browse files
Merge pull request #47 from mapbox/add-agent-skills
[skills] Add Mapbox Agent Skills for domain expertise
2 parents f4b3dbe + eb4c210 commit e279a15

File tree

7 files changed

+3000
-1
lines changed

7 files changed

+3000
-1
lines changed

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The codebase organizes into:
2121
- `src/prompts/` - MCP prompt implementations with `BasePrompt` abstract class and registry
2222
- `src/resources/` - Static reference data (style specs, token scopes, Streets v8 fields)
2323
- `src/utils/` - HTTP pipeline, JWT parsing, tracing, and version utilities
24+
- `skills/` - Agent Skills providing domain expertise (cartography, security, style patterns)
2425

2526
## Key Architectural Patterns
2627

@@ -38,6 +39,8 @@ The codebase organizes into:
3839

3940
**Prompt Registry:** Prompts are registered in `src/prompts/promptRegistry.ts`. To add a new prompt, create the prompt class and add it to the `ALL_PROMPTS` array. The main server automatically registers all prompts with proper Zod schema conversion.
4041

42+
**Agent Skills:** Domain expertise provided through `skills/` directory. Each skill is a folder with `SKILL.md` containing YAML frontmatter and markdown instructions. Skills teach AI assistants about map design (cartography), security (token management), and implementation (style patterns). Skills are discovered by Claude Code, uploadable to Claude API, or usable in Claude.ai. See `skills/README.md` for details.
43+
4144
## Essential Workflows
4245

4346
**Development commands:**

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ https://github.com/user-attachments/assets/8b1b8ef2-9fba-4951-bc9a-beaed4f6aff6
1515
- [Hosted MCP Endpoint](#hosted-mcp-endpoint)
1616
- [Getting Your Mapbox Access Token](#getting-your-mapbox-access-token)
1717
- [Tools](#tools)
18-
- [Prompts](#prompts)
1918
- [Documentation Tools](#documentation-tools)
2019
- [Reference Tools](#reference-tools)
2120
- [Style Management Tools](#style-management-tools)
@@ -454,6 +453,40 @@ An array of four numbers representing the bounding box: `[minX, minY, maxX, maxY
454453
- "Calculate the bounding box of this GeoJSON file" (then upload a .geojson file)
455454
- "What's the bounding box for the coordinates in the uploaded parks.geojson file?"
456455

456+
## Agent Skills
457+
458+
This repository includes [Agent Skills](https://agentskills.io) that provide domain expertise for building maps with Mapbox. Skills teach AI assistants about map design, security best practices, and common implementation patterns.
459+
460+
**Available Skills:**
461+
462+
- **🎨 mapbox-cartography**: Map design principles, color theory, visual hierarchy, typography
463+
- **🔐 mapbox-token-security**: Token management, scope control, URL restrictions, rotation strategies
464+
- **📐 mapbox-style-patterns**: Common style patterns and layer configurations for typical scenarios
465+
- **🔧 mapbox-integration-patterns**: Framework-specific integration patterns for React, Vue, Svelte, Angular, and vanilla JS
466+
467+
Skills complement the MCP server by providing expertise (how to think about design) while tools provide capabilities (how to execute actions).
468+
469+
For complete documentation and usage instructions, see [skills/README.md](./skills/README.md).
470+
471+
### Using Skills with Claude Code
472+
473+
To use these skills in Claude Code, create a symlink:
474+
475+
```bash
476+
mkdir -p .claude
477+
ln -s ../skills .claude/skills
478+
```
479+
480+
Or copy to your global skills directory:
481+
482+
```bash
483+
cp -r skills/* ~/.claude/skills/
484+
```
485+
486+
### Using Skills with Claude API
487+
488+
Upload skills as zip files via the Skills API. See [Claude API Skills documentation](https://docs.anthropic.com/en/build-with-claude/skills-guide).
489+
457490
## Prompts
458491

459492
MCP Prompts are pre-built workflow templates that guide AI assistants through multi-step tasks. They orchestrate multiple tools in the correct sequence, providing best practices and error handling built-in.

skills/README.md

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# Mapbox Agent Skills
2+
3+
This directory contains [Agent Skills](https://agentskills.io) that provide domain expertise and best practices for building maps with Mapbox. These skills complement the MCP server by teaching AI assistants how to make better decisions about map design, security, and implementation patterns.
4+
5+
## What are Agent Skills?
6+
7+
Agent Skills are folders containing instructions, scripts, and resources that AI agents can discover and use to perform tasks more effectively. Unlike MCP tools (which provide actions) or prompts (which provide workflows), skills provide **domain expertise** - the "know-how" that helps agents make informed decisions.
8+
9+
Think of skills as giving Claude a specialized education in cartography, security, and Mapbox development best practices.
10+
11+
## Available Skills
12+
13+
### 🎨 mapbox-cartography
14+
15+
**Expert guidance on map design principles, color theory, visual hierarchy, typography, and cartographic best practices.**
16+
17+
Use this skill when:
18+
19+
- Designing a new map style
20+
- Choosing colors for map elements
21+
- Making decisions about visual hierarchy
22+
- Optimizing for specific use cases
23+
- Ensuring accessibility
24+
- Creating themed maps (dark mode, vintage, etc.)
25+
26+
**Key topics:**
27+
28+
- Core cartographic principles (visual hierarchy, color theory)
29+
- Typography best practices for maps
30+
- Map context considerations (audience, platform, use case)
31+
- Zoom level strategies
32+
- Color palette templates
33+
- Common mapping scenarios (restaurant finders, real estate, etc.)
34+
35+
[View skill →](./mapbox-cartography/SKILL.md)
36+
37+
### 🔐 mapbox-token-security
38+
39+
**Security best practices for Mapbox access tokens, including scope management, URL restrictions, and rotation strategies.**
40+
41+
Use this skill when:
42+
43+
- Creating new tokens
44+
- Deciding between public vs secret tokens
45+
- Setting up token restrictions
46+
- Implementing token rotation
47+
- Investigating security incidents
48+
- Conducting security audits
49+
50+
**Key topics:**
51+
52+
- Token types and when to use them (public, secret, temporary)
53+
- Scope management (principle of least privilege)
54+
- URL restrictions and patterns
55+
- Token storage and handling
56+
- Rotation strategies
57+
- Monitoring and auditing
58+
- Incident response plans
59+
60+
[View skill →](./mapbox-token-security/SKILL.md)
61+
62+
### 📐 mapbox-style-patterns
63+
64+
**Common style patterns, layer configurations, and recipes for typical mapping scenarios.**
65+
66+
Use this skill when:
67+
68+
- Starting a new map style for a specific use case
69+
- Looking for layer configuration examples
70+
- Implementing common mapping patterns
71+
- Optimizing existing styles
72+
- Need proven recipes for typical scenarios
73+
74+
**Key topics:**
75+
76+
- Restaurant/POI finder pattern
77+
- Real estate map pattern
78+
- Data visualization base map pattern
79+
- Navigation/routing map pattern
80+
- Dark mode / night theme pattern
81+
- Layer optimization patterns
82+
- Common modifications (3D buildings, terrain, custom markers)
83+
84+
[View skill →](./mapbox-style-patterns/SKILL.md)
85+
86+
### 🔧 mapbox-integration-patterns
87+
88+
**Official integration patterns for Mapbox GL JS across popular web frameworks including React, Vue, Svelte, Angular, and vanilla JavaScript.**
89+
90+
Use this skill when:
91+
92+
- Setting up Mapbox GL JS in a new project
93+
- Integrating Mapbox into a specific framework
94+
- Adding Mapbox Search functionality
95+
- Implementing proper cleanup and lifecycle management
96+
- Debugging map initialization issues
97+
- Converting between frameworks
98+
- Reviewing code for integration best practices
99+
100+
**Key topics:**
101+
102+
- Framework-specific patterns (React, Vue, Svelte, Angular, Next.js)
103+
- Token management (environment variables across frameworks)
104+
- Lifecycle management and cleanup (preventing memory leaks)
105+
- Mapbox Search JS integration
106+
- Common mistakes and how to avoid them
107+
- SSR handling (Angular Universal, Next.js)
108+
- Testing patterns for maps
109+
110+
**Based on:** Mapbox's official `create-web-app` scaffolding tool
111+
112+
[View skill →](./mapbox-integration-patterns/SKILL.md)
113+
114+
## How Skills Work with the MCP Server
115+
116+
The Mapbox MCP DevKit Server and Agent Skills work together:
117+
118+
| Component | Purpose | Example |
119+
| ---------------- | --------------------- | ---------------------------------------------- |
120+
| **MCP Tools** | Execute actions | `create_style_tool`, `list_tokens_tool` |
121+
| **MCP Prompts** | Orchestrate workflows | `create-and-preview-style` workflow |
122+
| **Agent Skills** | Provide expertise | Map design principles, security best practices |
123+
124+
**Example workflow:**
125+
126+
```
127+
User: "Create a map for my restaurant finder app"
128+
129+
Without Skills:
130+
Claude → Uses create_style_tool with basic styling
131+
132+
With Skills:
133+
Claude →
134+
1. [mapbox-cartography skill] Understands restaurant maps need:
135+
- High contrast for restaurant markers
136+
- Muted background (food photos will overlay)
137+
- Clear street labels for navigation
138+
- Mobile-optimized design
139+
140+
2. [mapbox-token-security skill] Knows to create public token with:
141+
- Only styles:read scope (principle of least privilege)
142+
- URL restrictions to app domain
143+
144+
3. [mapbox-style-patterns skill] Applies POI Finder pattern:
145+
- Desaturated base map
146+
- Orange markers (#FF6B35) for visibility
147+
- White roads on light gray background
148+
149+
4. → Uses style_builder_tool with informed design decisions
150+
5. → Uses create_style_tool with optimized configuration
151+
6. → Uses create_token_tool with secure settings
152+
7. → Uses preview_style_tool to generate shareable link
153+
```
154+
155+
## Using Skills
156+
157+
### With Claude Code
158+
159+
Skills in this directory are automatically discovered by Claude Code when placed in:
160+
161+
- Project-level: `.claude/skills/` (recommended for this repository)
162+
- Global: `~/.claude/skills/` (available across all projects)
163+
164+
To use these skills in Claude Code:
165+
166+
```bash
167+
# Option 1: Symlink from project root (recommended)
168+
mkdir -p .claude
169+
ln -s ../skills .claude/skills
170+
171+
# Option 2: Copy to global skills directory
172+
cp -r skills/* ~/.claude/skills/
173+
```
174+
175+
For more information, see [Claude Code Skills documentation](https://code.claude.com/docs/en/skills).
176+
177+
### With Claude API
178+
179+
Upload skills via the Skills API:
180+
181+
```bash
182+
# Create a zip of the skill directory
183+
cd skills/mapbox-cartography
184+
zip -r mapbox-cartography.zip .
185+
186+
# Upload via API
187+
curl https://api.anthropic.com/v1/skills \
188+
-H "anthropic-version: 2025-08-25" \
189+
-H "x-api-key: $ANTHROPIC_API_KEY" \
190+
-H "anthropic-beta: skills-2025-10-02" \
191+
192+
```
193+
194+
For more information, see [Claude API Skills guide](https://docs.anthropic.com/en/build-with-claude/skills-guide).
195+
196+
### With Claude.ai
197+
198+
1. Go to Settings → Features
199+
2. Upload skill as a zip file
200+
3. Claude will automatically use the skill when relevant
201+
202+
For more information, see [Using Skills in Claude](https://support.claude.com/en/articles/12512180-using-skills-in-claude).
203+
204+
## Skill Structure
205+
206+
Each skill follows the Agent Skills specification:
207+
208+
```
209+
skill-name/
210+
├── SKILL.md # Main skill file (required)
211+
│ ├── YAML frontmatter # name, description
212+
│ └── Markdown content # Instructions and guidance
213+
└── [optional files] # Additional resources
214+
```
215+
216+
**SKILL.md format:**
217+
218+
```yaml
219+
---
220+
name: skill-name
221+
description: What the skill does and when to use it
222+
---
223+
# Skill Name
224+
225+
[Instructions and guidance for Claude to follow]
226+
```
227+
228+
## Creating Custom Skills
229+
230+
To create your own Mapbox-related skill:
231+
232+
1. **Create a new directory** in `skills/`
233+
2. **Create SKILL.md** with YAML frontmatter and instructions
234+
3. **Add reference materials** (optional)
235+
4. **Test with Claude Code** or upload to API
236+
5. **Share with team** via git or Skills API
237+
238+
**Guidelines:**
239+
240+
- Keep instructions clear and actionable
241+
- Provide concrete examples
242+
- Include decision trees when applicable
243+
- Reference official Mapbox documentation
244+
- Test with real scenarios
245+
246+
For more best practices, see [Agent Skills authoring guide](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices).
247+
248+
## License
249+
250+
These skills are provided under the same license as the Mapbox MCP DevKit Server (MIT License).
251+
252+
## Resources
253+
254+
- [Agent Skills Overview](https://agentskills.io)
255+
- [Agent Skills Specification](https://github.com/anthropics/skills)
256+
- [Claude Skills Documentation](https://docs.anthropic.com/en/agents-and-tools/agent-skills/overview)
257+
- [Mapbox Documentation](https://docs.mapbox.com)
258+
- [Mapbox Style Specification](https://docs.mapbox.com/style-spec/)
259+
260+
## Contributing
261+
262+
We welcome contributions of new skills or improvements to existing ones! Please:
263+
264+
1. Follow the existing skill structure
265+
2. Test your skill thoroughly
266+
3. Include clear examples
267+
4. Submit a pull request with description
268+
269+
For questions or suggestions, please open an issue.

0 commit comments

Comments
 (0)