[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6994PK0F14788E5DJ6S2APG":3,"skill-same:01M6994PK0F14788E5DJ6S2APG":132},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":17,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M6994PK0F14788E5DJ6S2APG","frontend-design","Capsem 前端界面设计","Capsem frontend design system. Use when building UI components, styling views, choosing colors, or working with Svelte 5 runes and the component library.","Capsem 前端设计系统。在构建 UI 组件、为视图设置样式、选择配色，或使用 Svelte 5 runes 和组件库时使用。","google\u002Fcapsem","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M69939YZJTP726NQK4NZNB48",186,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQMKHSMFVQHR2KYAEVN","界面设计师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRASNPVNJVQQJ4KZX8XM5D","前端开发与界面实现","SCENARIO","使用场景",[31,32,33],"frontend","design","frontend design","2026-11-10 10:12:30",false,"---\nname: frontend-design\ndescription: Capsem frontend design system. Use when building UI components, styling views, choosing colors, or working with Svelte 5 runes and the component library.\n---\n\n# Frontend Design\n\n## Stack\n\n- **Astro 7** -- static site generator, renders `index.astro` as a thin shell\n- **Svelte 5** -- reactive UI framework, loaded via `client:only=\"svelte\"`\n- **Tailwind v4** -- utility-first CSS (via Vite plugin, `@source` directives in `global.css`)\n- **Capsem-owned semantic CSS** -- `src\u002Fstyles\u002Fcapsem-theme.css` owns the complete token contract (`bg-primary`, `text-foreground`, and peers). Production code must never install, import, scan, or execute Preline or another component library. Historical component references may inspire class composition only; copy the result into Capsem-owned code.\n\n## Loading into capsem-app (Tauri)\n\n`tauri::generate_context!()` bakes `web\u002Fapp\u002Fdist\u002F**` into the `capsem-app` binary at cargo compile time (via the `custom-protocol` feature). This means:\n\n- `pnpm run build` alone has **no effect** on a running `.\u002Fcache\u002Ftarget\u002F**\u002Fcapsem-app` -- the bundle is embedded in the binary.\n- After any `web\u002Fapp\u002F` change you intend to test in the desktop app, run `just build` (chains frontend build + `cargo build -p capsem-app`).\n- `just dev ui` (`cargo tauri dev`) bypasses this by loading `http:\u002F\u002Flocalhost:5173` -- good for iteration, but the production code path goes through the embedded bundle.\n- The Toolbar shows `build YYYY-MM-DD HH:MM:SS` as a quick visual sanity check -- if it's stale after you rebuilt, you forgot `cargo build -p capsem-app`.\n\nAlso: iframe `src` for bundled pages **must end in `index.html`** (e.g. `\u002Fvm\u002Fterminal\u002Findex.html`). Tauri's custom protocol on macOS does not auto-append `index.html` for trailing-slash paths the way Vite\u002FAstro dev server does. A `\u002Fvm\u002Fterminal\u002F` src loads fine in Chrome dev mode and silently 404s in the Tauri app.\n\n## Design principles\n\n**Simplicity and correctness above all else.** Every line of frontend code must earn its place.\n\n- Capsem-owned semantic tokens for theming + Tailwind utilities for layout\n- All interactivity via Svelte 5 runes + TypeScript -- no JS plugins, no jQuery, no framework plugins\n- Custom `@theme` tokens in `global.css` for domain-specific colors (status, providers, charts)\n- **Visual verification required** -- every UI change must be verified via Chrome DevTools MCP (see `\u002Fdev-testing-frontend`)\n- **No component-library dependency** -- do not add Preline, DaisyUI, or an equivalent package to production or build dependencies.\n\n## Framework references\n\n- `references\u002Fpreline.md` and `references\u002Fpreline-docs\u002F` are historical pattern catalogues only. Their upstream install\u002Fimport examples are forbidden in Capsem; the checked-in theme and Svelte components are authoritative.\n- Read `references\u002Ftailwind.md` for Tailwind v4 utility patterns, responsive design, and CSS-first config.\n- Read `references\u002Fsvelte5.md` for Svelte 5 patterns and `@sveltejs\u002Fmcp` CLI doc lookups.\n- Read `references\u002Fastro.md` for Astro framework patterns (components, content collections, SSR).\n\n## Surface hierarchy (global.css overrides)\n\nThe UI uses a two-tone surface system. Semantic token names map to specific roles:\n\n| Token | Light | Dark | Role |\n|-------|-------|------|------|\n| `--background` | `#ffffff` (white) | `#282828` (rgb 40,40,40) | Main canvas (content area) |\n| `--background-1` | `#f4f3f2` (rgb 244,243,242) | `#282828` | Recessed (address bar, inset panels) |\n| `--background-2` | `#f4f3f2` | `#282828` | Most recessed (inactive tabs) |\n| `--layer` | `#ffffff` (white) | `#3c3c3c` (rgb 60,60,60) | Elevated\u002Fselected (active tab, toolbar, cards) |\n\nThe pattern: **selected = white\u002Flighter, inactive = slightly gray\u002Fdarker**. In dark mode, the base is very dark (#282828) and elevated surfaces pop with #3c3c3c. In light mode, the canvas is white and recessed areas use a warm off-white.\n\nThese are set in `:root` and `.dark` blocks in `global.css`. All accent themes share the same surfaces -- only `--primary-*` changes per accent.\n\n## Color scheme (firm -- do not deviate)\n\n- **Blue** = main\u002Fpositive color (allowed, running, ok states). Use Capsem `primary` tokens (`bg-primary`, `text-primary-foreground`, etc.)\n- **Purple** = negative color (denied, stopped, error states). Keep the owned `destructive` tokens purple, not red.\n- **No green or red anywhere in the UI** -- use blue for positive, purple for negative\n- Chart colors: blue `oklch(0.7 0.15 250)` for allowed, purple `oklch(0.65 0.15 300)` for denied\n- Terminal emulation colors (xterm #4ade80 green) are fine -- that's xterm, not UI chrome\n- **Do NOT hardcode colors in components.** Change the owned semantic contract in `capsem-theme.css` or the deliberate surface\u002Faccent overrides in `global.css`; theme selection uses `data-theme` on `\u003Chtml>`.\n\n## Terminal theme contrast\n\nAll 24 terminal themes (12 families x dark\u002Flight) must pass WCAG AA 4.5:1 contrast ratio for foreground text and all 6 ANSI colors (red, green, yellow, blue, magenta, cyan) against their background. This is enforced by `theme-contrast.test.ts`.\n\nContrast utilities (`parseHex`, `relativeLuminance`, `contrastRatio`) are exported from `themes.ts` and used in tests. When adding or modifying terminal themes, run `pnpm test` to catch any violations.\n\n## Component patterns\n\nUse Capsem's semantic token classes for all UI components. Historical pattern references may guide layout, but no upstream CSS or JavaScript may enter the build.\n\n- **Buttons**: `bg-primary text-primary-foreground hover:bg-primary-hover` (solid), `bg-layer border border-layer-line text-layer-foreground` (white), etc.\n- **Cards**: `bg-card border border-card-line rounded-xl`, headers `bg-surface border-b border-card-divider`\n- **Forms**: `border-line-2 rounded-lg bg-layer text-foreground focus:border-primary focus:ring-primary`\n- **Navigation**: `bg-navbar border-navbar-border text-navbar-nav-foreground hover:bg-navbar-nav-hover`\n- **Overlays**: `bg-overlay border-overlay-border`, `bg-dropdown text-dropdown-item-foreground`\n- **Text hierarchy**: `text-foreground` (primary), `text-muted-foreground-1` (secondary), `text-muted-foreground` (tertiary)\n- **Errors**: `text-destructive-text` on neutral surfaces; `text-destructive-foreground` over solid `bg-destructive` buttons or badges.\n\nDo NOT use raw Tailwind colors (`bg-gray-200`, `text-blue-600`) for UI chrome. Always use semantic tokens so themes work.\n\n### Settings section layout (SettingsSection.svelte)\n\nThe Appearance section in `SettingsPage.svelte` is the reference pattern. All dynamic settings sections must match it:\n\n- **Section title**: `\u003Ch2 class=\"text-xl font-medium text-foreground\">` (not `font-bold`)\n- **Subsection headings**: `\u003Ch3 class=\"text-xs font-semibold text-foreground uppercase tracking-wider\">` (use `text-foreground`, not `text-muted-foreground-1`)\n- **Cards wrap leaf items only**: A non-toggle group wraps children in `bg-card border border-card-line rounded-xl` ONLY when it has direct leaf\u002Faction children. Groups containing only subgroups render flat (heading + children, no card). This prevents nested grey card boxes.\n- **Leaf padding**: All leaf items inside cards use `px-4` for horizontal padding, matching the Appearance rows.\n- **Toggle-gated groups**: Standalone cards with `bg-card border border-card-line rounded-xl mb-3`. Never nest inside another card wrapper.\n- **Warning\u002Ferror colors**: Use `text-warning` \u002F `text-destructive` and `bg-warning\u002F5` \u002F `bg-destructive\u002F10`. Never raw Tailwind colors (`text-amber-700`, `text-red-700`, `bg-amber-50`).\n\n## Custom design tokens (`global.css`)\n\nDomain-specific tokens defined in `@theme { }` block:\n\n| Category | Tokens | Purpose |\n|----------|--------|---------|\n| Status | `--color-allowed`, `--color-denied`, `--color-caution` | Decision states |\n| Providers | `--color-provider-anthropic`, `-google`, `-openai`, `-mistral` | Brand identity |\n| Token types | `--color-token-input`, `-output`, `-cache` | Usage tracking |\n| File actions | `--color-file-created`, `-modified`, `-deleted` | FS events |\n| Syntax | `--color-json-*`, `--color-sh-*` | Code highlighting |\n| Spans | `--color-span-thinking`, `-tool`, `-answer` | Trace viewer |\n| Charts | `--color-chart-grid`, `-label` | Chart infrastructure |\n\n## Svelte 5 rune patterns (mandatory -- no legacy `$:`)\n\nAll components and stores use Svelte 5 runes exclusively. No legacy reactive statements.\n\n- `$state\u003CT>(initial)` -- reactive state declaration\n- `$derived(expression)` -- derived value (recomputes when deps change)\n- `$derived.by(() => { ... })` -- derived with complex logic\n- `$effect(() => { ... })` -- side effect that re-runs on dependency changes\n- `$props()` -- type-safe component props with destructuring\n- Class-based stores with `$state` fields (singleton pattern, `.svelte.ts` extension)\n- `onMount` for async data loading, `onDestroy` for cleanup (intervals, charts)\n\n### Store pattern\n\n```typescript\n\u002F\u002F stores\u002Fexample.svelte.ts\nclass ExampleStore {\n  items = $state\u003CItem[]>([]);\n  activeId = $state\u003Cstring | null>(null);\n  active = $derived(this.items.find(i => i.id === this.activeId));\n\n  async load() { this.items = await api.getItems(); }\n  setActive(id: string) { this.activeId = id; }\n}\nexport const exampleStore = new ExampleStore();\n```\n\n### Icon pattern\n\n```svelte\n\u003Cscript lang=\"ts\">\n  let { class: cls = 'size-5' }: { class?: string } = $props();\n\u003C\u002Fscript>\n\u003Csvg class={cls}>...\u003C\u002Fsvg>\n```\n\n## View routing\n\nChrome browser shell. Tabs = sessions, toolbar = controls. Views switched by `tabStore.active.view`:\n\n- `'new-tab'` -- session dashboard (NewTabPage), sortable table of real sessions\n- `'terminal'` -- sandboxed iframe with xterm.js (VMFrame), one iframe per VM\n- `'settings'` -- appearance, general, security, network, storage, advanced, about\n- Future: focused typed views for logs\u002Fdebug surfaces as needed.\n\nTab store (`stores\u002Ftabs.svelte.ts`): `openVM()` creates a terminal tab or activates existing.\n\n## Data fetching\n\nThe frontend talks to the backend through **capsem-gateway** -- a TCP-to-UDS reverse proxy (default port 19222) that forwards HTTP requests to capsem-service over UDS. Bearer token auth is required (token generated at gateway startup, written to `~\u002F.capsem\u002Frun\u002Fgateway.token`).\n\nKey gateway endpoints:\n\n| Endpoint | Purpose |\n|----------|---------|\n| `GET \u002F` | Health check (no auth) |\n| `GET \u002Fstatus` | Aggregated VM status (1s cache TTL) |\n| `GET \u002Fvms\u002F{id}\u002Fstream` | `capsem.stream.v3` WebSocket (terminal, streaming exec, container attach), tunneled to the service |\n| Explicit allowlist | Settings, session, stats, enforcement, detection, plugin, MCP, credential, and debug routes used by the UI\u002FTUI |\n\nThe gateway forwards only routes that are deliberately registered in its route table.\nUnknown, retired, or misspelled routes must return 404 instead of falling through to\ncapsem-service.\n\nTyped data contract:\n\n- **Per-session telemetry**: use typed routes such as `\u002Fvms\u002F{id}\u002Fstats\u002Fdetail`,\n  `\u002Fvms\u002F{id}\u002Ftimeline`, `\u002Fvms\u002F{id}\u002Fsecurity\u002Flatest`,\n  `\u002Fvms\u002F{id}\u002Fdetection\u002Flatest`, and protocol-specific routes.\n- **Cross-session state**: use dedicated service routes such as `\u002Fstatus`,\n  `\u002Fstats`, `\u002Fvms\u002Flist`, and settings\u002Fplugin\u002FMCP routes.\n- **Never add frontend raw SQL helpers**. The old Inspector and `\u002Finspect`\n  surfaces are burned; UI code reflects typed API contracts only.\n\nMocks must exercise the same typed routes the product uses.\n\n## Code reuse\n\nBefore creating new components, stores, or helpers, check what exists:\n- **Stores** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fstores\u002F`): extend existing rune stores\n- **Components** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fcomponents\u002F`): extend existing patterns\n- **Views** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fviews\u002F`): main view containers with sub-views\n- **Models** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fmodels\u002F`): pure TS business logic (no Svelte deps)\n- **Helpers** (`api.ts`, `types.ts`): use existing typed route clients, formatters, and types\n","# Frontend Design\n\n## Stack\n\n- **Astro 7** -- static site generator, renders `index.astro` as a thin shell\n- **Svelte 5** -- reactive UI framework, loaded via `client:only=\"svelte\"`\n- **Tailwind v4** -- utility-first CSS (via Vite plugin, `@source` directives in `global.css`)\n- **Capsem-owned semantic CSS** -- `src\u002Fstyles\u002Fcapsem-theme.css` owns the complete token contract (`bg-primary`, `text-foreground`, and peers). Production code must never install, import, scan, or execute Preline or another component library. Historical component references may inspire class composition only; copy the result into Capsem-owned code.\n\n## Loading into capsem-app (Tauri)\n\n`tauri::generate_context!()` bakes `web\u002Fapp\u002Fdist\u002F**` into the `capsem-app` binary at cargo compile time (via the `custom-protocol` feature). This means:\n\n- `pnpm run build` alone has **no effect** on a running `.\u002Fcache\u002Ftarget\u002F**\u002Fcapsem-app` -- the bundle is embedded in the binary.\n- After any `web\u002Fapp\u002F` change you intend to test in the desktop app, run `just build` (chains frontend build + `cargo build -p capsem-app`).\n- `just dev ui` (`cargo tauri dev`) bypasses this by loading `http:\u002F\u002Flocalhost:5173` -- good for iteration, but the production code path goes through the embedded bundle.\n- The Toolbar shows `build YYYY-MM-DD HH:MM:SS` as a quick visual sanity check -- if it's stale after you rebuilt, you forgot `cargo build -p capsem-app`.\n\nAlso: iframe `src` for bundled pages **must end in `index.html`** (e.g. `\u002Fvm\u002Fterminal\u002Findex.html`). Tauri's custom protocol on macOS does not auto-append `index.html` for trailing-slash paths the way Vite\u002FAstro dev server does. A `\u002Fvm\u002Fterminal\u002F` src loads fine in Chrome dev mode and silently 404s in the Tauri app.\n\n## Design principles\n\n**Simplicity and correctness above all else.** Every line of frontend code must earn its place.\n\n- Capsem-owned semantic tokens for theming + Tailwind utilities for layout\n- All interactivity via Svelte 5 runes + TypeScript -- no JS plugins, no jQuery, no framework plugins\n- Custom `@theme` tokens in `global.css` for domain-specific colors (status, providers, charts)\n- **Visual verification required** -- every UI change must be verified via Chrome DevTools MCP (see `\u002Fdev-testing-frontend`)\n- **No component-library dependency** -- do not add Preline, DaisyUI, or an equivalent package to production or build dependencies.\n\n## Framework references\n\n- `references\u002Fpreline.md` and `references\u002Fpreline-docs\u002F` are historical pattern catalogues only. Their upstream install\u002Fimport examples are forbidden in Capsem; the checked-in theme and Svelte components are authoritative.\n- Read `references\u002Ftailwind.md` for Tailwind v4 utility patterns, responsive design, and CSS-first config.\n- Read `references\u002Fsvelte5.md` for Svelte 5 patterns and `@sveltejs\u002Fmcp` CLI doc lookups.\n- Read `references\u002Fastro.md` for Astro framework patterns (components, content collections, SSR).\n\n## Surface hierarchy (global.css overrides)\n\nThe UI uses a two-tone surface system. Semantic token names map to specific roles:\n\n| Token | Light | Dark | Role |\n|-------|-------|------|------|\n| `--background` | `#ffffff` (white) | `#282828` (rgb 40,40,40) | Main canvas (content area) |\n| `--background-1` | `#f4f3f2` (rgb 244,243,242) | `#282828` | Recessed (address bar, inset panels) |\n| `--background-2` | `#f4f3f2` | `#282828` | Most recessed (inactive tabs) |\n| `--layer` | `#ffffff` (white) | `#3c3c3c` (rgb 60,60,60) | Elevated\u002Fselected (active tab, toolbar, cards) |\n\nThe pattern: **selected = white\u002Flighter, inactive = slightly gray\u002Fdarker**. In dark mode, the base is very dark (#282828) and elevated surfaces pop with #3c3c3c. In light mode, the canvas is white and recessed areas use a warm off-white.\n\nThese are set in `:root` and `.dark` blocks in `global.css`. All accent themes share the same surfaces -- only `--primary-*` changes per accent.\n\n## Color scheme (firm -- do not deviate)\n\n- **Blue** = main\u002Fpositive color (allowed, running, ok states). Use Capsem `primary` tokens (`bg-primary`, `text-primary-foreground`, etc.)\n- **Purple** = negative color (denied, stopped, error states). Keep the owned `destructive` tokens purple, not red.\n- **No green or red anywhere in the UI** -- use blue for positive, purple for negative\n- Chart colors: blue `oklch(0.7 0.15 250)` for allowed, purple `oklch(0.65 0.15 300)` for denied\n- Terminal emulation colors (xterm #4ade80 green) are fine -- that's xterm, not UI chrome\n- **Do NOT hardcode colors in components.** Change the owned semantic contract in `capsem-theme.css` or the deliberate surface\u002Faccent overrides in `global.css`; theme selection uses `data-theme` on `\u003Chtml>`.\n\n## Terminal theme contrast\n\nAll 24 terminal themes (12 families x dark\u002Flight) must pass WCAG AA 4.5:1 contrast ratio for foreground text and all 6 ANSI colors (red, green, yellow, blue, magenta, cyan) against their background. This is enforced by `theme-contrast.test.ts`.\n\nContrast utilities (`parseHex`, `relativeLuminance`, `contrastRatio`) are exported from `themes.ts` and used in tests. When adding or modifying terminal themes, run `pnpm test` to catch any violations.\n\n## Component patterns\n\nUse Capsem's semantic token classes for all UI components. Historical pattern references may guide layout, but no upstream CSS or JavaScript may enter the build.\n\n- **Buttons**: `bg-primary text-primary-foreground hover:bg-primary-hover` (solid), `bg-layer border border-layer-line text-layer-foreground` (white), etc.\n- **Cards**: `bg-card border border-card-line rounded-xl`, headers `bg-surface border-b border-card-divider`\n- **Forms**: `border-line-2 rounded-lg bg-layer text-foreground focus:border-primary focus:ring-primary`\n- **Navigation**: `bg-navbar border-navbar-border text-navbar-nav-foreground hover:bg-navbar-nav-hover`\n- **Overlays**: `bg-overlay border-overlay-border`, `bg-dropdown text-dropdown-item-foreground`\n- **Text hierarchy**: `text-foreground` (primary), `text-muted-foreground-1` (secondary), `text-muted-foreground` (tertiary)\n- **Errors**: `text-destructive-text` on neutral surfaces; `text-destructive-foreground` over solid `bg-destructive` buttons or badges.\n\nDo NOT use raw Tailwind colors (`bg-gray-200`, `text-blue-600`) for UI chrome. Always use semantic tokens so themes work.\n\n### Settings section layout (SettingsSection.svelte)\n\nThe Appearance section in `SettingsPage.svelte` is the reference pattern. All dynamic settings sections must match it:\n\n- **Section title**: `\u003Ch2 class=\"text-xl font-medium text-foreground\">` (not `font-bold`)\n- **Subsection headings**: `\u003Ch3 class=\"text-xs font-semibold text-foreground uppercase tracking-wider\">` (use `text-foreground`, not `text-muted-foreground-1`)\n- **Cards wrap leaf items only**: A non-toggle group wraps children in `bg-card border border-card-line rounded-xl` ONLY when it has direct leaf\u002Faction children. Groups containing only subgroups render flat (heading + children, no card). This prevents nested grey card boxes.\n- **Leaf padding**: All leaf items inside cards use `px-4` for horizontal padding, matching the Appearance rows.\n- **Toggle-gated groups**: Standalone cards with `bg-card border border-card-line rounded-xl mb-3`. Never nest inside another card wrapper.\n- **Warning\u002Ferror colors**: Use `text-warning` \u002F `text-destructive` and `bg-warning\u002F5` \u002F `bg-destructive\u002F10`. Never raw Tailwind colors (`text-amber-700`, `text-red-700`, `bg-amber-50`).\n\n## Custom design tokens (`global.css`)\n\nDomain-specific tokens defined in `@theme { }` block:\n\n| Category | Tokens | Purpose |\n|----------|--------|---------|\n| Status | `--color-allowed`, `--color-denied`, `--color-caution` | Decision states |\n| Providers | `--color-provider-anthropic`, `-google`, `-openai`, `-mistral` | Brand identity |\n| Token types | `--color-token-input`, `-output`, `-cache` | Usage tracking |\n| File actions | `--color-file-created`, `-modified`, `-deleted` | FS events |\n| Syntax | `--color-json-*`, `--color-sh-*` | Code highlighting |\n| Spans | `--color-span-thinking`, `-tool`, `-answer` | Trace viewer |\n| Charts | `--color-chart-grid`, `-label` | Chart infrastructure |\n\n## Svelte 5 rune patterns (mandatory -- no legacy `$:`)\n\nAll components and stores use Svelte 5 runes exclusively. No legacy reactive statements.\n\n- `$state\u003CT>(initial)` -- reactive state declaration\n- `$derived(expression)` -- derived value (recomputes when deps change)\n- `$derived.by(() => { ... })` -- derived with complex logic\n- `$effect(() => { ... })` -- side effect that re-runs on dependency changes\n- `$props()` -- type-safe component props with destructuring\n- Class-based stores with `$state` fields (singleton pattern, `.svelte.ts` extension)\n- `onMount` for async data loading, `onDestroy` for cleanup (intervals, charts)\n\n### Store pattern\n\n```typescript\n\u002F\u002F stores\u002Fexample.svelte.ts\nclass ExampleStore {\n  items = $state\u003CItem[]>([]);\n  activeId = $state\u003Cstring | null>(null);\n  active = $derived(this.items.find(i => i.id === this.activeId));\n\n  async load() { this.items = await api.getItems(); }\n  setActive(id: string) { this.activeId = id; }\n}\nexport const exampleStore = new ExampleStore();\n```\n\n### Icon pattern\n\n```svelte\n\u003Cscript lang=\"ts\">\n  let { class: cls = 'size-5' }: { class?: string } = $props();\n\u003C\u002Fscript>\n\u003Csvg class={cls}>...\u003C\u002Fsvg>\n```\n\n## View routing\n\nChrome browser shell. Tabs = sessions, toolbar = controls. Views switched by `tabStore.active.view`:\n\n- `'new-tab'` -- session dashboard (NewTabPage), sortable table of real sessions\n- `'terminal'` -- sandboxed iframe with xterm.js (VMFrame), one iframe per VM\n- `'settings'` -- appearance, general, security, network, storage, advanced, about\n- Future: focused typed views for logs\u002Fdebug surfaces as needed.\n\nTab store (`stores\u002Ftabs.svelte.ts`): `openVM()` creates a terminal tab or activates existing.\n\n## Data fetching\n\nThe frontend talks to the backend through **capsem-gateway** -- a TCP-to-UDS reverse proxy (default port 19222) that forwards HTTP requests to capsem-service over UDS. Bearer token auth is required (token generated at gateway startup, written to `~\u002F.capsem\u002Frun\u002Fgateway.token`).\n\nKey gateway endpoints:\n\n| Endpoint | Purpose |\n|----------|---------|\n| `GET \u002F` | Health check (no auth) |\n| `GET \u002Fstatus` | Aggregated VM status (1s cache TTL) |\n| `GET \u002Fvms\u002F{id}\u002Fstream` | `capsem.stream.v3` WebSocket (terminal, streaming exec, container attach), tunneled to the service |\n| Explicit allowlist | Settings, session, stats, enforcement, detection, plugin, MCP, credential, and debug routes used by the UI\u002FTUI |\n\nThe gateway forwards only routes that are deliberately registered in its route table.\nUnknown, retired, or misspelled routes must return 404 instead of falling through to\ncapsem-service.\n\nTyped data contract:\n\n- **Per-session telemetry**: use typed routes such as `\u002Fvms\u002F{id}\u002Fstats\u002Fdetail`,\n  `\u002Fvms\u002F{id}\u002Ftimeline`, `\u002Fvms\u002F{id}\u002Fsecurity\u002Flatest`,\n  `\u002Fvms\u002F{id}\u002Fdetection\u002Flatest`, and protocol-specific routes.\n- **Cross-session state**: use dedicated service routes such as `\u002Fstatus`,\n  `\u002Fstats`, `\u002Fvms\u002Flist`, and settings\u002Fplugin\u002FMCP routes.\n- **Never add frontend raw SQL helpers**. The old Inspector and `\u002Finspect`\n  surfaces are burned; UI code reflects typed API contracts only.\n\nMocks must exercise the same typed routes the product uses.\n\n## Code reuse\n\nBefore creating new components, stores, or helpers, check what exists:\n- **Stores** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fstores\u002F`): extend existing rune stores\n- **Components** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fcomponents\u002F`): extend existing patterns\n- **Views** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fviews\u002F`): main view containers with sub-views\n- **Models** (`web\u002Fapp\u002Fsrc\u002Flib\u002Fmodels\u002F`): pure TS business logic (no Svelte deps)\n- **Helpers** (`api.ts`, `types.ts`): use existing typed route clients, formatters, and types\n",{"name":5,"description":7},"main","d357170bb677125c80cebed720e62bf47bf083ad","skills\u002Ffrontend-design",26,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 00:49:59",{"source":9,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add google\u002Fcapsem --skill frontend-design",{"tool":54,"command":55},"bunx","bunx skills add google\u002Fcapsem --skill frontend-design",{"tool":57,"command":58},"pnpm","pnpm dlx skills add google\u002Fcapsem --skill frontend-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002FSKILL.md",true,[62,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Fastro.md","REFERENCE","参考文档",4137,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fastro.md",{"path":69,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fpreline-docs\u002Fcomponents-base.md",8747,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fcomponents-base.md",{"path":73,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fpreline-docs\u002Fcomponents-forms.md",5429,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fcomponents-forms.md",{"path":77,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fpreline-docs\u002Fcomponents-layout.md",4261,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fcomponents-layout.md",{"path":81,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fpreline-docs\u002Fcomponents-navigation.md",6442,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fcomponents-navigation.md",{"path":85,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fpreline-docs\u002Fcomponents-overlays.md",5430,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fcomponents-overlays.md",{"path":89,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fpreline-docs\u002Fframework-integration.md",2056,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fframework-integration.md",{"path":93,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fpreline-docs\u002Fjavascript-api.md",5631,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fjavascript-api.md",{"path":97,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Fpreline-docs\u002Fplugins-content.md",9759,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fplugins-content.md",{"path":101,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fpreline-docs\u002Fplugins-forms.md",10124,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fplugins-forms.md",{"path":105,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":106,"sourceHtmlUrl":107},"references\u002Fpreline-docs\u002Fplugins-layout.md",8546,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fplugins-layout.md",{"path":109,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":110,"sourceHtmlUrl":111},"references\u002Fpreline-docs\u002Fplugins-overlays.md",11161,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fplugins-overlays.md",{"path":113,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":114,"sourceHtmlUrl":115},"references\u002Fpreline-docs\u002Ftokens.md",7418,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Ftokens.md",{"path":117,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":118,"sourceHtmlUrl":119},"references\u002Fpreline-docs\u002Fvariants.md",8249,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline-docs\u002Fvariants.md",{"path":121,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":122,"sourceHtmlUrl":123},"references\u002Fpreline.md",7479,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fpreline.md",{"path":125,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":126,"sourceHtmlUrl":127},"references\u002Fsvelte5.md",1982,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Fsvelte5.md",{"path":129,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":130,"sourceHtmlUrl":131},"references\u002Ftailwind.md",5688,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-design\u002Freferences\u002Ftailwind.md",[133,150,166,183,196,208],{"skillNo":134,"name":135,"nameZh":136,"description":137,"descriptionZh":138,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":139,"categories":140,"keywords":147,"publishedAt":34},"01M699558T2T4DJMBN08ZCQ79K","use-capsem","Capsem 虚拟机任务执行","Run tasks in Capsem VMs through MCP. Use when an agent needs isolated execution, file analysis, or reports returned to the host.","通过 MCP 在 Capsem 虚拟机中运行任务。在智能体需要隔离执行、文件分析，或将报告返回到主机时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fuse-capsem\u002FSKILL.md",[141,144],{"categoryNo":142,"categoryName":143,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0DBCRG4XGJMB6QQEP11","编码任务委派",{"categoryNo":145,"categoryName":146,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[148,149],"use capsem","MCP",{"skillNo":151,"name":152,"nameZh":153,"description":154,"descriptionZh":155,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":156,"categories":157,"keywords":164,"publishedAt":34},"01M69953Z1CSVQ4N07QX529CZY","site-marketing","营销网站内容维护","The marketing website, capsem.org. Use when editing copy, adding sections, or changing the site theme.","营销网站 capsem.org。在编辑文案、添加板块或更改网站主题时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-marketing\u002FSKILL.md",[158,161],{"categoryNo":159,"categoryName":160,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD6C0J544QTJ9R38Z7ZG","营销专员",{"categoryNo":162,"categoryName":163,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQV98WRP4APE9VKKKKJ6FV","社交媒体与内容平台管理",[165],"site marketing",{"skillNo":167,"name":168,"nameZh":169,"description":170,"descriptionZh":171,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":172,"categories":173,"keywords":180,"publishedAt":34},"01M69952B33KBBV37N8QTC4191","site-infra","文档站基础设施维护","The documentation site, docs.capsem.org. Use for user-directed Diátaxis documentation and Astro Starlight changes.","文档站点 docs.capsem.org。用于面向用户的 Diátaxis 文档和 Astro Starlight 相关更改。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-infra\u002FSKILL.md",[174,177],{"categoryNo":175,"categoryName":176,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":178,"categoryName":179,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",[181,182],"site infra","docs",{"skillNo":184,"name":185,"nameZh":186,"description":17,"descriptionZh":187,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":188,"categories":189,"keywords":194,"publishedAt":34},"01M69950YKCZKCDB98JDQNBBRJ","site-architecture","站点架构设计","","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-architecture\u002FSKILL.md",[190,193],{"categoryNo":191,"categoryName":192,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TKQDF2K4KQS863Q79P4","开发参考",{"categoryNo":178,"categoryName":179,"taxonomyType":23,"taxonomyTypeDesc":24},[195],"site architecture",{"skillNo":197,"name":198,"nameZh":199,"description":17,"descriptionZh":187,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":200,"categories":201,"keywords":206,"publishedAt":34},"01M6994Z61JWZ0G2YRJTWFH933","release-process","版本发布流程","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Frelease-process\u002FSKILL.md",[202,203],{"categoryNo":178,"categoryName":179,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":204,"categoryName":205,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQNXPY1AV6BSR5VKHDMWRH","部署与发布管理",[207],"release process",{"skillNo":209,"name":210,"nameZh":211,"description":212,"descriptionZh":213,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":214,"categories":215,"keywords":220,"publishedAt":34},"01M6994XKHADM6FBTYTAPG7FYC","meta-skill-creation","智能体技能创建与优化","Create, improve, and evaluate skills. Use when writing a new skill, editing an existing one, or tuning a description for better triggering.","创建、改进和评估技能。在编写新技能、编辑现有技能或调整 description 以优化触发效果时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fmeta-skill-creation\u002FSKILL.md",[216,219],{"categoryNo":217,"categoryName":218,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":145,"categoryName":146,"taxonomyType":23,"taxonomyTypeDesc":24},[221,222],"meta skill creation","writing"]