browse
Serve and view Claude artifacts (plans, reviews, goals, memory, pull-requests) in the browser with rendered markdown and live reload. Use this skill when the user says "/browse", "/view", "browse my artifacts", "browse my plans", "view my reviews", "open my goals", or wants to preview any file or directory from ~/.claude or ~/project-plans or ~/pr-reviews in a local web server. Also trigger when the user wants to serve a local directory or file for quick browser viewing.
- License 许可
- GPL-3.0
- 最近更新
- 2026-10-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- browse
- description
- Serve and view Claude artifacts (plans, reviews, goals, memory, pull-requests) in the browser with rendered markdown and live reload. Use this skill when the user says "/browse", "/view", "browse my artifacts", "browse my plans", "view my reviews", "open my goals", or wants to preview any file or directory from ~/.claude or ~/project-plans or ~/pr-reviews in a local web server. Also trigger when the user wants to serve a local directory or file for quick browser viewing.
02 资源文件 11
- 脚本browse-ctl.mjs13.9 KB
- 脚本ensure-server.sh1008 B
- 脚本registry.mjs1.8 KB
- 脚本serve-md.mjs32.4 KB
- 脚本test/ctl.test.mjs22.0 KB
- 脚本test/ensure-server.test.mjs6.3 KB
- 脚本test/helpers.mjs3.5 KB
- 脚本test/registry.test.mjs2.9 KB
- 脚本test/render.test.mjs7.4 KB
- 脚本test/server.test.mjs3.6 KB
- 脚本test/tailwind.test.mjs3.4 KB
03 SKILL.md 正文
/browse — Browse Claude Artifacts in the Browser
This skill lets the user pick an artifact from their Claude ecosystem and view it in the browser as rendered markdown with live reload (changes on disk update the preview automatically).
Server Script
The markdown preview server lives at ~/.claude/skills/browse/serve-md.mjs. It:
- Renders
.mdfiles with Tailwind 3 +@tailwindcss/typography: sticky header with breadcrumbs, "On this page" sidebar, code blocks with copy buttons, plan checklists as checkboxes, and## Status:lines as badges. A Light / System / Dark switch in the header, defaulting to System and remembered per browser - Shows a card index when serving a directory: title, status badge and last-updated per file, grouped by folder, filterable (press
/) - Pushes live reload via Server-Sent Events — any saved
.mdchange refreshes the browser - No npm install — runs with plain
node; Tailwind loads from its Play CDN, so pages render unstyled offline
Artifact Sources
Scan these locations for servable artifacts:
| Location | Label |
|---|---|
~/project-plans/ |
Project Plans (each subdirectory is one artifact) |
~/pr-reviews/ |
PR Reviews (each subdirectory is one artifact) |
~/.claude/goals/ |
Goals |
~/.claude/memory/ |
Memory |
~/.claude/plans/ |
Plans |
~/.claude/pull-requests/ |
Pull Requests |
~/.claude/guides/ |
Guides |
~/.claude/skills/ |
Skills |
Only include locations that actually exist and contain files.
Workflow
Step 1: Determine what to serve
If the user specified a specific file or directory (e.g. /browse ~/project-plans/sapphire), skip discovery and go straight to Step 2 with that path.
Otherwise, list the servable artifacts by scanning the locations above. For directories that contain subdirectories (like ~/project-plans/), list each subdirectory as a separate option. For flat directories (like ~/.claude/goals/), list the directory itself as one option.
Present a numbered list like:
What would you like to browse?
1. Project Plans / sapphire
2. Project Plans / sapphire-jsonb-refactor
3. PR Reviews / sapphire
4. Goals
5. Memory
6. Plans
7. Pull Requests
8. Skills
Ask the user to pick a number.
Step 2: Ensure a server for that path
node ~/.claude/skills/browse/browse-ctl.mjs ensure <path> --open
<path> can be a folder or a single .md file. The command:
- reuses a live server whose folder is
<path>or contains it, if it's shared or this session's, and prints a deep link into it - otherwise starts one, owned by this Claude session. A file gets its folder served, with the link pointing at the file
- leaves every other browse server running
- opens the browser only if it started a new server. When it prints
(already running)and the user wants to see it, runopen '<url>'
It prints the URL, followed by (started) or (already running). The host is plans.localhost once /etc/hosts maps it (see Vanity URL), and localhost until then.
Step 3: Stand by
Tell the user:
Serving at <url> with live reload. Edit any
.mdfile and the browser updates automatically. Say done when you're finished and I'll stop the server.
Step 4: Tear down
When the user says "done" (or any clear signal they're finished), stop this session's servers:
node ~/.claude/skills/browse/browse-ctl.mjs stop --mine
This stops only servers this session started. Other sessions' servers and the shared ~/project-plans autostart keep running. To stop one specifically, use stop --port <port>; stop --all stops every registered server. Confirm what was stopped from its output.
Ownership is keyed on CLAUDE_CODE_SESSION_ID, which survives /compact. If it says nothing to stop but you started a server earlier in this conversation (the id may change on /clear), run list and stop that one with --port. A server that ignores SIGTERM is reported as did not exit, keeps its entry, and exits 1.
Notes
- Styling is Tailwind utility classes only — no inline CSS. Components (badge, code block, table, checkbox) are small functions near the top of
serve-md.mjs. - Live reload works via Server-Sent Events — no browser extensions needed.
- Directory mode shows a card-based index of all
.mdfiles with click-through to rendered previews. - If
nodeis not available, fall back toyarn dlx servefor raw file serving. - Ports come from 3200–3220, first free wins (
BROWSE_PORT_MIN/BROWSE_PORT_MAXoverride the range). A port anything answers on, over 127.0.0.1 or ::1, is skipped and never killed. Servers bind to 127.0.0.1 only. Each server logs to~/.claude/state/browse/<port>.log. - Registry: each live server has an entry,
~/.claude/state/browse/<port>.json(directory mode 0700), with its pid, port, path, owner and start time.browse-ctl.mjs listshows them. An entry is pruned when its pid is gone or isn't a browse server, or its port answers as something else. One that is merely slow to answer is kept.ensureholds~/.claude/state/browse/.lockwhile it runs, so parallel sessions don't start duplicates. GET /__healthreturns{"path", "pid"}as JSON.browse-ctl.mjschecks both against an entry before trusting or signalling it.
Autostart
A SessionStart hook (matcher startup) in ~/.claude/settings.json runs:
ensure-server.sh ~/project-plans --open >/dev/null 2>&1
Output is discarded, so it costs no context. /clear, /compact and resumed sessions don't trigger it. ensure-server.sh wraps browse-ctl.mjs ensure --shared. Its servers are owned by shared, so stop --mine never stops them.
Vanity URL
/etc/hosts maps a name to an address, never a port, so the URL keeps its port (:3200 for the autostart). Removing the port would need a reverse proxy on port 80.
Use plans.localhost, not .local or .test:
.localnames go through a multicast-DNS (Bonjour) lookup first on macOS, which can stall for seconds.- Browsers treat
*.localhostas a secure context, and the code blocks' Copy button needs one for clipboard access.
Add it outside the /patch-my-hosts managed block so hosts syncs keep it:
echo "127.0.0.1 plans.localhost # /browse preview server" | sudo tee -a /etc/hosts
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
tee -a adds the line at the end of the file. /patch-my-hosts puts its block at the end too, so if that block is already there, move the line above its BEGIN marker.
Tests
node --test ~/.claude/skills/browse/test/'*.test.mjs'
Built-in node:test, so there's still nothing to install. Pass the glob, not the folder: Node 24 treats test/ as a single file and fails. In this repo, mise run test:claude runs them too. About 3 seconds.
| File | Covers |
|---|---|
render.test.mjs |
Markdown renderer, page shell, theme script (every OS-setting × saved-choice combination, run in a stub DOM) |
server.test.mjs |
/__health, index and sub-index links, breadcrumbs, 404, path traversal, SSE live reload |
registry.test.mjs |
The server writes its registry entry on listen and removes it on exit, never removing a newer server's |
ctl.test.mjs |
ensure reuse by owner, deep links and URL escaping, port scan, foreign holders on every loopback address, the lock; pruning only stale entries; list; stop --mine/--port/--all, and a server that won't exit |
ensure-server.test.mjs |
The wrapper: shared ownership, reuse, parallel servers, the SessionStart hook |
tailwind.test.mjs |
Compiles every class with a real Tailwind 3.4. The Play CDN skips a class it can't build without any error, so this is the only check that would catch one. Skipped unless TAILWIND_DIR (default: cami-ritv) has tailwindcss installed |
Every test uses its own registry (BROWSE_STATE_DIR or a temp HOME) and a port range away from 3200, and stop only signals servers in its own registry, so running tests never touches the real plans.localhost server.
04 同仓库更多 Skills
good-skill
A well-formed fixture skill.
some-other-name
Name does not match its directory.
no-desc
暂无简介
summon-profile
Synchronizes the local Gemini profile (~/.gemini) with a remote machine via scp.
start-worktree
Creates a new isolated git worktree for a JIRA ticket, generates a draft PR checkpoint doc, and sets up the branch following user conventions. Use when starting a new task or feature.
specialist
Orchestrates expert reviews by delegating analysis to specialized sub-agents. Use this when the user asks for a "/specialist" review, a deep technical audit, or specific feedback on code, architecture, security, design, documentation, testing, or devops.