ワンクリックで
component-matcher
// Analyze a UI screenshot and identify which MEGA core-ui library components match the visible elements. Extracts component metadata from the sources.jar and performs text + visual matching against component screenshots.
// Analyze a UI screenshot and identify which MEGA core-ui library components match the visible elements. Extracts component metadata from the sources.jar and performs text + visual matching against component screenshots.
| name | component-matcher |
| description | Analyze a UI screenshot and identify which MEGA core-ui library components match the visible elements. Extracts component metadata from the sources.jar and performs text + visual matching against component screenshots. |
| triggers | ["/component-matcher","match components","identify components","which core-ui components","component lookup","match components from figma","figma component matcher"] |
Analyze a UI screenshot to identify which MEGA core-ui Compose library components can be used for the visible UI elements. Uses a two-phase approach: text-based narrowing with llms.txt, then visual comparison with component screenshots extracted from the sources.jar.
/component-matcher ./designs/home-screen.png
/component-matcher /tmp/screenshot.png --categories button,toolbar,list
/component-matcher https://figma.com/design/abc123/MyApp?node-id=42-1337
/component-matcher https://figma.com/design/abc123/branch/def456/MyApp --categories button,toolbar
| Argument | Description | Example |
|---|---|---|
| Image source | Path to a local screenshot or a Figma URL to capture (required, first positional arg) | ./designs/home.png or https://figma.com/design/abc123/MyApp?node-id=42-1337 |
--categories <list> | Comma-separated category filter to limit matching scope (optional) | --categories button,toolbar |
Read the core-ui version from the version catalog:
Grep: pattern "mega-core-ui = " in gradle/catalogs/lib.versions.toml
Extract the version string from the [versions] section (format: mega-core-ui = "X.Y.Z").
Locate the sources.jar in the Gradle cache:
find ~/.gradle/caches/modules-2/files-2.1/mega.android.core/ui/{version}/ -name "*-sources.jar" 2>/dev/null
The jar lives inside a hash-named subdirectory, so find is necessary.
Store the resolved path as SOURCES_JAR for subsequent steps.
If not found, output this message and stop:
The core-ui sources.jar for version {version} was not found in the Gradle cache.
Please run: ./gradlew :app:dependencies --configuration debugCompileClasspath
Then retry /component-matcher.
1a. Determine the input type:
Inspect the first positional argument:
http and contains figma.com/design/, treat it as a Figma URL → go to 1b.1b. Figma URL — fetch screenshot via MCP:
Parse the URL to extract fileKey and nodeId:
figma.com/design/:fileKey/:fileName?node-id=:nodeId
fileKey = the path segment after /design/nodeId = the node-id query parameter, with - converted to : (e.g., 42-1337 → 42:1337)figma.com/design/:fileKey/branch/:branchKey/:fileName
:branchKey as the fileKeynodeId = the node-id query parameter (same - to : conversion)Validate that both fileKey and nodeId were extracted. If nodeId is missing (no node-id query parameter in the URL), inform the user:
The Figma URL must include a node-id parameter (e.g., ?node-id=42-1337).
Please select a specific frame or component in Figma, copy its link, and retry.
Stop execution.
Call the Figma MCP tool to capture the screenshot:
mcp__plugin_figma_figma__get_screenshot(fileKey: "<extracted>", nodeId: "<extracted>")
The tool returns the screenshot rendered visually in the conversation, the same as a Read on a local PNG.
If the MCP call fails (e.g., tool not available, auth error, invalid file/node), output:
Failed to fetch screenshot from Figma. Possible causes:
- The Figma MCP server is not connected (run /plugin to connect it)
- The fileKey or nodeId is invalid
- You do not have access to this Figma file
You can alternatively export the frame as a PNG and use a local file path:
/component-matcher ./exported-frame.png
Stop execution.
Store the original Figma URL as IMAGE_SOURCE for the report.
1c. Local file path — read from disk:
Read tool to view the image at the provided path. Claude Code's multimodal capability will render the image visually.IMAGE_SOURCE for the report.1d. Visual inventory (applies to both input types):
Perform an initial visual analysis and produce a numbered inventory of all distinct UI elements visible in the screenshot. For example:
1. Top app bar with back arrow and title "Settings"
2. Toggle list items (3 rows with title, subtitle, trailing toggle)
3. Divider between sections
4. Primary filled button at bottom ("Save")
5. Inline warning banner below the toggle section
Present this inventory to the user before proceeding. This ensures alignment on what elements are being matched.
Extract the compact component catalog from the jar:
unzip -p "$SOURCES_JAR" META-INF/mega.android.core.ui/llms.txt
Read the full llms.txt content (~311 lines). It is organized by category with one-line component summaries including parameter names and descriptions.
For each UI element identified in Step 1, select 1-5 candidate components based on:
title, subtitle, leadingElement, trailingElement?)If --categories was specified, restrict candidates to only those categories.
Build a candidate shortlist. This typically reduces 124 possible screenshots down to 5-15 relevant candidates.
Available categories in llms.txt: badge, banner, button, card, card/plans, checkbox, chip, dialogs, divider, dropdown, empty, fab, general, image, indicators, inputfields, label, list, navigation, profile, prompt, scrollbar, scrollbar/fastscroll, settings, sheets, slider, snackbar, state, surface, tabs, text, thumbnail, toggle, toolbar, tooltip/component, tooltip/popup/interactive, tooltip/popup/simple
For each candidate component that has a screenshot in the library:
Determine the screenshot path inside the jar. The naming convention is:
META-INF/mega.android.core.ui/screenshots/mega/android/core/ui/screenshots/{Category}ScreenshotsKt/{ComponentName}_Screenshot_748aa731_0.png
Category-to-screenshot-directory mapping:
| llms.txt category | Screenshot directory |
|---|---|
| banner | BannerScreenshotsKt |
| button | ButtonScreenshotsKt |
| card | CardScreenshotsKt |
| card/plans | CardPlansScreenshotsKt |
| checkbox | CheckboxScreenshotsKt |
| chip | ChipScreenshotsKt |
| dialogs | DialogsScreenshotsKt |
| divider | DividerScreenshotsKt |
| fab | FabScreenshotsKt |
| general | GeneralScreenshotsKt |
| indicators | IndicatorsScreenshotsKt |
| inputfields | InputfieldsScreenshotsKt |
| list | ListScreenshotsKt |
| navigation | NavigationScreenshotsKt |
| profile | ProfileScreenshotsKt |
| prompt | PromptScreenshotsKt |
| scrollbar/fastscroll | ScrollbarFastscrollScreenshotsKt |
| sheets | SheetsScreenshotsKt |
| slider | SliderScreenshotsKt |
| snackbar | SnackbarScreenshotsKt |
| state | StateScreenshotsKt |
| surface | SurfaceScreenshotsKt |
| tabs | TabsScreenshotsKt |
| text | TextScreenshotsKt |
| thumbnail | ThumbnailScreenshotsKt |
| toggle | ToggleScreenshotsKt |
| toolbar | ToolbarScreenshotsKt |
Categories with NO screenshots (text-only matching): badge, dropdown, empty, image, label, scrollbar (non-fastscroll), settings, tooltip/component, tooltip/popup/interactive, tooltip/popup/simple
Extract only the candidate screenshot PNGs to a temp directory:
mkdir -p /tmp/core-ui-match
unzip -j "$SOURCES_JAR" "META-INF/mega.android.core.ui/screenshots/mega/android/core/ui/screenshots/{Category}ScreenshotsKt/{ComponentName}_Screenshot_748aa731_0.png" -d /tmp/core-ui-match/
Repeat for each candidate. Only extract screenshots for the shortlisted candidates (typically 5-15), never all 124.
Use the Read tool to view each extracted candidate screenshot PNG.
Compare each candidate screenshot against the corresponding region in the user's input image. Assess:
Assign a confidence level to each match:
For categories without screenshots, matching is text-only. Note this in the output: "No library screenshot available for visual comparison."
For each high or medium confidence match:
Extract the detailed component reference:
unzip -p "$SOURCES_JAR" META-INF/mega.android.core.ui/llms-full.txt
Locate the ### {ComponentName} section in llms-full.txt for the matched component.
Extract the full @Composable fun signature with all parameters and default values, plus any usage example.
Output the report directly to the user in this format:
# Component Matching Report
**Input:** {IMAGE_SOURCE}
**core-ui Version:** {version}
## Summary
| # | UI Element | Matched Component | Category | Confidence |
|---|-----------|-------------------|----------|------------|
| 1 | Top app bar | MegaTopAppBar | toolbar | High |
| 2 | Toggle list items | SettingsToggleItem | settings | Medium |
| 3 | Divider | SubtleDivider | divider | High |
| 4 | Primary button | PrimaryFilledButton | button | High |
| 5 | Warning banner | InlineWarningBanner | banner | High |
| 6 | Custom header | No match | - | - |
## Detailed Matches
### 1. Top app bar -> MegaTopAppBar (toolbar) -- HIGH
[Show the library screenshot via Read tool output]
**Function Signature:**
[Full @Composable fun signature from llms-full.txt]
**Notes:** The top bar shows a back arrow and title, matching `AppBarNavigationType.Back`.
---
### 6. Custom header -> No Match
**Notes:** This header layout with a custom illustration does not correspond to any existing core-ui component. You will need a custom composable.
---
## Unmatched Elements (Custom Components Needed)
- Custom header with illustration — consider using `MegaScaffold` as the container
For composite elements (e.g., a list item with a toggle), identify each contributing component separately:
### 2. Toggle list items -> SettingsToggleItem (settings) -- MEDIUM
**Notes:** SettingsToggleItem provides title + subtitle + toggle in a single component.
Alternatively, this could be composed from `TwoLineListItem` (list) + `Toggle` (toggle)
if more layout control is needed.
Remove temporary screenshot files:
rm -rf /tmp/core-ui-match/
llms.txt text descriptions first, then extract only candidate screenshots for visual comparison. Never extract all 124 screenshots.gradle/catalogs/lib.versions.toml at runtime. Never hardcode the version or jar path./tmp/core-ui-match/ when done.BasicDialog has 5, MegaIcon has 9). Recommend the specific overload whose parameters best match what is visible in the screenshot.Column, LazyColumn, Scaffold, Text) and note they are platform primitives, not core-ui components.Use when given a Figma URL or node and asked to translate it into MEGA Android Jetpack Compose code, before writing any UI code. Triggers include "implement this Figma", "build this design", "translate Figma to Compose", or any message containing a figma.com link plus a request for Compose / Android UI. Encodes MEGA's Core-UI component mapping, design-token rules, and the rule that existing screens MUST be located before any new code is written.
Creates a GitLab Merge Request for the current branch by auto-generating a structured description from the branch diff and pushing with GitLab push options.
Upload new Android strings to Weblate. Extracts new strings added in the current branch (compared to develop) from strings_shared.xml, writes them to the transifex/weblate/strings.xml file, runs the upload script, then optionally uploads a screenshot and maps it to the uploaded strings via the Weblate API.
Upgrades, or migrates, an Android project to use Android Gradle Plugin (AGP) version 9
Create, update, and refactor Android Compose screens with Navigation3 destinations. Creates stateless Screen composables, Destination files (NavKey + EntryProviderScope extension), and registers destinations in FeatureDestination classes. Supports simple and parameterized NavKeys, navigation callbacks, metadata, and assisted ViewModel injection. Does NOT create ViewModels (use /viewmodel for that).
Android PR Code Review skill. Performs a comprehensive code review on the current Git repository's PR or specified code changes. Covers all review dimensions including architecture, Kotlin code quality, Android platform best practices, performance, security, and testability — along with a standardized output format. Can also be used as a standalone reference for Android review standards.