agentleFS
a-kaibua-kaibu/skills/frontend-builder/SKILL.md

frontend-builder

Skill0 starsChanged 6 months agoMITView on GitHub

Build frontend applications with Vite+, React, TypeScript, and TanStack Router. Use this skill for new frontends, SPAs, dashboards, games, tools, screen implementation, UI changes, Vite to Vite+ migration, vp dev/build/test/lint/fmt/check workflows, TanStack Router route design, loaders, search params, navigation, and error handling.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. emtcmca/guildproof-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

30 rules. About 0 are common, 5 are distinctive, and 25 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 25

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Vite+'s vp CLI with React and TypeScript as the standard frontend stack.

    line 9
  2. Very specific:

    When migrating an existing Vite project to Vite+, use vp migrate.

    line 14
  3. Very specific:

    Use pnpm as the package manager.

    line 15
  4. Very specific:

    Use playwright-cli when browser verification is useful.

    line 16
  5. Very specific:

    After every code change, run vp check --fix.

    line 17
  6. Very specific:

    Prefer Vite+ lifecycle commands whenever possible: vp dev, vp build, vp test, vp lint, vp fmt, and vp check.

    line 18
  7. Very specific:

    When using Vite+, do not create separate config files for Oxlint, Oxfmt, Vitest, or tsdown.

    line 20
  8. Very specific:

    Always write dev server stdout/stderr to web.log in the project root.

    line 22
  9. Very specific:

    Create the project with vp.

    line 26
  10. Very specific:

    If the project has no existing CSS convention, keep styling in src/index.css and component CSS.

    line 38
  11. Very specific:

    After migration, review changes to vite.config.ts, package scripts, and the lockfile.

    line 85
  12. Very specific:

    Create src/router.tsx and define a path-based route tree with createRootRouteWithContext, createRoute, and createRouter.

    line 115
  13. Very specific:

    Use RouterProvider in src/main.tsx.

    line 184
  14. Very specific:

    Prefer route loader functions for route data instead of component-level useEffect.

    line 202
  15. Very specific:

    When using TanStack Query, combine queryOptions with queryClient.ensureQueryData.

    line 204
  16. Distinctive:

    Wait for critical data in the loader, and split non-critical data into deferred loading or component-side fetching.

    line 205
  17. Very specific:

    Always validate search params with validateSearch and treat them as typed URL state.

    line 211
  18. Distinctive:

    Put only shared, restorable, or bookmarkable state in the URL.

    line 214
  19. Very specific:

    Use Link for normal page navigation.

    line 219
  20. Very specific:

    Use useNavigate for programmatic navigation after form submits or command actions.

    line 221
  21. Distinctive:

    When using relative paths, make the source route explicit.

    line 222
  22. Distinctive:

    Consider route masks only when modal URLs or preserved background pages are required.

    line 223
  23. Very specific:

    Keep critical route definitions, loaders, validateSearch, and error boundaries in the main route file.

    line 228
  24. Very specific:

    Use defaultPreload: "intent" for primary navigation.

    line 230
  25. Distinctive:

    Use manual preloading only for screens that are highly likely to be opened next.

    line 231
  26. Very specific:

    Use lucide-react for icon buttons when an icon is needed.

    line 237
  27. Very specific:

    Start the dev server from the project root and write logs to root-level web.log.

    line 243
  28. Very specific:

    After startup, inspect web.log for the served URL, compile errors, and runtime errors.

    line 249
  29. Very specific:

    Run vp build and fix type errors and build errors.

    line 258
  30. Very specific:

    Start the dev server and confirm Vite+ startup logs are written to web.log.

    line 260

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend Builder

Use Vite+'s vp CLI with React and TypeScript as the standard frontend stack. Use TanStack Router for routing.

