browser-preview — Claude Code skill: preview and iframe diagnostics
Walks the agent through a broken Preview tab: service registry, ports, and static asset paths that 404 behind the proxy.
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a claude-codeWhat browser-preview does
This skill kicks in when the preview panel breaks: white screen, tab gone, assets returning 404, service not loading. It gives the agent a fixed order of steps. First read the running-service registry at /data/previews.json, then the history at /data/preview_history.json, then check the port with curl server-side. If the process died but the registry entry is still there, the skill says to recreate it with preview_stop and preview_serve.
The rule it drills hardest: users cannot reach localhost or 127.0.0.1. Previews go through a reverse proxy, so the only URL worth handing over is /preview/{id}/. The second common break is absolute paths in static files. Because everything is served under the /preview/{id}/ prefix, the browser asks for /static/app.js from the domain root and gets a 404. The skill tells the agent to check every place a path can hide: src and href attributes, fetch() calls, CSS url(), JS string literals, and bundler config like publicPath and base.
It also forbids poking around workspace folders such as preview/ or output/ with ls and find. Those hold user data, not service state. The registry, the history file, and the preview_serve and preview_stop tools are the only sources of truth. If the RUNNING SERVICES list looks empty while the port still answers, the frontend lost sync — recreating the service forces it to register the tab again.
What it helps with
- figure out why the Preview tab shows a white screen
- track down 404s on static assets after starting a preview
- recreate a service when the process died but the registry entry stayed
- bring back a closed Preview tab through the RUNNING SERVICES list
- keep preview state separate from user files in the workspace
Example prompts for the agent
- the preview won't load, check the registry and tell me what's running
- the Preview tab disappeared, bring the service back
- static files are 404ing, check the paths in HTML and JS
How to install browser-preview
1Skills CLI (Vercel)
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a claude-code2Manually: put the files in place
~/.claude/skills/browser-preview/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/browser-preview/
1Skills CLI (Vercel)
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a codex2Manually: put the files in place
.agents/skills/browser-preview/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a cursor2Manually: put the files in place
.cursor/skills/browser-preview/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Starchild-ai-agent/official-skills browser-preview2Manually: put the files in place
.github/skills/browser-preview/SKILL.md1Skills CLI (Vercel)
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a gemini-cli2Platform CLI
gemini skills install https://github.com/Starchild-ai-agent/official-skills --path browser-previewManually: put the files in place
.devin/skills/browser-preview/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about browser-preview
How do I install browser-preview in Claude?
Run npx skills add Starchild-ai-agent/official-skills --skill browser-preview -a claude-code. The skill lands in ~/.claude/skills/browser-preview/SKILL.md.
What does browser-preview do?
It helps the agent debug a broken preview panel: reading the service registry and history, checking ports, hunting absolute paths in static files, and recreating a service when needed.
Why can't I open localhost in the preview?
localhost and 127.0.0.1 point at the server container, not your machine. Previews run through a reverse proxy, so open the /preview/{id}/ URL instead.