|
| 1 | +# Claude AI Assistant Rules |
| 2 | + |
| 3 | +Guidelines for AI-assisted development in this codebase. |
| 4 | + |
| 5 | +## Code Style & Formatting |
| 6 | + |
| 7 | +- **Biome** for linting and formatting |
| 8 | + - Single quotes |
| 9 | + - 2 space indentation |
| 10 | + - 100 character line width |
| 11 | + - Auto-format on save |
| 12 | +- **TypeScript** strict mode |
| 13 | +- **Pure functions** preferred for testability (extract to `utils/`) |
| 14 | + |
| 15 | +## UI Component Guidelines |
| 16 | + |
| 17 | +- **Use shadcn UI components** (Alert, Button, Dialog, Select, Switch, etc.) |
| 18 | +- **Use Lucide icons** for all iconography |
| 19 | +- **Extract stateless components** for reusability |
| 20 | +- Consistent Tailwind CSS styling |
| 21 | + |
| 22 | +## Architecture Patterns |
| 23 | + |
| 24 | +- **SDK Kit plugin architecture** for background service worker |
| 25 | +- **Pure functions** in `utils/` for testability |
| 26 | +- **React hooks** for state management (no external state library) |
| 27 | +- **Separation of concerns:** |
| 28 | + - `background/` - Service worker with SDK Kit plugins |
| 29 | + - `panel/` - Side panel UI |
| 30 | + - `popup/` - Popup UI |
| 31 | + - `options/` - Options page UI |
| 32 | + - `shared/` - Shared types and utilities |
| 33 | + |
| 34 | +## Chrome Extension Specifics |
| 35 | + |
| 36 | +- **Manifest V3** patterns |
| 37 | +- **`declarativeNetRequest`** API for header injection |
| 38 | +- **Priority-based rule ordering** using pattern specificity |
| 39 | +- **Storage:** |
| 40 | + - `chrome.storage.sync` for rules (synced across devices) |
| 41 | + - `chrome.storage.local` for stats (device-specific) |
| 42 | +- **⚠️ CRITICAL: New changes must NOT affect permissions** |
| 43 | + - Adding new permissions requires Chrome Web Store review |
| 44 | + - Check `manifest.json` before making changes that might require new permissions |
| 45 | + - If permissions are needed, discuss first before implementing |
| 46 | + |
| 47 | +## Testing Guidelines |
| 48 | + |
| 49 | +- **Vitest** for unit tests |
| 50 | +- **Test pure functions** - extract to `utils/` for testability |
| 51 | +- **Mock Chrome APIs** in `tests/setup.ts` |
| 52 | +- **Colocate tests** with source files (`.test.ts`) |
| 53 | + |
| 54 | +## Git & Versioning |
| 55 | + |
| 56 | +- **Conventional commits** (feat, fix, docs, refactor, test, chore) |
| 57 | +- **Manual versioning** (no changesets yet - will add when auto-deploying to Chrome Web Store) |
| 58 | +- **Ask before performing git actions** (user preference) |
| 59 | + |
| 60 | +## Code Review Checklist |
| 61 | + |
| 62 | +Before submitting code, ensure: |
| 63 | +- ✅ Pure functions extracted for testability |
| 64 | +- ✅ Uses shadcn UI components |
| 65 | +- ✅ Uses Lucide icons (not emojis) |
| 66 | +- ✅ Tests added for new functionality |
| 67 | +- ✅ No new permissions required (check `manifest.json`) |
| 68 | +- ✅ TypeScript types are correct |
| 69 | +- ✅ Follows existing patterns and conventions |
| 70 | + |
0 commit comments