A Chrome/Edge browser extension for managing and quickly inserting prompt templates into AI chat platforms.
- Prompt Template Management: Create, edit, delete, and organize prompt templates
- Categories & Tags: Organize prompts with categories and tags
- Multi-Platform Support: Works with ChatGPT, Gemini, Doubao, and more
- Floating UI: Injects a floating button on AI chat pages for quick access
- Auto-fill: One-click insertion of prompts into AI chat interfaces
- Auto-submit: Optional automatic submission after insertion
- Variables: Support for variable placeholders (e.g.,
{{topic}}) - Keyboard Shortcuts: Quick access with Ctrl+Shift+P and Ctrl+Shift+U
- Local Storage: All data stored locally using
chrome.storage.local - Import/Export: Backup and restore prompts via JSON files
- Categories: Color-coded categorization system
- Usage Tracking: Tracks how often each prompt is used
- Drag & Drop: Reposition the floating button anywhere on screen
- Responsive Design: Works on both desktop and mobile Chrome
- Dark Mode Support: Follows system theme preferences
- Search & Filter: Quickly find prompts by title, tags, or category
- Clone the repository
- Install dependencies:
npm install
- Build the extension:
npm run build
- Load unpacked extension in Chrome/Edge:
- Open
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
distfolder
- Open
npm run package
# Creates prompt-pocket.zip in project rootsrc/
├── background/ # Service worker (Manifest V3)
├── content/ # Content scripts for AI chat pages
├── popup/ # React-based popup UI
├── storage/ # Storage abstraction layer
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
-
Background Service Worker (
background.ts):- Manages extension lifecycle
- Handles message passing between components
- Coordinates storage operations
-
Content Script (
contentScript.ts):- Injected into AI chat pages
- Detects platform interface elements
- Manages platform detector factory
- Injects floating UI components
- Handles prompt insertion
-
Storage Manager (
storage.ts):- Type-safe abstraction over
chrome.storage.local - Data migration support
- Change listeners for real-time updates
- Type-safe abstraction over
-
Platform_detector Factory (
detectorFactory.ts):- Manages multiple platform detectors
- Selects appropriate detector based on current URL
- Handles platform switching
-
Platform Detectors (
chatGPTDetector.ts,geminiDetector.ts,doubaoDetector.ts):- Resilient DOM detection using multiple strategies
- MutationObserver for UI changes
- Version-agnostic detection per platform
-
UI Injector (
uiInjector.ts):- Manages floating button and panel injection
- Drag & drop functionality
- Keyboard shortcut handling
The extension uses a resilient, multi-layered approach to detect AI chat interfaces:
- Primary Detection: Data-testid attributes (most stable)
- Secondary Detection: ID-based selectors
- Tertiary Detection: Placeholder text matching
- Fallback Detection: Generic textarea/contenteditable detection
- Factory Pattern: Manages multiple platform detectors dynamically
- MutationObserver: Watches for DOM changes and adapts
- Version Detection: Identifies different UI versions per platform
- State Monitoring: Detects when AI is "processing" or ready to submit
- Backup Interval: 2-second polling as fallback detection
https://chat.openai.com/*https://chatgpt.com/*
https://gemini.google.com/*https://bard.google.com/*
https://doubao.com/*https://www.doubao.com/*https://bot.doubao.com/*
Additional AI platforms will be supported in future releases.
storage: For local data storageactiveTab: For content script injection- Host permissions for AI chat platform domains
- No remote code execution
- No external API calls
- All data stored locally
- Principle of least privilege
npm run build # Build production bundle
npm run dev # Development mode with watch
npm run lint # Run ESLint
npm run type-check # TypeScript type checking
npm run package # Create ZIP for distributionThe extension uses:
- TypeScript for type safety
- React for popup UI
- Webpack for bundling
- ESLint for code quality
- Full TypeScript support with strict mode
- Type-safe message passing between components
- Comprehensive interface definitions for all data structures
- Click extension icon to open popup
- Create prompt templates with variables (e.g.,
{{topic}}) - Visit an AI chat platform and click the floating button
- Select a prompt to insert (with variable values if needed)
- Optional: Enable auto-submit for instant execution
- Ctrl+Shift+P: Open prompt panel on AI chat pages
- Ctrl+Shift+U: Toggle floating UI visibility
- Ctrl+Shift+L: Quick insert last used prompt
Use {{variable_name}} in prompt content to create variables. When inserting:
- Variables are automatically detected
- User can provide values for each variable
- Variables are replaced in the prompt content
- Template Library: Community-shared prompt templates
- Sync Support: Cross-device synchronization
- AI Suggestions: Smart prompt recommendations
- Formatting Tools: Rich text formatting in prompts
- More Platforms: Additional AI chat interfaces
The modular design allows for:
- Adding new prompt variable types
- Supporting additional AI chat interfaces
- Custom UI themes and layouts
- Integration with other productivity tools
- All data stored locally in browser storage
- No data sent to external servers
- Optional export/import for backups
- Clear data option available
- Minimal required permissions
- No access to user browsing history
- No access to ChatGPT account data
- No tracking or analytics
- Manifest V3 compliant
- No remote code execution
- Clear privacy policy
- Regular security updates
-
Floating button not appearing:
- Ensure you're on a supported AI chat platform
- Check extension is enabled
- Try refreshing the page
-
Prompt not inserting:
- Check AI chat interface is fully loaded
- Verify input field is present
- Try manually focusing the input field first
-
Data not saving:
- Check browser storage permissions
- Try exporting data as backup
- Clear extension data and reconfigure
- Open Chrome DevTools on an AI chat page
- Check Console for extension logs
- Look for elements with IDs starting with
prompt-pocket-
- Fork the repository
- Create feature branch
- Make changes with tests
- Submit pull request
- TypeScript with strict mode
- ESLint for code quality
- Prettier for formatting
- Comprehensive comments
- Unit tests for core logic
- Integration tests for UI components
- Manual testing on AI chat interfaces
MIT License - See LICENSE file for details
- GitHub Issues for bug reports
- Feature requests via Issues
- Documentation updates welcome
Note: This extension is not affiliated with or endorsed by OpenAI, Google, ByteDance, or any AI service providers.