/cxcskills:setup-stackfrom cxcskills
Set up a SvelteKit app on the cxcskills stack (Bun, TypeScript, Oxlint, svelte-check, Vitest, Playwright, lefthook, the Svelte MCP, optional Drizzle, Better Auth and Effect), with settled versions checked for conflicts and every quality gate proven to fail on a planted violation.
Ships in cxcskills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Turn an empty folder, or an existing SvelteKit app, into one whose quality gates are wired in and proven. A gate is a check that runs without anyone remembering it: a package.json script that CI runs, or a git or Claude Code hook. A gate counts only once it has passed on the clean tree and failed on a planted violation.
Run it once per app, before /setup-matt-pocock-skills and /grill-with-docs. Running it again on a set-up app is safe: each step merges into what is there.
Look for @sveltejs/kit in package.json. If it is there, skip to step 3: you are bringing an existing app up to the stack, so merge into its files, never overwrite them.
If it is not, the first thing you say is the question "Shall I template a SvelteKit project?", with three answers:
sv create with every option set, so it never prompts.sv's prompts) and says "done". They may change answers at the prompts; read the result in step 3 rather than assuming your options.On either yes, ask the stack choices in one message (use AskUserQuestion when you have it):
| Choice | Default | Adds |
|---|---|---|
| Database | Postgres through Drizzle | drizzle="database:postgresql+client:postgres.js+docker:yes" |
| Auth | none | better-auth="demo:none" (needs the database) |
| Effect | no | step 4 |
| Deploy adapter | node (Railway, Docker) | sveltekit-adapter="adapter:<node, bun, cloudflare, auto>" |
Create into the current folder when it holds nothing but .git and dotfiles; otherwise ask for a folder name. Resolve sv itself first (step 2's script with sv as the argument), then run bunx sv@<settled> create --help. Add-on options change between sv releases, and an option left unset makes sv prompt, so set every option the help lists for each add-on you pass. As of sv 1.3:
bunx sv@<settled> create <folder> --template minimal --types ts \
--add prettier vitest="usages:unit,component" playwright="demo:no" sveltekit-adapter="adapter:node" \
ai-tools="ide:claude-code+delivery:tools+tools:mcp+mcpSetup:local+optInSkills:none" \
<database and auth add-ons> --install bun
Later releases add options (1.5 added agentsMd; set it to no, since step 3 writes the agent notes). An option the settled sv doesn't list is an error, so don't pass one the help doesn't show.
ai-tools is Svelte's official way to add the Svelte MCP: it writes .mcp.json in the app. It can also install Svelte's own skills (svelte-core-bestpractices, svelte-code-writer); add them to tools: only if the user asks.
Settled means a stable release on npm's latest tag that has been out at least seven days: brand-new releases are where most regressions and supply-chain attacks surface. The script picks settled versions and checks the whole set for peer and engine conflicts:
${CLAUDE_SKILL_DIR}/scripts/resolve-versions.ts # audit the app's installed dependencies
${CLAUDE_SKILL_DIR}/scripts/resolve-versions.ts oxlint oxlint-tsgolint lefthook # resolve new tools against them
sv installs whatever is newest, often a release from that morning. Step each package the audit flags back to its settled version with bun add -d <pkg>@<version> (no -d for packages under dependencies). Bun pins an exact version when given one, which is the point.sv doesn't add (oxlint oxlint-tsgolint lefthook, plus effect in step 4) and install them with the script's Install: line.svelte-check declares (6.x at the time of writing; 7 is the Go compiler).svelte-check claims any TypeScript from 5 up). Only step 5 proves a set works.If the registry can't be reached, use the versions in references/KNOWN-GOOD.md and say so.
Copy each template from templates/ unless the app already has the file; when it does, merge the missing parts in and show the user what changed.
| Template | Goes to | Notes |
|---|---|---|
oxlintrc.json, oxlintrc.type-aware.json | .oxlintrc.json, .oxlintrc.type-aware.json | Lints .ts, .js and the <script> of .svelte files. Templates are svelte-check's job. Carries the size limits below. |
knip.ts | knip.ts | Dead code: unused files, exports and dependencies. Drop the three src/lib/server/db/ and drizzle.config.ts entries when the app has no database. |
lefthook.yml, lefthook/pre-push/block-push-to-main.sh | lefthook.yml, .lefthook/pre-push/ | Run git init first if there is no repo. Also refuses new markdown outside docs/, .scratch/, .claude/ and a short list of root files. |
claude/hooks/block-dangerous-git.sh | .claude/hooks/, executable | Needs jq. Refuses force pushes, pushes to main, and commands that destroy work. |
claude/settings.json | .claude/settings.json in the app | Merge the hook entry and the permission into the app's file. Never touch the user's own ~/.claude settings. |
github/workflows/ci.yml | .github/workflows/ci.yml | Add jobs for each gate the app gains later (integration tests, e2e). |
Then:
Scripts. Set these in package.json, keeping any the app already has:
"prepare": "svelte-kit sync && lefthook install""format:check": "prettier --check .""lint": "oxlint --deny-warnings""lint:types": "oxlint -c .oxlintrc.type-aware.json --type-aware --deny-warnings""check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --fail-on-warnings""test:unit": "vitest --run", "test:unit:watch": "vitest""knip": "knip""check:all": "bun run format:check && bun run lint && bun run lint:types && bun run check && bun run knip"sv points lint at Prettier; it now runs Oxlint and format:check runs Prettier. Replace npm run with bun run in package.json and playwright.config.ts. Run bun run prepare to install the hooks.
Size limits. The Oxlint config holds every function to complexity 10 (the "modified" count, so an exhaustive switch counts once), nesting depth 3, three parameters (pass an object beyond that) and 60 lines, with tests exempt from the line limit. Agents left alone let code erode a little with every change; these turn the erosion into a failing commit while the change is small. In an existing app, run bun run lint first: when it flags more than a handful of functions, add an override that turns the four rules off for exactly the files it flags, and tell the user. New files are held to the limits, and the list only shrinks as files are fixed.
Strict TypeScript. Add noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride and noFallthroughCasesInSwitch to compilerOptions in tsconfig.json.
Environment. SvelteKit 3 declares variables in src/env.ts with defineEnvVars and validates them, with any Standard Schema validator, at build and at startup. Code imports them from $app/env/private or $app/env/public; the Oxlint config bans $env/* and process.env with a message that says so. Keep .env.example listing every declared variable with a placeholder, because CI's build copies it to .env.
Guardrails. Call the Skill tool with "lint-guardrails" and follow its Oxlint path to add the starter Svelte bans.
Agent notes. Append templates/claude-md-lines.md to the app's CLAUDE.md (or AGENTS.md, whichever the app uses), creating it if needed.
Browser support. Those notes carry a **Browser Support:** line, the policy Chrome's Modern Web Guidance reads to decide when a newer feature needs a fallback. The default is "Baseline widely available", which matches Vite's default build target. Ask whether the app's users need anything older (locked-down corporate browsers, an embedded webview), and write their answer into the line.
Modern Web Guidance. Chrome's guides steer code to built-in platform features (<dialog>, popovers, anchor positioning) instead of hand-rolled code and extra libraries. The stack consults them at review only: /code-review runs their CLI on frontend diffs, and the settings template allows exactly npx -y modern-web-guidance@latest *, so it runs without a prompt. Don't suggest Chrome's plugin, whose skill fires on every frontend task while the code is being written. The CLI fetches its newest release on every call: the one place the stack doesn't use settled versions.
Run bunx prettier --write ., then bun run check:all. When a gate fails on a file sv generated, fix the file; never loosen a rule to get green. Examples: vitest-browser-svelte 3 made render async, and the type-aware pass flags sv's example test until it is awaited; Knip flags sv's empty src/lib/index.ts, so delete it and the bare "#lib" entry in package.json's imports (keep "#lib/*"). If a rule looks wrong for this app, ask the user.
Effect earns its place in server code with many failure modes, retries, resources and services to swap in tests. It stays out of components and route files, which call into it.
effect as a runtime dependency.templates/effect/runtime.ts and runtime.test.ts to src/lib/server/, and templates/effect/hooks.server.ts to src/hooks.server.ts (merge if it exists). The runtime builds the app's services once from a Layer; run(program) is the one bridge from load, actions and +server.ts handlers into Effect; the shutdown hook disposes it. The Clock service is a starting example: replace it with the app's first real service..mcp.json beside svelte: { "type": "stdio", "command": "npx", "args": ["-y", "effect-mcp"] }. Check that its answers cover the installed Effect major; if they don't, leave it out and say so.docs/adr/, per the repo's layout) recording the choice, the version, and the boundary: Effect in src/lib/server, plain TypeScript at the edges.bun run check:all && bun run test:unit && bun run build
${CLAUDE_SKILL_DIR}/scripts/prove-gates.sh
The build needs every variable in src/env.ts; use .env (copied from .env.example if missing). The test run needs Playwright's Chromium (bunx playwright install chromium).
prove-gates.sh runs each gate on the clean tree, then plants one violation for it under src/lib/__gate_probe__/ and expects a failure: Prettier, Oxlint on .ts and on a .svelte script, each size limit, the type-aware pass, svelte-check errors and warnings, Vitest, Knip on an orphan file, the $effect guardrail, the pre-commit hook, the stray-markdown hook, the pre-push hook on main, and the Claude git hook (which must still allow a feature branch). A size-limit probe counts only when the failure names its rule. Probes are removed on exit. Run it with nothing staged: the pre-commit probe refuses to run beside the user's staged changes, since the hook would reformat them. Every row must read ok; show the user the table.
When a gate fails on the clean tree after a version change, step that package back one settled version, rerun, and note why in step 6.
Write docs/STACK.md from references/STACK-FORMAT.md: every direct dependency's version, each one held back and why, the gate table from step 5, and the date. The lockfile is the exact record; STACK.md is the reasoning. Offer to commit both with the setup; don't commit unasked.
If this run proved a set newer than references/KNOWN-GOOD.md, tell the user, so they can update it in their cxcskills clone.
Next: /setup-matt-pocock-skills for the issue tracker, labels and doc layout, then /grill-with-docs to start the spec. If the user runs sol-loop, council or ui-hill-climb, add the ## Model delegates table those skills read (call the Skill tool with "model-delegates" for its format).
To upgrade later, run the audit again (resolve-versions.ts with no arguments), move what it shows, and rerun step 5.
agents/openai.yaml (opens in a new tab)references/KNOWN-GOOD.md (opens in a new tab)references/STACK-FORMAT.md (opens in a new tab)scripts/prove-gates.sh (opens in a new tab)scripts/resolve-versions.ts (opens in a new tab)templates/claude-md-lines.md (opens in a new tab)templates/claude/hooks/block-dangerous-git.sh (opens in a new tab)templates/claude/settings.json (opens in a new tab)templates/effect/hooks.server.ts (opens in a new tab)templates/effect/runtime.test.ts (opens in a new tab)templates/effect/runtime.ts (opens in a new tab)templates/github/workflows/ci.yml (opens in a new tab)templates/knip.ts (opens in a new tab)templates/lefthook.yml (opens in a new tab)templates/lefthook/pre-push/block-push-to-main.sh (opens in a new tab)templates/oxlintrc.json (opens in a new tab)templates/oxlintrc.type-aware.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cxcarroll/cxcskills --plugin cxcskills52 skills in this plugin
/adopt-designMake finished Claude Design boards the repo's source of truth for how the app looks, with tokens, a design README, and the coding standards that enforce them./ask-mattAsk which skill or flow fits your situation. A router over the skills in this repo./blast-radiusFind what a change could break outside its diff, and prove the one fact it is safe because of by running real code./chief-of-staffPursue a long-running goal in a single session by co-ordinating subagents./claude-handoffHand the current conversation off to a fresh background agent that picks up the work immediately./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.