Published Chrome Web Store extension
AI Studio Prompt Library
A published Chrome MV3 extension for saving, searching, and inserting reusable Google AI Studio system prompts with local-first storage and resilient content-script insertion.
AI Studio Prompt Library
Summary: AI Studio Prompt Library is a published Chrome extension for people who reuse system instructions in Google AI Studio. It stores prompts locally, lets users search and insert them quickly, and keeps the insertion flow narrow, private, and reliable.
Why I built it
I kept running into a small but repetitive workflow problem: good system prompts are reusable, but copying them between notes, chats, and AI Studio is slow and error-prone.
The useful version of the project was not another generic prompt manager. It needed to sit directly inside the browser workflow, stay private by default, and insert text into AI Studio without requiring a backend, account, or external service.
What it does
The extension lets users create, edit, delete, search, copy, import, and export reusable system prompts. From AI Studio, a user can open a quick popup, insert a selected prompt, or use a shortcut/context-menu action to insert the most recently used prompt.
Insertion supports replace, append, and prepend modes. The options page also exposes settings for context-menu visibility, overwrite confirmation, theme behavior, auto-close behavior, and a custom selector escape hatch for AI Studio layout changes.
Tech stack
The project is a Chrome Manifest V3 extension built with TypeScript, Vite, @crxjs/vite-plugin, content scripts, a background service worker, popup UI, options UI, and Chrome extension APIs.
Prompts are stored in chrome.storage.local to avoid sync quota issues for larger prompt content. Settings and the last-used prompt pointer live in chrome.storage.sync, which keeps preferences lightweight while keeping prompt content local to the browser.
Key engineering decisions
The main product boundary was privacy and workflow speed: no backend, no analytics, and no external network calls. That kept the project small and made the privacy story easy to verify.
The implementation follows a few practical constraints:
- Store prompt bodies locally instead of pushing them through a hosted service.
- Keep prompt exports deterministic by sorting exported prompts alphabetically.
- Sort normal prompt lists by most-recently-used behavior so active prompts stay near the top.
- Scope the content script to
https://aistudio.google.com/*instead of broad host permissions. - Use layered selector fallbacks for the system-instructions field.
- Provide a custom selector override because AI Studio can change its DOM.
- Confirm destructive actions such as replacing existing system instructions or deleting prompts.
Problems I ran into
The hardest part was reliable insertion into a third-party web app. AI Studio can render the system-instructions field in different states, and the extension has to avoid inserting into the main chat prompt by accident.
That pushed the content script toward layered detection: stable aria labels first, observed placeholder/class fallbacks next, then a visible textarea fallback that excludes the main prompt wrapper. The extension also tries to open the system-instructions panel when needed, waits for the textarea to appear, and dispatches input/change events so the host app notices the update.
Another practical issue was storage shape. Prompt content can get large enough that chrome.storage.sync is not a good default for the body text. Splitting prompt bodies into local storage and lightweight settings into sync storage made the quota behavior less fragile.
What I learned
Small browser extensions still need clear systems thinking. The visible feature is a prompt library, but the quality comes from boundaries: narrow permissions, local data ownership, deterministic import/export, reliable messaging between popup/background/content scripts, and careful DOM interaction with a site I do not control.
Publishing it also forced product discipline. Store copy, privacy policy, permissions, versioning, and screenshots all have to match what the extension actually does.
What I would improve next
I would add stronger automated coverage around the content-script selector fallbacks, a clearer diagnostic mode when AI Studio changes its DOM, and a safer import preview before replacing the current prompt library.