References
CI IntegrationAlso bundled
AGENTS19 chapters · 62 min
Skills
Chapter 16 of 19
Expert guidance on validating, optimizing, and ensuring quality of Mapbox styles through validation, accessibility checks, and optimization.
4 minutes · 792 words · 23 sections
This skill provides expert guidance on ensuring Mapbox style quality through validation, accessibility, and optimization tools.
Before deploying any Mapbox style to production:
["all", expr] → expr, ["any", false, expr] → expr)When adding GeoJSON data:
validate_geojson_tool before using as a sourceWhen writing expressions:
validate_expression_tool as you write themWhen styling text/labels:
check_color_contrast_toolCompare style versions:
compare_styles_tool to generate a diff reportOptimize the style:
optimize_style_tool to reduce file size["all", expr] to expr, remove tautological conditions)Always validate when:
Common GeoJSON errors:
Example workflow:
1. Receive GeoJSON data
2. Validate with validate_geojson_tool
3. If valid: Add as source to style
4. If invalid: Fix errors, re-validateValidate expressions for:
filter property on layers)paint and layout properties)Common expression errors:
Prevention strategies:
WCAG Levels:
Text size categories:
Common scenarios to check:
Testing strategy:
1. Validate expressions in style
2. Check color contrast for text layers
3. Optimize if needed1. Validate all GeoJSON sources
2. Validate all expressions (filters, paint, layout)
3. Check color contrast for all text layers
4. Compare with previous production version
5. Optimize style
6. Test optimized style
7. Deploy1. Compare working vs. broken style
2. Identify differences
3. Validate suspicious expressions
4. Check GeoJSON data if source-related
5. Verify color contrast if visibility issueProblem: Map throws expression errors at runtime
Solution: Validate expressions with validate_expression_tool during development
Prevention: Add expression validation to pre-commit hooks or CI/CD
Problem: Text labels are hard to read on map
Solution: Check contrast with check_color_contrast_tool, adjust colors to meet WCAG AA
Prevention: Test text on both light and dark backgrounds, check at different zoom levels
Problem: Style takes long to load or transfer
Solution: Run optimize_style_tool to remove redundancies and simplify
Prevention: Regularly optimize during development, remove unused sources immediately
Problem: GeoJSON source fails to load or render
Solution: Validate with validate_geojson_tool, fix coordinate issues, verify structure
Prevention: Validate all external GeoJSON before adding to style
Problem: Style changed but unsure what modified
Solution: Use compare_styles_tool to generate diff report
Prevention: Compare before/after for all significant changes, document modifications
| Tool | Use When | Output |
|---|---|---|
validate_geojson_tool | Adding GeoJSON sources | Valid/invalid + error list |
validate_expression_tool | Writing expressions | Valid/invalid + error list |
check_color_contrast_tool | Styling text labels | Passes/fails + WCAG levels |
compare_styles_tool | Reviewing changes | Diff report with paths |
optimize_style_tool | Before deployment | Optimized style + savings |
For detailed guidance on specific topics, load the relevant reference:
references/optimization.md — Optimization types, strategies, recommended order, and maintenance best practicesreferences/comparison.md — Style comparison workflows, ignoreMetadata usage, and refactoring workflowreferences/ci-integration.md — Git pre-commit hooks, CI/CD pipeline steps, and code review checklistLoad instruction: Read the reference file when the user needs in-depth guidance on that topic.
Install this repository
npx skills add mapbox/mapbox-agent-skills/plugin marketplace add mapbox/mapbox-agent-skillsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Expert guidance on validating, optimizing, and ensuring quality of Mapbox styles through validation, accessibility checks, and optimization. Use when preparing styles for production, debugging issues, or ensuring map quality standards.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 7 August 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Mapbox Plugin Marketplace, declaring 1 plugin. It is read for editorial metadata only — never as the skill index, which is always the repository tree./mapbox/mapbox-agent-skills.md.md5 files · 14 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of chapter 16.
Documentation the agent loads on demand, rather than up front.
Everything else published alongside the skill.