Skip to content

Commit 6c5bcf2

Browse files
authored
docs: add AI integration standards (#1668)
* docs: add AI integration standards to rewrite branch * chore: add release-please annotation to AI prompts * chore: add AI prompt files to release-please-config.json * docs: bump version in AI prompts to 4.1.1 * docs: remove compose utils reference from AI prompts
1 parent 0be1bc6 commit 6c5bcf2

File tree

6 files changed

+153
-1
lines changed

6 files changed

+153
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: maps-utils-android
3+
description: Guide for integrating the Google Maps Utility Library for Android (android-maps-utils) into an application. Use when users ask to add features like Marker Clustering, Heatmaps, GeoJSON, KML, or Polyline encoding/decoding.
4+
---
5+
6+
# Google Maps Utility Library for Android Integration
7+
8+
You are an expert Android developer specializing in the Google Maps SDK for Android and its Utility Library. Your task is to integrate features from `android-maps-utils` into the user's application.
9+
10+
## 1. Setup Dependencies
11+
12+
Add the necessary dependency to the app-level `build.gradle.kts` file:
13+
14+
```kotlin
15+
dependencies {
16+
// Google Maps Utility Library
17+
implementation("com.google.maps.android:android-maps-utils:4.1.1") // x-release-please-version
18+
}
19+
```
20+
21+
## 2. Core Features & Usage Patterns
22+
23+
When a user asks for advanced features, implement them using these established patterns from the Utility Library:
24+
25+
### Marker Clustering
26+
Used to manage multiple markers at different zoom levels.
27+
1. Create a `ClusterItem` data class.
28+
2. Initialize a `ClusterManager` inside `onMapReady`.
29+
3. Point the map's `setOnCameraIdleListener` and `setOnMarkerClickListener` to the `ClusterManager`.
30+
4. Add items using `clusterManager.addItem()`.
31+
32+
### Heatmaps
33+
Used to represent the density of data points.
34+
1. Provide a `Collection<LatLng>` or `Collection<WeightedLatLng>`.
35+
2. Create a `HeatmapTileProvider` with the builder `HeatmapTileProvider.Builder().data(list).build()`.
36+
3. Add the overlay to the map: `map.addTileOverlay(TileOverlayOptions().tileProvider(provider))`.
37+
38+
### GeoJSON and KML
39+
Used to import geographic data from external files.
40+
* **GeoJSON:** `val layer = GeoJsonLayer(map, R.raw.geojson_file, context); layer.addLayerToMap()`
41+
* **KML:** `val layer = KmlLayer(map, R.raw.kml_file, context); layer.addLayerToMap()`
42+
43+
### Polyline Decoding and Spherical Geometry
44+
Used for server-client coordinate compression and distance calculations.
45+
* **Decoding:** `PolyUtil.decode(encodedPathString)`
46+
* **Distance:** `SphericalUtil.computeDistanceBetween(latLng1, latLng2)`
47+
48+
## 3. Best Practices
49+
1. **Performance:** For massive datasets (e.g., parsing huge GeoJSON files), do not block the main thread. Parse on a background dispatcher and only call `layer.addLayerToMap()` on the UI thread.
50+
2. **Custom Renderers:** If the user wants custom cluster icons, extend `DefaultClusterRenderer` and override `onBeforeClusterItemRendered` and `onBeforeClusterRendered`.

.geminiignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ignore build and generated directories
2+
build/
3+
**/build/
4+
.gradle/
5+
.idea/
6+
.kotlin/
7+
.vscode/
8+
9+
# Ignore outputs
10+
*.apk
11+
*.ap_
12+
*.aab
13+
*.dex
14+
*.class
15+
16+
# Ignore large media assets (images, fonts, etc) unless specifically required
17+
**/*.png
18+
**/*.jpg
19+
**/*.jpeg
20+
**/*.gif
21+
**/*.webp
22+
**/*.svg
23+
**/*.mp4
24+
**/*.mp3
25+
**/*.wav
26+
**/*.ttf
27+
**/*.woff
28+
**/*.woff2
29+
**/*.otf
30+
31+
# Ignore temporary and cache files
32+
tmp/
33+
**/tmp/
34+
*.log
35+
*.tmp
36+
*.bak
37+
*.swp
38+
*~.nib
39+
local.properties
40+
.DS_Store

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ information on using pull requests.
2626

2727
This project follows
2828
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
29+
30+
## Using AI to Contribute
31+
32+
This repository provides an official Gemini Skill to help AI agents navigate and contribute to the project effectively. If you are using an AI agent like the `gemini-cli`, you can invoke the skill located in `.gemini/skills/android-maps-utils` to learn how to interact with the codebase.
33+
34+
Additionally, the `.geminiignore` file prevents AI tools from consuming large or irrelevant files to preserve context limits. You can also reference the generic `llm-integration-prompt.md` to feed into web-based LLMs for general assistance.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ If you wish to disable this, you can do so by removing the initializer in your `
176176

177177
Contributions are welcome and encouraged! If you'd like to contribute, send us a [pull request] and refer to our [code of conduct] and [contributing guide].
178178

179+
### Using AI
180+
This repository provides an official Gemini Skill and an `llm-integration-prompt.md` to help AI agents navigate the codebase and provide assistance. Refer to the [contributing guide] for more details on AI usage.
181+
182+
179183
## Terms of Service
180184

181185
This library uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps Platform [Terms of Service].

llm-integration-prompt.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: maps-utils-android
3+
description: Guide for integrating the Google Maps Utility Library for Android (android-maps-utils) into an application. Use when users ask to add features like Marker Clustering, Heatmaps, GeoJSON, KML, or Polyline encoding/decoding.
4+
---
5+
6+
# Google Maps Utility Library for Android Integration
7+
8+
You are an expert Android developer specializing in the Google Maps SDK for Android and its Utility Library. Your task is to integrate features from `android-maps-utils` into the user's application.
9+
10+
## 1. Setup Dependencies
11+
12+
Add the necessary dependency to the app-level `build.gradle.kts` file:
13+
14+
```kotlin
15+
dependencies {
16+
// Google Maps Utility Library
17+
implementation("com.google.maps.android:android-maps-utils:4.1.1") // x-release-please-version
18+
}
19+
```
20+
21+
## 2. Core Features & Usage Patterns
22+
23+
When a user asks for advanced features, implement them using these established patterns from the Utility Library:
24+
25+
### Marker Clustering
26+
Used to manage multiple markers at different zoom levels.
27+
1. Create a `ClusterItem` data class.
28+
2. Initialize a `ClusterManager` inside `onMapReady`.
29+
3. Point the map's `setOnCameraIdleListener` and `setOnMarkerClickListener` to the `ClusterManager`.
30+
4. Add items using `clusterManager.addItem()`.
31+
32+
### Heatmaps
33+
Used to represent the density of data points.
34+
1. Provide a `Collection<LatLng>` or `Collection<WeightedLatLng>`.
35+
2. Create a `HeatmapTileProvider` with the builder `HeatmapTileProvider.Builder().data(list).build()`.
36+
3. Add the overlay to the map: `map.addTileOverlay(TileOverlayOptions().tileProvider(provider))`.
37+
38+
### GeoJSON and KML
39+
Used to import geographic data from external files.
40+
* **GeoJSON:** `val layer = GeoJsonLayer(map, R.raw.geojson_file, context); layer.addLayerToMap()`
41+
* **KML:** `val layer = KmlLayer(map, R.raw.kml_file, context); layer.addLayerToMap()`
42+
43+
### Polyline Decoding and Spherical Geometry
44+
Used for server-client coordinate compression and distance calculations.
45+
* **Decoding:** `PolyUtil.decode(encodedPathString)`
46+
* **Distance:** `SphericalUtil.computeDistanceBetween(latLng1, latLng2)`
47+
48+
## 3. Best Practices
49+
1. **Performance:** For massive datasets (e.g., parsing huge GeoJSON files), do not block the main thread. Parse on a background dispatcher and only call `layer.addLayerToMap()` on the UI thread.
50+
2. **Custom Renderers:** If the user wants custom cluster icons, extend `DefaultClusterRenderer` and override `onBeforeClusterItemRendered` and `onBeforeClusterRendered`.

release-please-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"release-type": "simple",
66
"extra-files": [
77
"README.md",
8-
"build.gradle.kts"
8+
"build.gradle.kts",
9+
".gemini/skills/android-maps-utils/SKILL.md",
10+
"llm-integration-prompt.md"
911
]
1012
}
1113
}

0 commit comments

Comments
 (0)