This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Summarize Web is a browser web extension (Chrome/Firefox) that allows users to quickly summarize web content using AI services (Venice.ai, ChatGPT, Claude, and Mistral). The extension provides context menu integration and content scripts for different platforms.
npm install # Install dependencies
npm run build # Build the extension (~30 seconds)
npm run dev # Development mode with file watching
npm run format # Format all files using Biome
npm run lint # Check for linting/formatting issuesAfter npm run build, verify these files exist in dist/:
- background.js
- contentScript_chatgpt.js, contentScript_claude.js, contentScript_mistral.js, contentScript_venice.js
- contentScript_pageContent.js, contentScript_youtube.js
- manifest.json
- icons/ directory
- User Action: Right-click context menu triggers in any web page
- Background Script (
background.ts): Handles context menu creation and routing - Content Extraction: Sends
GET_CONTENTmessage to active tab's content script - Content Scripts: Extract content based on page type (YouTube vs. regular web page)
- AI Platform Integration: Opens AI platform tab and sends
ACTION_SUMMARIZEmessage - Platform Content Scripts: Inject prompt and content into AI platform's UI
- Platform Integration Scripts: Inject content into AI platforms (venice, claude, chatgpt, mistral)
- Each implements the same pattern: receive message, update editor, upload file attachment, submit
- Platform-specific selectors for finding editor elements and submit buttons
- Content Extraction Scripts:
contentScript_pageContent.ts: Extracts content from regular web pages using Mozilla ReadabilitycontentScript_youtube.ts: Extracts YouTube-specific content (transcripts, video info)
manifest.json: Extension manifest with content script URL patternsbackground.ts: Context menu creation and message routingtypes.ts: Zod schemas for runtime validation of messages (GET_CONTENT,ACTION_SUMMARIZE)utils.ts: Common utilities (querySelectorAsync,waitFor,openTab,getTabId)dom-utils.ts: DOM manipulation utilities for simulating file uploadsprompt.ts: Standardized AI summarization prompt template
- Build: Vite with vite-plugin-web-extension
- Language: TypeScript (ESM modules)
- Extension API: webextension-polyfill for cross-browser compatibility
- Content Extraction: @mozilla/readability for web page parsing
- Validation: Zod for runtime type checking
- Linting/Formatting: Biome
- This project has NO automated test framework
- Extension requires browser environment for full functionality testing
- In sandboxed environments, only validate build processes and code structure
- Manual testing requires loading unpacked extension in Chrome/Firefox Developer Mode
- Always run
npm run formatbefore committing - Only run Biome on
src/directory, never ondist/(autogenerated files) - Ensure
npm run buildsucceeds before submitting changes
- All platform content scripts use similar structure: receive message → update editor → upload file → submit
- Content extraction uses
GET_CONTENTmessage, AI injection usesACTION_SUMMARIZEmessage - DOM manipulation utilities handle file upload simulation for platforms requiring file attachments
querySelectorAsyncandwaitForutilities handle asynchronous DOM interactions
- Permissions:
contextMenus,downloads - Content scripts match specific AI platform URLs
- General content script matches all HTTP/HTTPS except YouTube
- Separate YouTube content script for video-specific handling