browser-preview
БесплатноБез исполняемых скриптовНе проверенPreview panel and iframe diagnostics: registry, ports, paths, blank screens. Use when a preview tab is broken or missing (e.g. white screen, tab disappeared…
от Starchild-ai-agent★ 34 звезды на GitHubОб этом скилле
Browser Preview
You already know preview_serve and preview_stop. This skill fills the gap: what happens after preview_serve returns a URL — how the user actually sees it.
What is the Preview Panel
The frontend has a right-side panel with two tabs: Files and Preview. The Preview tab renders preview URLs inside an iframe. When you call preview_serve, the frontend automatically opens a Preview tab loading that URL. (Jobs are now managed in a standalone modal accessible from the left sidebar, not in the right panel.)
Key facts:
- Each
preview_servecall creates one Preview tab - URL format:
https://<host>/preview/{id}/ - Preview panel has a ⋮ menu (top-right) showing "RUNNING SERVICES" list
- Preview tab can be closed by the user without stopping the backend service
- Backend service stopping → Preview tab shows an error page
⚠️ CRITICAL: Never Tell Users to Access localhost
The user's browser CANNOT access localhost or 127.0.0.1. These addresses point to the server container, not the user's machine. The preview architecture uses a reverse proxy:
User's Browser → https://<host>/preview/{id}/path → (reverse proxy) → 127.0.0.1:{port}/path
Rules:
- NEVER tell the user to visit
http://localhost:{port}orhttp://127.0.0.1:{port}— they cannot reach it - ALWAYS direct users to the preview URL:
/preview/{id}/(or the full URLhttps://<host>/preview/{id}/) curl http://localhost:{port}is for your own server-side diagnostics only — never suggest it to the user as a way to "test" the preview- When a preview is running, tell the user: "Check the Preview panel, or refresh the Preview panel"
- If you need to give the user a URL, use the
urlfield returned bypreview_serve(format:/preview/{id}/)
⚠️ Static Assets Must Use Relative Paths
Because previews are served under /preview/{id}/, absolute paths in HTML/JS/CSS will break. The reverse proxy strips the /preview/{id} prefix before forwarding to the backend, but the browser resolves absolute paths from the domain root.
Example of the problem:
<!-- ❌ BROKEN: browser requests https://host/static/app.js → 404 (bypasses preview proxy) -->
<script src="/static/app.js"></script>
<!-- ✅ WORKS: browser requests https://host/preview/{id}/static/app.js → proxied correctly -->
<script src="static/app.js"></script>
<script src="./static/app.js"></script>
Common patterns to fix:
| Broken (absolute) | Fixed (relative) |
|---|---|
"/static/app.js" |
"static/app.js" or "./static/app.js" |
"/api/users" |
"api/users" or "./api/users" |
"/images/logo.png" |
"images/logo.png" or "./images/logo.png" |
url('/fonts/x.woff') |
url('./fonts/x.woff') |
fetch('/data.json') |
fetch('data.json') |
Check ALL places where paths appear:
- HTML
src,hrefattributes - JavaScript
fetch(),XMLHttpRequest, dynamic imports - CSS
url()references - JavaScript string literals (e.g.,
'/static/'in template strings or concatenation) - Framework config files (e.g.,
publicPath,base,assetPrefix)
⚠️ Be thorough — it's common to fix CSS url() but miss JS string literals like '/static/' (with single quotes). Search for ALL occurrences of absolute paths across all file types.
⚠️ Do NOT Browse Filesystem to Debug Previews
Never look at workspace directories like preview/, output/, or random folders to understand preview state. Those are user data, not preview service state.
The only sources of truth:
- Registry file:
/data/previews.json(running services) - History file:
/data/preview_history.json(all past services) preview_serve/preview_stoptools- Port checks via
curl(server-side only, for your diagnostics)
Do NOT use ls/find on workspace directories to diagnose preview issues. Do NOT call unrelated tools like list_scheduled_tasks. Stay focused.
Step-by-Step: Diagnosing Preview Issues
When a user reports any Preview panel problem, follow this exact sequence:
Step 1: Read the registry (running services)
cat /data/previews.json 2>/dev/null || echo "NO_REGISTRY"
⚠️ Your bash CWD is /data/workspace/. The registry is at /data/previews.json (absolute path, one level up). Always use the absolute path.
JSON structure:
{
"previews": [
{"id": "f343befc", "title": "My App", "dir": "/data/workspace/my-project", "command": "npm run dev", "port": 9080, "is_builtin": false}
]
}
Step 2: Branch based on registry state
If registry has entries → Go to Step 3 (verify services) If registry is empty or missing → Go to Step 4 (check history)
Step 3: Registry has entries — verify and fix
For each preview in the registry, check if the port is responding server-side (this is your diagnostic, not for the user):
curl -s -o /dev/null -w "%{http_code}" http://localhost:{port}
If port responds (200):
- The service IS running
Установить browser-preview в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл browser-preview?
Preview panel and iframe diagnostics: registry, ports, paths, blank screens. Use when a preview tab is broken or missing (e.g. white screen, tab disappeared, 404 on assets, preview not loading, list running services).
Как установить скилл browser-preview?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл browser-preview запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic