virtual-file-routes

Define programmatic route trees for TanStack Router in React, Vue, or Solid.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/abereghici/skills --skill virtual-file-routes-abereghici
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: virtual-file-routes
Source: https://github.com/abereghici/skills/tree/main/vendor/tanstack-router/packages/virtual-file-routes/skills/virtual-file-routes
Command: npx skills add https://github.com/abereghici/skills --skill virtual-file-routes-abereghici

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Programmatic route construction replaces filesystem-based routing with a programmable route tree that remains explicit, maintainable, and composable.

Core Features & Use Cases

  • Build routes with rootRoute, index, route, layout, and physical to mix virtual and filesystem-based routing.
  • Define virtual subtree configurations for strong type inference in TS projects.
  • Use with TanStack Router plugin's virtualRouteConfig to drive router configuration in React, Vue, or Solid apps.

Quick Start

Define a rootRoute tree and compose routes with index and route helpers to mount a virtual subtree alongside physical routes.

Frequently Asked Questions about virtual-file-routes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define programmatic routing in TanStack Router instead of using file-based routes?

Programmatic routing in TanStack Router is defined by composing a route tree using helpers like rootRoute, index, route, and layout to explicitly mount virtual routes alongside physical filesystem-based routes. This approach replaces file-based routing with a maintainable, composable route tree.

Can I mix virtual routes with physical filesystem-based routes in my React or Vue app?

Yes, you can mix virtual and physical filesystem-based routes in React, Vue, or Solid apps by using the physical helper alongside virtual route helpers. This allows you to retain filesystem routing where needed while explicitly controlling other parts of the route tree programmatically.

How do I get strong type inference for a virtual route subtree in a TypeScript project?

Strong type inference for a virtual route subtree in TypeScript is achieved by using the defineVirtualSubtreeConfig helper. This configuration drives the TanStack Router plugin's virtualRouteConfig to ensure robust type checking across your programmatic route tree.

What is the best way to structure a TanStack Router layout with programmatic route helpers?

The best way to structure a TanStack Router layout programmatically is by using the layout helper to wrap child routes. You compose the tree by nesting index and route helpers within the layout, ensuring explicit control over your application's routing hierarchy.

When should I use programmatic routing over filesystem-based routing?

Programmatic routing should be used over filesystem-based routing when you require explicit, maintainable, and composable control over your route tree. It is ideal for projects that need to dynamically mix virtual and physical routes rather than relying solely on file conventions.