Implement figma

From vultisig/vultisig-android · View interactive version

Implement figma is an AI agent skill from the GitHub repository vultisig/vultisig-android. Implement a Figma design change with before/after screenshot capture. Takes a GitHub issue or Figma URL, fetches the design, captures a "before" screenshot, implements the fix, captures an "after" screenshot, and prepares everything for PR. Usage: /implement-figma <issue-number-or-figma-url>

How to use this skill

Skill file

Implement Figma Design Change

Implements a UI fix based on a Figma design with verified before/after screenshots.

Workflow Overview

1. Parse input (issue# or Figma URL)
2. Fetch Figma design (design reference only — NOT a screenshot substitute)
3. Capture BEFORE screenshot via PreviewActivity + ADB
4. Implement the code changes
5. Rebuild, capture AFTER screenshot via PreviewActivity + ADB
6. Save before/after PNGs for PR attachment

CRITICAL: Screenshot Rules


Step 1: Parse Input

If GitHub issue number: Read the issue to extract:

gh issue view NUMBER --repo vultisig/vultisig-android

If Figma URL: Extract fileKey and nodeId from URL pattern:

Step 2: Fetch Figma Design (Expected State)

Get the design spec and screenshot:

mcp__figma__get_design_context(
  fileKey: "puB2fsVpPrBx3Sup7gaa3v",
  nodeId: "<extracted-node-id>",
  clientLanguages: "kotlin",
  clientFrameworks: "jetpack-compose"
)

Also capture a Figma screenshot separately:

mcp__figma__get_screenshot(
  fileKey: "puB2fsVpPrBx3Sup7gaa3v",
  nodeId: "<extracted-node-id>"
)

Save the Figma screenshot for PR reference (design target only).

Step 3: Capture BEFORE Screenshot

Primary Method: PreviewActivity + ADB (Preferred)

The project has a debug-only PreviewActivity at app/src/debug/java/com/vultisig/wallet/debug/PreviewActivity.kt that renders composable previews with mock data on a real device/emulator.

3a. Add a preview case for the target screen
  1. Open PreviewActivity.kt and add a new when branch for the screen:
when (screen) {
    "swap_confirm" -> SwapConfirmPreview()
    "settings" -> SettingsPreview()
    "<screen_name>" -> <ScreenName>Preview()   // ← add this
    else -> SwapConfirmPreview()
}
  1. Create a @Composable preview function with realistic mock data:
@Composable
private fun <ScreenName>Preview() {
    // Build mock state with realistic values
    val state = <ScreenName>UiModel(
        // ... fill in with representative data
    )
    <ScreenName>Screen(
        state = state,
        // ... provide no-op callbacks
    )
}

Mock data guidelines:

3b. Build and install
./gradlew :app:installDebug
3c. Launch and capture
# Launch the preview
adb shell am start -n com.vultisig.wallet/.debug.PreviewActivity --es screen "<screen_name>"

# Wait for render, then capture
sleep 2
mkdir -p screenshots/before
adb shell screencap -p /sdcard/screenshot_before.png
adb pull /sdcard/screenshot_before.png screenshots/before/

Fallback: Direct ADB Navigation

If the screen is easy to reach in the running app (e.g., Settings, Home):

# Launch the app
adb shell am start -n com.vultisig.wallet/.app.activity.MainActivity

# Navigate via taps (use `adb shell uiautomator dump` to find element bounds)
adb shell uiautomator dump /sdcard/ui_dump.xml
adb pull /sdcard/ui_dump.xml /tmp/ui_dump.xml
# Parse bounds, then tap
adb shell input tap X Y

# Capture
sleep 2
mkdir -p screenshots/before
adb shell screencap -p /sdcard/screenshot_before.png
adb pull /sdcard/screenshot_before.png screenshots/before/

Last Resort: No Emulator Available

If no emulator is running (adb devices shows no devices):

  1. Do NOT use Figma screenshots as before/after — they are design references, not Android renders
  2. Note clearly in the PR that real screenshots could not be captured
  3. Provide a detailed text-based comparison table with exact values from code (before → after)
  4. Add needs-visual-review label to the PR — a human must verify on device

Step 4: Implement the Code Changes

Read the target file and make the changes based on the Figma design context.

Implementation Checklist

Common Theme Token Mappings

// Check these files for token → hex mappings:
// app/src/main/java/com/vultisig/wallet/ui/theme/V2Theme.kt
// app/src/main/java/com/vultisig/wallet/ui/theme/BrockmannTheme.kt

Step 5: Capture AFTER Screenshot

  1. Rebuild and reinstall:
./gradlew :app:installDebug
  1. Launch PreviewActivity and capture (same screen name as before):
adb shell am start -n com.vultisig.wallet/.debug.PreviewActivity --es screen "<screen_name>"
sleep 2
mkdir -p screenshots/after
adb shell screencap -p /sdcard/screenshot_after.png
adb pull /sdcard/screenshot_after.png screenshots/after/

Step 6: Prepare for PR

Save real Android screenshots:

screenshots/
├── before/          ← REAL Android render BEFORE code changes
│   └── screen.png
└── after/           ← REAL Android render AFTER code changes
    └── screen.png

These are ACTUAL Android renders, not Figma exports. The Figma design is referenced by link only.

Create a summary for the PR creator:

cat > /tmp/figma-implementation-summary.md <<'EOF'
## Implementation Summary

**Issue**: #NUMBER
**Screen**: ScreenName
**Figma Link**: https://www.figma.com/design/puB2fsVpPrBx3Sup7gaa3v/Vultisig-App?node-id=X-Y

### Changes Made
- [List each change with before → after values]

### Screenshots (Real Android Renders)
- `screenshots/before/` — Android render before changes (ADB screencap)
- `screenshots/after/` — Android render after changes (ADB screencap)
- Figma design: [link above] (reference only, not a screenshot)

### Files Modified
- `path/to/File.kt` (lines X-Y)
EOF

Inform the user: "Implementation complete. Run /create-figma-pr to create a PR with before/after screenshots attached."


PreviewActivity Reference

Location: app/src/debug/java/com/vultisig/wallet/debug/PreviewActivity.kt

Manifest: app/src/debug/AndroidManifest.xml

The PreviewActivity is a debug-only activity that:

To add a new screen preview, edit PreviewActivity.kt:

  1. Add a new when branch in onCreate
  2. Create a @Composable function with mock data
  3. Call the screen's inner stateless composable (must be internal visibility)

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.