Chrome extension that lets you modify YOUR website using natural language and Claude AI
Polish is a Chrome extension that allows users to modify website elements using plain English commands powered by Claude AI.
Example:
- Click the Polish extension icon
- Select "Select Element" and click any element on the page
- Type: "Make this button blue and larger"
- Claude AI generates and applies the CSS/HTML changes instantly
Core Concept: User installs extension β Types modifications in natural language β Claude AI processes β Changes applied locally (no upload to production)
Current Phase: POC/MVP - Backend Complete β Version: 0.1.0 Backend: Production-ready (100% complete) Frontend: Wireframe only (UI team to implement)
β Complete backend logic and infrastructure β Claude API integration β Element selection system β DOM manipulation & modification application β Message passing architecture β Error handling with recovery β State management (state machine) β Keyboard shortcuts β Comprehensive documentation
β³ UI/UX design (handled by cofounder) β³ Extension icons (final design) β³ Testing & deployment
Polish/
βββ README.md # You are here
βββ CONTRIBUTING.md # How to contribute
βββ manifest.json # Chrome extension configuration
β
βββ docs/ # Complete documentation
β βββ INDEX.md # Documentation navigation
β βββ README.md # Docs overview
β βββ BACKEND_ARCHITECTURE.md # System architecture
β βββ IMPLEMENTATION_DETAILS.md # Technical deep dive
β βββ MESSAGE_PROTOCOL.md # Message passing spec
β βββ DOM_CONTRACT.md # For UI team
β
βββ src/ # Source code
β βββ background/ # Background service worker
β β βββ service-worker.js # Claude API handler
β βββ content/ # Content scripts (run on pages)
β β βββ content.js # Element selection & modification
β β βββ content.css # Selection UI styles
β βββ popup/ # Popup scripts
β β βββ popup.js # Backend logic (state machine)
β β βββ popup.html # UI reference wireframe
β βββ utils/ # Shared utilities
β βββ api.js # Claude API wrapper
β βββ dom-parser.js # DOM context extraction
β
βββ icons/ # Extension icons (placeholders)
Each folder has its own README - Check docs/INDEX.md for navigation guide
- Google Chrome (latest version)
- Anthropic API key (Get one here)
- Node.js/npm (optional, for development)
1. Clone the repository:
git clone <repository-url>
cd Polish2. Load extension in Chrome:
# 1. Open Chrome and go to:
chrome://extensions/
# 2. Enable "Developer mode" (top right toggle)
# 3. Click "Load unpacked"
# 4. Select the Polish folder
# Extension should load successfully β
3. Set up API key:
# 1. Click the Polish extension icon
# 2. Enter your Anthropic API key (starts with sk-ant-)
# 3. Click "Save"1. Navigate to any website (e.g., https://wikipedia.org)
2. Click Polish extension icon
3. Click "Select Element" button
4. Click any element on the page
- Should see blue highlight on hover
- Should see green highlight when clicked
5. Type a modification request
- Example: "Make this text bigger and blue"
- Press Ctrl+Enter (or Cmd+Enter on Mac)
6. Wait 2-10 seconds for Claude to process
7. Modifications applied!
Step 1: Read documentation
docs/DOM_CONTRACT.md # Required element IDs and structure
src/popup/README.md # What popup.js doesStep 2: Start with wireframe
src/popup/popup.html # Use as starting point
# Replace with your custom HTML
# Keep same element IDsStep 3: Build your design
- Use any CSS framework (Tailwind, Bootstrap, etc.)
- Add animations, transitions, icons
- Make it beautiful!
Step 4: Test
- Load extension in Chrome
- Verify all buttons/inputs work
- Test all states (API key setup, selection, modification)
See: docs/DOM_CONTRACT.md for complete guide
Components:
- Popup (
popup.js) - State machine, message coordinator - Content Script (
content.js) - Element selection, DOM manipulation - Service Worker (
service-worker.js) - Claude API handler - Utils (
api.js,dom-parser.js) - Shared utilities
Message Flow:
User β popup.js β content.js β service-worker.js β Claude API
β
User β popup.js β content.js β service-worker.js β Response
Step 1: Understand the system
docs/BACKEND_ARCHITECTURE.md # Read first
docs/IMPLEMENTATION_DETAILS.md # Deep dive
docs/MESSAGE_PROTOCOL.md # All message typesStep 2: Find what you need to modify
src/README.md # Source code guide
# Each folder has its own READMEStep 3: Make changes and test
# Modify code
# Load extension in Chrome
# Test in browser DevTools| Document | For | Purpose |
|---|---|---|
| docs/INDEX.md | Everyone | Documentation navigation |
| docs/README.md | Everyone | Documentation overview |
| docs/BACKEND_ARCHITECTURE.md | Backend devs | System architecture |
| docs/IMPLEMENTATION_DETAILS.md | Backend devs | Technical implementation |
| docs/MESSAGE_PROTOCOL.md | Backend devs | Message specifications |
| docs/DOM_CONTRACT.md | UI devs | UI integration guide |
Each source folder has its own README:
src/README.md- Source code overviewsrc/background/README.md- Service workersrc/content/README.md- Content scriptssrc/popup/README.md- Popup logic & UIsrc/utils/README.md- Utilities
# Chrome browser (latest)
# Anthropic API key
# Text editor (VS Code recommended)# 1. Clone repository
git clone <repository-url>
cd Polish
# 2. No build process needed (vanilla JavaScript)
# 3. Load in Chrome as described aboveLoad extension:
chrome://extensions/
β Developer mode ON
β Load unpacked
β Select Polish folderView logs:
# Popup logs:
Right-click popup β Inspect β Console
# Service worker logs:
chrome://extensions/ β Polish β "service worker" link
# Content script logs:
Page DevTools β Console (filter for "Polish")Debug mode:
In popup.js line 19, set:
const DEBUG_MODE = true; // Verbose loggingβ Element Selection
- Visual highlighting (blue hover, green selected)
- Click any element to select
- Safe element validation
β Natural Language Modifications
- Type requests in plain English
- Claude AI processes and generates code
- CSS and HTML modifications supported
β State Management
- Professional state machine (8 states)
- Handles popup lifecycle
- Race condition prevention
β Error Handling
- Comprehensive error recovery
- User-friendly error messages
- Network timeout handling
β Keyboard Shortcuts
- Enter: Save API key
- Ctrl+Enter: Submit modification
- Escape: Cancel selection mode
β Security
- XSS protection (HTML sanitization)
- Safe element validation
- API key encryption (via Chrome storage)
β³ Modification persistence β³ Undo/redo functionality β³ Multi-element selection β³ Modification templates β³ Export as CSS file β³ Collaborative sharing
Required: Anthropic API key
Get one: https://console.anthropic.com/settings/keys
Set in extension:
- Click extension icon
- Enter key (starts with
sk-ant-) - Click "Save"
Storage: chrome.storage.local (encrypted by Chrome)
Required permissions (in manifest.json):
activeTab- Access current tabstorage- Store API keyscripting- Inject scripts<all_urls>- Work on any website
Extension won't load:
- Check Chrome version (need latest)
- Verify all files exist
- Check for syntax errors in console
"No active tab found":
- Refresh the page
- Make sure you're on a regular webpage (not chrome:// pages)
"Could not establish connection":
- Content script not loaded yet
- Refresh page and try again
"API rate limit exceeded":
- Wait a few moments
- Claude API has rate limits
- Try again shortly
Modifications not applying:
- Check DevTools console for errors
- Verify element is still on page
- Check Claude's response in service worker logs
Check documentation:
docs/IMPLEMENTATION_DETAILS.md- Debugging tipsdocs/MESSAGE_PROTOCOL.md- Error handling
Enable debug logging:
// In popup.js line 19:
const DEBUG_MODE = true;See CONTRIBUTING.md for development guidelines.
Quick guide:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Backend changes: Follow state machine pattern, add tests UI changes: Keep element IDs, test with popup.js
MIT License - See LICENSE file for details
Backend/Infrastructure: Backend team UI/Design: Cofounder AI Integration: Claude 3.5 Sonnet (Anthropic)
- Anthropic for Claude AI
- Chrome Extension Docs
- Our users and testers
Questions?
- Read docs/INDEX.md for navigation
- Check folder READMEs
- Open an issue
Current Status: Backend complete β | UI in progress β³ | Ready for deployment π
Version: 0.1.0 Last Updated: 2025-11-01 Status: Beta