Skip to main content

Claude Prompt to Build a Browser Extension UI

Design browser extension UIs: popup, options page, sidebar panel and content-script overlays, with Chrome/Firefox API and message-passing integration.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Build the UI for a Chrome (Manifest V3) with Firefox cross-compatibility browser extension called CodeLens that analyzes GitHub pull requests and highlights potential issues, complexity metrics, and suggests reviewers. The extension has 10,000 developers target users and must work on github.com and GitLab instances. Design these UI surfaces: 1) Popup UI (400x500px) — create a compact interface using Preact with Tailwind CSS for minimal bundle size that displays PR summary, risk score, file change treemap, and reviewer suggestions. Design the layout with a fixed header (extension name + settings gear icon), a scrollable content area, and a fixed footer with Analyze PR button and Quick Settings toggle. Implement the popup with a dark theme matching GitHub dark mode visual style and ensure it loads in under 200ms. 2) Options/Settings page — build a full-page settings interface organized into General, Analysis Rules, Notifications, API Keys, and About sections. Use chrome.storage.sync for synced settings and chrome.storage.local for large data. Implement real-time save with debounce, validation feedback, and an export/import configuration feature. 3) Content script overlay — design an injected UI that appears on github.com and GitLab instances as a a sidebar panel on PR pages with inline annotations on changed files. Use Shadow DOM to prevent style conflicts with the host page. Implement positioning logic that avoids covering critical page elements, supports drag-to-reposition, and remembers position per domain. 4) Build the message passing architecture: content script <-> background service worker <-> popup communication using chrome.runtime.sendMessage and chrome.runtime.onMessage. Define ANALYZE_PR, GET_SETTINGS, UPDATE_BADGE, SHOW_NOTIFICATION message types with TypeScript interfaces. 5) Implement the badge system on the browser action icon: update the badge text and color based on analyzing (blue, spinner), issues found (red, count), clean (green, checkmark) using chrome.action.setBadgeText and setBadgeBackgroundColor. 6) Handle permissions gracefully: request optional permissions (notifications, all GitLab URLs) only when the user tries to use features that need them, using chrome.permissions.request with a clear explanation dialog. 7) Design a first-run onboarding flow with 4 steps that guides users through setup, permissions, and key features using a dedicated tab.

What this prompt does

This prompt designs the full UI for a [browser_target] browser extension called [extension_name] that [extension_purpose], covering every surface at once rather than just the popup. It specs the popup, the options/settings page, an injected content-script overlay, the message-passing architecture between scripts, the action-icon badge system, graceful optional-permission handling, and a first-run onboarding flow. Mapping all surfaces together up front is what keeps an extension from leaking styles or losing state between its parts.

The variables define each surface and how they communicate. [popup_dimensions], [ui_framework], and [popup_content] shape the compact popup with its fixed header and footer, while [settings_sections] organizes the options page and [overlay_type] defines the injected UI on [target_sites]. The overlay uses Shadow DOM to avoid style conflicts and remembers its position per domain. [message_types] defines the typed messages flowing between content script, background service worker, and popup, and [badge_states] plus [optional_permissions] handle status signaling on the action icon and just-in-time permission requests. An [onboarding_steps]-step first-run flow ties it together so new users reach a working setup quickly.

When to use it

  • Building a Manifest V3 extension and wanting all UI surfaces designed coherently.
  • Injecting a content-script overlay on [target_sites] without clashing with host-page CSS.
  • Defining typed message passing between content script, service worker, and popup up front.
  • Designing a badge system that reflects [badge_states] on the action icon.
  • Requesting [optional_permissions] only when a feature needs them, with a clear explanation.
  • Creating a first-run onboarding flow that walks users through setup and permissions.

Example output

You get a multi-surface UI spec: a [popup_dimensions] popup built in [ui_framework] showing [popup_content] with fixed header and footer; an options page split into [settings_sections] using chrome.storage.sync with debounced save and import/export; a Shadow-DOM content-script [overlay_type] with drag-to-reposition and per-domain memory; a message-passing layer defining [message_types] with TypeScript interfaces; badge logic for [badge_states]; just-in-time chrome.permissions.request flows for [optional_permissions]; and an onboarding flow with [onboarding_steps] steps.

Pro tips

  • Isolate the content-script overlay in Shadow DOM; without it, the host page's CSS will distort [overlay_type] unpredictably.
  • Define [message_types] as TypeScript interfaces early; loose message shapes are where extension bugs hide.
  • Use chrome.storage.sync for small synced settings and chrome.storage.local for large data; syncing big blobs hits quota limits and fails silently across devices.
  • Request [optional_permissions] only at the moment a feature needs them, with a clear dialog, to keep install-time trust high.
  • Keep the popup under your [load_time] budget by choosing a light [ui_framework]; heavy bundles make the popup feel sluggish.
  • Remember the service worker is ephemeral in MV3; persist state to storage rather than relying on in-memory variables between events, since the worker can be torn down at any time.

Frequently Asked Questions

Why use Shadow DOM for the content-script overlay?
Injected UI shares the DOM with the host page, so the page's CSS can break your overlay and vice versa. Shadow DOM encapsulates the overlay's styles, ensuring `[overlay_type]` renders consistently across the varied layouts of `[target_sites]`.
Does this work for both Chrome and Firefox?
The default `[browser_target]` is Chrome Manifest V3 with Firefox cross-compatibility in mind. Most APIs overlap, but some differ between browsers, so you should test on each target since service-worker behavior and a few APIs are not identical.
How do the different extension parts communicate?
Through `chrome.runtime.sendMessage` and `onMessage`, with the content script, background service worker, and popup exchanging the `[message_types]` you define. Using typed TypeScript interfaces for these messages keeps the data shapes consistent and prevents subtle runtime errors.
When should the extension request optional permissions?
Only when the user tries to use a feature that needs them, via `chrome.permissions.request` with a clear explanation. Requesting `[optional_permissions]` up front at install time erodes trust and raises rejection rates, so just-in-time requests are preferred.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Frontend Development Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support