Core Rules

  • For new projects, create a React + TypeScript project with Vite+ (vp).
  • When migrating an existing Vite project to Vite+, use vp migrate.
  • Use pnpm as the package manager.
  • Use playwright-cli when browser verification is useful.
  • After every code change, run vp check --fix.
  • Prefer Vite+ lifecycle commands whenever possible: vp dev, vp build, vp test, vp lint, vp fmt, and vp check.
  • Respect existing Vite+ configuration in vite.config.ts, including lint/fmt/test/run/pack/staged blocks.
  • When using Vite+, do not create separate config files for Oxlint, Oxfmt, Vitest, or tsdown. Consolidate tool configuration in vite.config.ts.
  • Make the first viewport show the actual usable app. Do not start with an explanatory landing page unless the user explicitly asks for one.
  • Always write dev server stdout/stderr to web.log in the project root.

New Project

  1. Create the project with vp.
vp create vite -- --template react-ts
  1. Install dependencies.
pnpm install @tanstack/react-router @tanstack/router-devtools lucide-react
  1. If the project has no existing CSS convention, keep styling in src/index.css and component CSS. Do not add extra UI frameworks unless they materially help the task.

Vite+ Configuration

In Vite+, consolidate all tool configuration in vite.config.ts.

import { defineConfig } from "vite-plus";

export default defineConfig({
  server: {},
  build: {},
  preview: {},
  test: {},
  lint: {},
  fmt: {},
  run: {},
  pack: {},
  staged: {},
});

Enable lint.options.typeAware and lint.options.typeCheck because type-aware linting is desired.

export default defineConfig({
  lint: {
    ignorePatterns: ["dist/**"],
    options: {
      typeAware: true,
      typeCheck: true,
    },
  },
  fmt: {
    singleQuote: true,
  },
});

Existing Vite Migration

For an existing Vite project, inspect the current state first, then migrate to Vite+.

vp migrate

After migration, review changes to vite.config.ts, package scripts, and the lockfile. If the project already has tests, linting, formatting, or build workflows, run vp check or the individual vp build, vp test, and vp lint commands.

Vite+ Commands

  • vp dev: Start the Vite dev server with HMR.
  • vp build: Run the production build through Rolldown. This runs the Vite build, not a custom package.json build script.
  • vp preview: Serve the production build locally.
  • vp test: Run Vitest once. Unlike standalone Vitest, this is not watch mode.
  • vp test watch: Run tests in watch mode.
  • vp test run --coverage: Run tests with coverage.
  • vp lint: Run Oxlint.
  • vp fmt: Run Oxfmt.
  • vp check: Run format, lint, and typecheck in one pass.
  • vp check --fix: Auto-fix formatting and lint issues.
  • vp run build: Run the package.json build script.
  • vp run build -r: Run the script across all workspace packages in dependency order.
  • vp pack: Build a library through the tsdown integration.

TanStack Router Priority Rules

Implement these rules by priority.

  • Critical: register the router type, use the from parameter for type narrowing, type the root context, and use queryOptions for loader type inference.
  • Critical: organize the route tree around hierarchy, layouts, index routes, and pathless layouts.
  • High: configure router defaults, loaders, loaderDeps, TanStack Query integration, search param validation, and not-found/error handling.
  • Medium: use Link, active states, useNavigate, relative paths, code splitting, and preloading when they fit the task.
  • Low: use root context, beforeLoad, and dependency injection when shared dependencies such as auth, API clients, or feature flags are needed.

Router Implementation

Create src/router.tsx and define a path-based route tree with createRootRouteWithContext, createRoute, and createRouter.

import {
  Link,
  Outlet,
  createRootRouteWithContext,
  createRoute,
  createRouter,
} from "@tanstack/react-router";
import { TanStackRouterDevtools } from "@tanstack/router-devtools";

type RouterContext = {
  queryClient?: unknown;
};

function RootLayout() {
  return (
    <>
      <nav>
        <Link to="/" activeOptions={{ exact: true }}>
          Home
        </Link>
        <Link to="/settings">Settings</Link>
      </nav>
      <Outlet />
      <TanStackRouterDevtools />
    </>
  );
}

