astro-dev
GitHub用于启动 Astro 开发服务器并自动验证页面变更。涵盖多包启动策略、全量与轻量模式选择、避免构建冲突,以及通过自动化步骤检查控制台、DOM 结构和视觉效果的完整验证流程。
Trigger Scenarios
Install
npx skills add tabler/tabler --skill astro-dev -g -y
SKILL.md
Frontmatter
{
"name": "astro-dev",
"description": "Start a Tabler Astro dev server and verify a change in the browser. Use whenever a change to `preview\/`, `docs\/`, `shared\/` or `core\/` has to be seen running — before handing a page or component back — and whenever the dev server behaves oddly: stale CSS\/JS, assets that vanish, a page that will not reload. Covers which server to start on which port, background mode, the rule against building while a dev server runs, and the verification loop."
}
Run and verify the dev servers
Never ask the user to check a page manually. Start the server, look at the page, and show what you found.
1. Which server
| Package | Command | Port | Serves |
|---|---|---|---|
@tabler/preview |
pnpm --dir preview run dev |
3000 | demo pages (preview/pages/*.astro) |
@tabler/docs |
pnpm --dir docs run dev |
3010 | documentation (docs/content/**/*.mdx) |
@tabler/screenshots |
pnpm --dir screenshots run dev |
3020 | screenshot capture pages |
preview_start returns a tabId — pass it to every later navigate / read_page / computer call so they act on that tab and not on whatever is fronted. The same entries exist in .claude/launch.json (preview, docs, screenshots) — start them with preview_start so the browser pane opens on the right port, and use preview-attach when a server is already running. pnpm dev at the repo root starts everything through turbo; only do that when the change spans packages, because the persistent tasks make the output hard to read.
A shared/ change shows up in both preview and docs. Verify in the package the user asked about, and open the other one too when the component is used there.
2. Full dev vs. astro-only
Each package's dev script is astro dev plus its asset watchers (concurrently), and turbo runs dev:prepare first so tmp-assets/ and public/ exist:
- SCSS or
core/touched → use the fulldevscript.astro devalone will not rebuild the stylesheets. - Only
.astro/.mdx/shared/libtouched →astro dev --backgroundinside the package is enough and faster, provided the assets have been built before. Manage it withastro dev status,astro dev logs,astro dev stop; the log file is.astro/dev.login the package. Add--forceto replace a server that is already running.
3. Do not build while a dev server is running
pnpm build (or a per-package build) run next to a live dev server fights the watchers: the build's asset copy overwrites what the watcher just wrote into public/, and the two file watchers together can exhaust file handles (EMFILE). Verify through the running server and HMR instead. If a build is genuinely needed, stop the dev server first.
4. The verification loop
-
preview_startwith the package's config, then open the page (/badgesin dev; the built file is/badges.html). -
read_console_messages— errors first, then warnings. -
read_pageorcurlfor structure; assert instead of eyeballing when the page is generated from data:curl -s http://localhost:3000/badges | grep -o '<h[1-6]' | sort | uniq -c -
computerclicks/typing for anything interactive, then read the state back. -
resize_windowfor responsive or dark-mode work;colorSchemefordata-bs-theme. -
Screenshot the result for the user when the change is visual.
5. When the page looks stale or unstyled
In order:
- CSS did not change — the SCSS watcher is not running. Restart with the full
devscript rather thanastro dev. - Assets 404 after a restart —
public/preview(ordocs/public) was wiped by a build or aclean. Runpnpm --dir <pkg> run dev:prepare, then start dev again. - A
public/file changed but the browser did not reload — Astro does not watchpublic/; thecopyAssetsintegration reloads the listed dirs, everything else needs a manual refresh. shared/change not picked up — the file is aliased, not watched throughnode_modules; confirm the import uses@shared/@ui, not a path intonode_modules.- Still wrong:
pnpm --dir <pkg> run clean, thendev:prepare, thendev.
6. Gates before handing work back
Run at the repo root and read the full output — a tail hides TypeScript errors:
pnpm run type-check && pnpm run format:prettier && pnpm run lint
type-check is astro check per package, so it covers .astro frontmatter and templates. For a markup refactor that should not change output at all, also run the html-diff skill.
7. Checklist
- Right package started, on its own port
- Full
devscript when SCSS orcore/is involved - No build started while a dev server was running
- Page opened, console clean, interaction exercised
- Screenshot for visual changes
- Repo-level
type-check/format:prettier/lintclean, full output read
Version History
- 340f719 Current 2026-09-22 21:46


