Skip to content

Fix Compose annotation and token guidance in android AGENTS.md - #83

Open
mattpodwysocki wants to merge 2 commits into
mainfrom
fix-android-agents-compose
Open

mattpodwysocki wants to merge 2 commits into
mainfrom
fix-android-agents-compose

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

The problem

README.md:801 tells users to curl a skill's AGENTS.md into their project root for Codex, Copilot, and other AGENTS.md-based tools. It is a standalone drop-in, not an internal note.

mapbox-android-patterns/AGENTS.md used its "Compose Annotations Pattern" section to demonstrate what not to do:

// ❌ Declarative annotation components are not supported
// Use MapEffect with annotation managers instead (see above)
MapboxMap(modifier = Modifier.fillMaxSize()) {
    // This doesn't work:
    PointAnnotation(...)
}

references/compose.md documents the exact opposite — PointAnnotation is the Compose pattern, with rememberIconImage for the icon and interactionsState.onClicked for taps, and it notes the onClick parameter is deprecated.

So the file shipped to project roots was steering developers away from the current API toward a MapEffect workaround. Separately, the programmatic token path was missing entirely, including the com.mapbox.common vs com.mapbox.maps import distinction that decides whether the code compiles.

The fix

Replaced the section with the pattern from references/compose.md, and added the programmatic token path. Nothing here is new material — it is what the skill's own references already say.

Measured

Found by running the eval suite against AGENTS.md as its own surface (added in #80), at --repeats=5:

eval before after
#6 — tappable Compose markers 7% 100%
#5 — programmatic access token 53% 87%
skill, agents surface 73.9% 95.6%

#6 scored 0/3 on every API expectation across all five runs and was the worst result anywhere in the repo. The skill average hid it: at 73.9%, mapbox-android-patterns looked mid-pack. Only the per-eval view surfaced it.

#5's remaining 87% is within its own run-to-run range (75–100%), so it is not a further content defect.

Note on ordering

This branches from main and is independent of #80, so it can merge in either order. The --surface and --repeats runner flags used to measure this live in #80; re-running these numbers before that merges needs its scripts/eval.js.

🤖 Generated with Claude Code

AGENTS.md is a standalone drop-in: README.md tells users to curl it into
a project root for Codex and Copilot. This one told them the supported
Compose annotation API does not exist.

The "Compose Annotations Pattern" section was a worked example of what
NOT to do, captioned "Declarative annotation components are not
supported" and "This doesn't work", steering readers to MapEffect with an
annotation manager. references/compose.md documents the opposite:
PointAnnotation is the Compose pattern, with rememberIconImage for the
icon and interactionsState.onClicked for taps. So the drop-in file was
routing people away from the current API and toward a workaround.

Replace it with the pattern from references/compose.md, including that
iconImage is required or nothing renders, that rememberIconImage is how
you load a drawable, and that the onClick parameter is deprecated in
favour of interactionsState.onClicked.

Also add the programmatic access token path, which the file never
mentioned: the import is com.mapbox.common.MapboxOptions, not
com.mapbox.maps.MapboxOptions, and manifest meta-data placeholders are
not read by the SDK.

Found by running the eval suite against AGENTS.md as its own surface.
Scores on the agents surface, n=5 per eval:

  #6 (tappable Compose markers)    7% -> 100%
  #5 (programmatic access token)  53% ->  87%
  skill overall                 73.9% -> 95.6%

#6 was the worst result anywhere in the repo, and the skill's average hid
it: at 73.9% mapbox-android-patterns looked mid-pack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant