# SKILLS.md — Reusable Agent Skills & Patterns for HOR EYE US ## Core Extension Patterns ### 1. Shadow DOM Floating HUD (CSS-Isolated) Always wrap injected panels or buttons in Shadow DOM so website stylesheets cannot distort them: ```js const host = document.createElement("div"); host.setAttribute("data-prowseir-ext", prowseirExt.id); const shadow = host.attachShadow({ mode: "open" }); // use 'closed' for vaults/secrets ``` ### 2. Live Teardown (`prowseirExt.onCleanup`) When a user toggles an extension OFF in **Settings -> Extensions**, HOR EYE US runs `onCleanup` callbacks immediately without reloading the tab: ```js prowseirExt.onCleanup(() => { window.removeEventListener("keydown", onKey); host.remove(); delete window.__myExtMounted; }); ``` ### 3. Reacting to Browser Theme Changes Read initial theme via `window.__PROWSEIR_THEME__` and listen for live updates: ```js window.addEventListener("prowseir-theme-change", (ev) => { const theme = ev.detail && ev.detail.theme; // re-tint Shadow DOM CSS custom properties }); ``` ### 4. Client-Side Cryptography (`crypto.subtle`) For secret storage (`VaultGuard`-style tools): - Derive key with `PBKDF2` (`SHA-256`, `>= 100000` iterations, random 16-byte salt). - Encrypt with `AES-GCM` (random 12-byte IV per record). - Never persist raw master passphrases. ### 5. Automated Build & Verification Loop ```bash node build_pext.js init my-tool "My Tool" "*" node build_pext.js validate dist/my-tool.pext node build_pext.js test dist/my-tool.pext node build_pext.js pack dist/my-tool.pext dist/my-tool.json ```