A Chrome Extension that allows you to inject commonly used saved prompt snippets (leaders and trailers) into any active text input area or contentEditable field (such as ChatGPT, Notion, Gmail, etc.). You can inject via popup buttons or by assigning custom keyboard shortcuts through the browser’s Extensions Shortcuts panel.
-
Popup buttons for quick injection:
- Leader (Main)
- Trailer (Main)
- Leader (Alt)
- Trailer (Alt)
-
Custom keyboard shortcuts (set in
chrome://extensions/shortcuts). -
Template storage:
- Save/edit four templates (leader main, trailer main, leader alt, trailer alt).
- Templates are persisted in
chrome.storage.sync(they sync across Chrome installs signed into the same account).
-
Injection logic:
-
Works in
<textarea>and<input>elements. -
Works in
contentEditablefields (e.g., ChatGPT input box). -
Correct handling of leaders/trailers:
- Leaders → snippet inserted with newline(s) after.
- Trailers → newline(s) before snippet.
-
-
Options page for editing templates with a simple form.
-
Lightweight (no external libraries, just native Chrome APIs).
-
Manifest V3 compliant.
-
Clone or download this repository:
git clone https://github.com/YOUR-USERNAME/SavedPromptInjector.git cd SavedPromptInjector -
Open Chrome and go to:
chrome://extensions/ -
In the top right, toggle Developer Mode to ON.
-
Click Load unpacked and select the project folder (the root containing
manifest.json). -
The extension icon should now appear in your Chrome toolbar.
-
Click the extension icon.
-
In the popup, choose:
- Leader (Main) → injects your main leader snippet.
- Trailer (Main) → injects your main trailer snippet.
- Leader (Alt) → injects your alternate leader snippet.
- Trailer (Alt) → injects your alternate trailer snippet.
-
Go to:
chrome://extensions/shortcuts -
Assign key combinations (e.g.,
Ctrl+Shift+Lfor Leader Main). -
Use the shortcuts while focused inside ChatGPT or any text input.
-
Right-click extension icon → Options, or click the link in the popup.
-
Edit and save your four templates:
- Leader (Main)
- Trailer (Main)
- Leader (Alt)
- Trailer (Alt)
-
manifest.jsonDefines extension metadata, permissions, background scripts, popup, options, and command bindings. -
background.jsListens for registered keyboard shortcut commands. Fetches the correct template and calls the injection logic (mirrors popup button behaviour). -
popup.html/popup.jsRenders the popup UI with four buttons + status line. Handles button clicks → fetches template → injects into active tab. -
options.html/options.jsProvides a UI for editing and saving templates. Useschrome.storage.syncso templates persist across devices. -
icons/Contains icon assets in required sizes (16px, 48px, 128px).
This extension requests the following permissions in manifest.json:
-
scriptingRequired to run injection scripts into the active page. -
activeTabNeeded so the extension can interact with the currently focused tab. -
storageUsed for persisting user’s templates (viachrome.storage.sync).
-
Save a leader template in Options:
"Please carefully analyse the following text:" -
Save a trailer template in Options:
"Summarise in three concise bullet points." -
While in ChatGPT, click Leader (Main) button → text injected, cursor remains ready.
-
Type/paste your input.
-
Use keyboard shortcut for Trailer (Main) → trailer text appears neatly after with spacing.
-
Injection spacing differs slightly between
<textarea>andcontentEditable:- For
<textarea>: handled with\ncharacters. - For
contentEditable: handled by inserting<br>elements.
- For
-
Multiple
<br>are used to simulate blank lines (since raw\nwon’t render). -
Cursor position is reset immediately after insertion.
-
Injection doesn’t work: Make sure you’ve clicked inside a text box first before triggering.
-
Keyboard shortcut not responding: Check your assignments in
chrome://extensions/shortcuts. Some combinations may be blocked/reserved by the OS. -
Templates not saving: Verify you pressed “Save” in the Options page. If syncing across Chrome profiles, allow time for
chrome.storage.syncto propagate.
MIT License
Copyright (c) 2025 Paula Livingstone
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Add more template slots.
- Export/import templates (JSON).
- Per-site template sets (ChatGPT vs Gmail vs Notion).
- Rich text injection (bold, italics) for contentEditable.
- Sync with cloud storage beyond
chrome.storage.sync.
Developed by Paula Livingstone Optimist / Engineer / Adventurer, and builder of practical tools. Newmilns, Scotland This repo is part of ongoing work to streamline workflows with Chrome extensions.