const rootRoute = createRootRouteWithContext<RouterContext>()({
  component: RootLayout,
  notFoundComponent: NotFoundPage,
  errorComponent: ErrorPage,
});

const indexRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: "/",
  component: HomePage,
});

const settingsRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: "/settings",
  validateSearch: (search) => ({
    tab: typeof search.tab === "string" ? search.tab : "profile",
  }),
  component: SettingsPage,
});

const routeTree = rootRoute.addChildren([indexRoute, settingsRoute]);

export const router = createRouter({
  routeTree,
  defaultPreload: "intent",
  defaultPreloadStaleTime: 30_000,
  scrollRestoration: true,
  context: {},
});

declare module "@tanstack/react-router" {
  interface Register {
    router: typeof router;
  }
}

Use RouterProvider in src/main.tsx.

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { RouterProvider } from "@tanstack/react-router";
import { router } from "./router";
import "./index.css";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <RouterProvider router={router} />
  </StrictMode>,
);

Data Loading

  • Prefer route loader functions for route data instead of component-level useEffect.
  • Define loaderDeps when search params or route params affect the loader cache.
  • When using TanStack Query, combine queryOptions with queryClient.ensureQueryData.
  • Wait for critical data in the loader, and split non-critical data into deferred loading or component-side fetching.
  • Handle loader errors with errorComponent and not-found states with notFoundComponent.
  • Route loaders for parent and child routes run in parallel, so avoid unnecessary sequential dependencies.

Search Params

  • Always validate search params with validateSearch and treat them as typed URL state.
  • Provide defaults so the page does not break when the URL omits a search param.
  • Design parent routes so child routes can inherit parent search param types when useful.
  • Put only shared, restorable, or bookmarkable state in the URL.
  • Configure a custom serializer only when complex search param values require one.

Navigation

  • Use Link for normal page navigation.
  • Configure active states for current-location UI.
  • Use useNavigate for programmatic navigation after form submits or command actions.
  • When using relative paths, make the source route explicit.
  • Consider route masks only when modal URLs or preserved background pages are required.

Code Splitting And Preloading

  • Split large routes, settings pages, admin screens, game screens, and other non-critical initial routes into lazy routes.
  • Keep critical route definitions, loaders, validateSearch, and error boundaries in the main route file.
  • Enable auto code splitting when the environment supports it.
  • Use defaultPreload: "intent" for primary navigation.
  • Use manual preloading only for screens that are highly likely to be opened next.

UI Implementation

  • Split page components by route. Even for small apps, avoid putting everything in src/App.tsx; create src/pages/ and src/components/.
  • Implement primary, empty, error, and loading states when they are relevant.
  • Use lucide-react for icon buttons when an icon is needed.
  • Prevent text from overflowing buttons or cards by using stable dimensions, wrapping, and responsive constraints.
  • For apps that need visual content, such as games or image-heavy experiences, use real assets, searched images, generated images, Canvas, Three.js, or another appropriate visual approach. Do not rely on empty decoration.

Logs And Dev Server

Start the dev server from the project root and write logs to root-level web.log.

vp dev --host 0.0.0.0 > web.log 2>&1

After startup, inspect web.log for the served URL, compile errors, and runtime errors. Fix issues and restart when needed.

Common Errors

  • vp build does not run the expected script: vp build is for the Vite build. Use vp run build to run the package.json script.
  • Imports are broken after vp migrate: run vp install, then vp check to find remaining issues.

Verification

  • Run vp build and fix type errors and build errors.
  • Depending on the change, run vp test, vp lint, vp fmt, and vp check.
  • Start the dev server and confirm Vite+ startup logs are written to web.log.
  • Directly visit each TanStack Router path and verify initial render, search params, not-found behavior, and navigation.
  • In the final response, briefly report changed files, the dev server URL, verification performed, and anything not verified.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.