vite-spa-patterns

vite-spa-patterns is a skill for Claude Code, Codex from lukasrepublic/agentic-foundry. It costs 0 tokens per session (1,673 once invoked), scanned A, original, MIT.

A set of patterns for Vite and React single-page applications, where Vite is a frontend build tool and a single-page application updates views without full page loads.

In plain words
What is it for?
Use it when changing SPA routes, Vite configuration, environment-variable handling, lazy loading, code splitting, or build issues.
Why use it?
It keeps routes, environment variables, loading boundaries, and build behavior consistent across the app.

Skill for Claude CodeCodex

Part of the foundry plugin — 81 skills, 8 agents, 8 hooks, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lukasrepublic/agentic-foundry/vite-spa-patterns
Any agent
npx skills add lukasrepublic/agentic-foundry --skill vite-spa-patterns
Clone the repo
git clone --depth 1 https://github.com/lukasrepublic/agentic-foundry

Made for: Claude Code, Codex.

Or install foundry, the plugin that ships this one along with the rest of its 81 skills, 8 agents, 8 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for vite-spa-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/lukasrepublic/agentic-foundry/vite-spa-patterns.svg)](https://agentmods.dev/skills/lukasrepublic/agentic-foundry/vite-spa-patterns)
Your own site
<a href="https://agentmods.dev/skills/lukasrepublic/agentic-foundry/vite-spa-patterns"><img src="https://agentmods.dev/badge/skills/lukasrepublic/agentic-foundry/vite-spa-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,673 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01673
Opus 5 $0.00000 $0.00837
Sonnet 5 $0.00000 $0.00335
Haiku 4.5 $0.00000 $0.00167

Measured 5d ago against content hash 953938febbd8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

vite-spa-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packs/stack-profiles/node-web/blueprints/vite-spa-patterns/SKILL.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When to trigger

  • Implementing a spec that names a Vite + React SPA change.
  • Adding or modifying a route in the SPA (auth-gated by default).
  • Authoring build-config changes in vite.config.ts.
  • Env-handling decisions: which variables need VITE_ prefix; distinguishing public vs. server-only values.
  • Code-splitting boundary decisions (lazy-loading a new feature module).
  • Debugging a Vite build issue — chunk size warnings, tree-shaking problems, env-var not injected.

Procedure

  1. Determine route type: default is auth-gated. A public route is an exception that requires an explicit decision recorded in the spec. If in doubt, gate it.

  2. Place the route file per the routing-library convention the project uses. Follow the existing router setup in the package's src/router/ (or equivalent) before introducing a new pattern.

  3. Lazy-load the route via dynamic import to enforce code-splitting boundary: const MyPage = lazy(() => import('./pages/MyPage')) wrapped in <Suspense fallback={<LoadingSpinner />}>. Every route is lazy-loaded unless it is the top-level app shell.

  4. Env access via import.meta.env.VITE_* (never process.env — Vite does not expose process.env by default). Variables without the VITE_ prefix are only available at build time in vite.config.ts; they are NOT injected into the client bundle. Secret values (API keys, tokens) must NEVER use the VITE_ prefix — they become part of the public bundle.

  5. Build-config changes go in vite.config.ts at the package root. Document every config addition with a one-line comment explaining why. Do not add plugins speculatively.

  6. Build verification + lint + typecheck: confirm the package builds cleanly with {{ profile.static_validation.build }} from the project root, scoped to the target package, and run lint + typecheck before marking the PR ready.

Dependency installation

Default command for population on a fresh worktree or after a git pull that includes a lockfile change: npm ci — lockfile-respecting, deterministic install. Run from the project root. This is the form CI workflows and Dockerfiles use. The bare npm install form is acceptable only when the lockfile is known-stale or for the initial devcontainer bootstrap; for the per-PR verifier flow, npm ci is the default.

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 79 lines · 0 tokens per session scan A 953938febbd8

Subscribe to this mod's changes

vite-spa-patterns is a skill published in the GitHub repository lukasrepublic/agentic-foundry (1 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,673 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.