Guidelines for AI agents working on this codebase.
Vue 3 + Vite browser extension (Manifest V3) supporting Chrome, Firefox, and Edge.
npm run dev:chrome # Development for Chrome
npm run dev:firefox # Development for Firefox
npm run build # Production build for both browsers
npm run lint # ESLint with auto-fix
npm run typecheck # TypeScript type checking
npm run format # Format with Prettier- TypeScript: Strict mode enabled. Avoid
anytype. - Vue: Use
<script setup lang="ts">syntax. - Semicolons: No semicolons (Prettier config).
- Quotes: Double quotes (Prettier config).
- Trailing commas: Always (Prettier config).
- Indentation: 2 spaces, no tabs.
- Console: Use
console.info,console.warn, orconsole.error(notconsole.log).
src/background/- Service worker (extension lifecycle)src/content-script/- DOM injection, page interactionsrc/ui/action-popup/- Browser action popupsrc/ui/options-page/- Extension options pagesrc/ui/side-panel/- Chrome side panelsrc/ui/devtools-panel/- DevTools panelsrc/ui/setup/- Install/update wizardsrc/offscreen/- Offscreen documents
src/components/- Reusable Vue componentssrc/composables/- Vue composables (hooks)src/stores/- Pinia state storessrc/utils/- Utility functionssrc/types/- TypeScript definitions
UI pages auto-register from src/ui/<context>/pages/. Create .vue files there to add routes.
- Use PascalCase for component files:
MyComponent.vue - Place shared components in
src/components/ - Context-specific components stay in their UI folder
- Prefix with
use:useTheme.ts,useBrowserStorage.ts - Export functions as named exports
- Suffix with
.store.ts:options.store.ts - Use Pinia with Composition API style
- Auto-imports enabled for Vue functions, stores, and components
- Use
~/for project root imports - Use
src/for src-relative imports
- Run
npm run lint- Fix all errors - Run
npm run typecheck- No type errors - Test in both Chrome and Firefox if making cross-browser changes
- Use
chrome.*APIs directly (types fromchrome-types) - For cross-browser compatibility, use
webextension-polyfill
- Use Pinia stores for global state
- Use
useBrowserStoragecomposable for persistent storage synced withchrome.storage - Use
useBrowserLocalStoragefor local-only persistent storage
- Use
webext-bridgefor messaging between extension contexts - Background script handles events and coordinates between contexts