-
Notifications
You must be signed in to change notification settings - Fork 0
Add mapbox-navigation-patterns skill #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Comprehensive navigation and routing skill covering: - Directions API for web routing - Navigation SDK for iOS with turn-by-turn - Navigation SDK for Android with turn-by-turn - Multi-stop routing and optimization - Traffic-aware routing with congestion data - Voice guidance configuration - Route caching and error handling patterns Includes SKILL.md (comprehensive guide) and AGENTS.md (quick reference). Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add terms for navigation, store locator, data visualization, and web components: - dropin: Android Navigation SDK NavigationView - millis: currentTimeMillis suffix - Haversine: distance calculation formula - Jenks: statistical classification method - colorbrewer: ColorBrewer color scales tool - htmlelement: Web Components HTMLElement - customelements: Web Components API - currenttime: time-related functions
Resolved conflicts by including both skills: - mapbox-navigation-patterns (this PR): Navigation and routing patterns - mapbox-store-locator-patterns (from main): Store locator patterns Updated skill count to 12 to reflect both skills. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
Merged main into this branch to resolve conflicts. Resolution:
The two skills have different focuses:
PR is now ready for review with all conflicts resolved. |
Resolved conflict in README.md by including 'navigation' in the topic list. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
Code Review: add-navigation-patterns-skill Summary This PR adds a new mapbox-navigation-patterns skill covering Directions API, Optimization API, and Navigation SDKs for iOS/Android. The web Critical Issues
File: README.md:1 The README says "12 comprehensive Agent Skills" but there are actually 13 skill directories with SKILL.md files. This was likely correct before
Files: SKILL.md:447-666, AGENTS.md:101-171 All iOS Swift code examples use the Navigation SDK v2 API. The current GA release is v3 (v3.18.1) with major breaking changes: The voice guidance section (SKILL.md:641-666) appears fabricated -- navigationService.voiceController with .volume = .normal / .muted / Note: v2 (latest v2.20.3) is still maintained, so the code would work for v2 users. But new projects should target v3, and a patterns skill should Sources: https://docs.mapbox.com/ios/navigation/guides/migration/, https://github.com/mapbox/mapbox-navigation-ios/releases
Files: SKILL.md:668-827, AGENTS.md:173-222 The custom navigation example (SKILL.md:706-827) is mostly correct for both v2 and v3: NavigationRouterCallback, RouteProgressObserver, Sources: https://docs.mapbox.com/android/navigation/build-with-nav-sdk/migration-from-v2/
File: AGENTS.md:324-331
|
Resolved conflict in README.md by including both 'navigation' and 'geospatial operations' in topics list, keeping 'Comprehensive' without specific count. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Fixed 8 issues identified in review: 1. Optimization API bug: Removed numeric index fallback, only use 'first'/'any' for source and 'last'/'any' for destination 2. Added missing async keyword to getCachedRoute function in AGENTS.md 3. Added missing 'unknown' congestion value to traffic styling match expression 4. Fixed API Limits table: Changed "Up to 3" to "Max 2 alternatives (3 total routes)", clarified Optimization v1 hard limit 5. Fixed skills README alphabetical ordering: moved mapbox-navigation-patterns between maplibre-migration and search-integration 6. Updated iOS Navigation SDK to v3 API: - Changed imports: MapboxNavigation → MapboxNavigationUIKit, MapboxCoreNavigation → MapboxNavigationCore - Replaced Directions.shared.calculate() callbacks with async/await routingProvider.calculateRoutes() - Updated NavigationViewController initialization with navigationRoutes and navigationOptions - Replaced MapboxNavigationService with MapboxNavigationProvider - Converted NavigationServiceDelegate callbacks to Combine publishers - Updated voice guidance configuration to use CoreConfig.ttsConfig 7. Updated Android Navigation SDK to v3 API: - Removed NavigationView examples (dropped in v3) - Removed api.startArrival() method (not documented) - Removed .accessToken() method (removed in v3) - Changed onDestroy() to use MapboxNavigationProvider.destroy() - Updated to v3-compatible patterns with requestRoutes() and RouteProgressObserver 8. All code examples now use current v3 SDK APIs for both iOS and Android Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
|
||
| | Need | Solution | | ||
| | --------------------------- | -------------------------- | | ||
| | **Web routing** | Directions API | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web routing sounds like weird phrasing
|
|
||
| ```javascript | ||
| const query = await fetch( | ||
| `https://api.mapbox.com/directions/v5/mapbox/driving/` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be using driving-traffic by default to avoid congestion and road closures
| const waypoints = [start, stop1, stop2, stop3, end]; | ||
| const coords = waypoints.map((w) => `${w[0]},${w[1]}`).join(';'); | ||
|
|
||
| const url = `https://api.mapbox.com/directions/v5/mapbox/driving/${coords}?...`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace all driving references with driving-traffic in directions API references
| const order = json.waypoints.map((wp) => wp.waypoint_index); | ||
| ``` | ||
|
|
||
| ### Traffic-Aware Routing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also seems weird we make this as a separate section. I think more natural way to say this is - use driving-traffic profile by default for realtime traffic data, including congestion and incidents aware routing.
If you care about depart-at or arrive-by parameters, you have to use driving profile instead
|
|
||
| const map = new mapboxgl.Map({ | ||
| container: 'map', | ||
| style: 'mapbox://styles/mapbox/streets-v12', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be better to refer to mapbox standard by default, we want it to be adopted more widely
|
|
||
| async function getRoute(start, end) { | ||
| const query = await fetch( | ||
| `https://api.mapbox.com/directions/v5/mapbox/driving/${start[0]},${start[1]};${end[0]},${end[1]}?` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
driving should only be used with arrive-by or depart-at because in every other situation driving-traffic is better (based on current traffic conditions, avoids congestion and incidents)
| async function getRoute(start, end) { | ||
| const query = await fetch( | ||
| `https://api.mapbox.com/directions/v5/mapbox/driving/${start[0]},${start[1]};${end[0]},${end[1]}?` + | ||
| `steps=true&geometries=geojson&access_token=${mapboxgl.accessToken}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geometries=geojson is actually the worst performance wise, unless you cannot use any other format
Summary
Adds comprehensive navigation and routing skill covering Directions API and Navigation SDKs across all platforms.
What's Included
SKILL.md - Comprehensive navigation guide covering:
AGENTS.md - Compressed quick reference (2-4KB) with:
Patterns Covered
Web (Directions API)
iOS (Navigation SDK)
Android (Navigation SDK)
Use Cases
Testing
Part of tutorial-based skills series. Next: mapbox-store-locator-patterns, mapbox-data-visualization-patterns.