alpha

Sets rules for building TanStack Start apps with TypeScript, shadcn/ui, Tailwind and TanStack Query, covering configuration, code style and data loading.
description: 'Guidelines for building TanStack Start applications'
applyTo: '/src//.ts, /src//.tsx, /src//.js, /src//.jsx, /src//*.css, **/vite.config.ts, **/vite.config.js, **/rsbuild.config.ts, **/rsbuild.config.js'
You are an expert TypeScript developer specializing in TanStack Start applications with modern React patterns.
Apply these rules in projects using @tanstack/react-start. Read installed Start, Router, Query, and Tailwind versions and the existing build configuration before changing APIs or dependencies.
tanstackStart from @tanstack/react-start/plugin/vite and place it before the React Vite plugin; do not copy obsolete configuration or migrate an existing app as a side effect.routeTree.gen.ts; edit route source files instead of the generated tree.errorComponent and pendingComponent options.References: [Start build configuration](https://tanstack.com/start/latest/docs/framework/react/build-from-scratch), [route options](https://tanstack.com/router/latest/docs/api/router/RouteOptionsType), [Tailwind upgrade guide](https://tailwindcss.com/docs/upgrade-guide).
any type - always use proper TypeScript typesUse function components with proper TypeScript interfaces:
interface ButtonProps {
children: React.ReactNode;
onClick: () => void;
variant?: 'primary' | 'secondary';
}
export default function Button({ children, onClick, variant = 'primary' }: ButtonProps) {
return (
<button onClick={onClick} className={cn(buttonVariants({ variant }))}>
{children}
</button>
);
}
Use Route Loaders for:
Use React Query for:
// Route Loader
export const Route = createFileRoute('/users')({
loader: async () => {
const users = await fetchUsers()
return { users: userListSchema.parse(users) }
},
component: UserList,
})
// React Query
const { data: stats } = useQuery({
queryKey: ['user-stats', userId],
queryFn: () => fetchUserStats(userId),
refetchInterval: 30000,
});
Always validate external data. Define schemas in src/lib/schemas.ts:
export const userSchema = z.object({
id: z.string(),
name: z.string().min(1).max(100),
email: z.string().email().optional(),
role: z.enum(['admin', 'user']).default('user'),
})
export type User = z.infer<typeof userSchema>
// Safe parsing
const result = userSchema.safeParse(data)
if (!result.success) {
console.error('Validation failed:', result.error.format())
return null
}
Structure routes in src/routes/ with file-based routing. Override the router's error and pending UI when the route needs different behavior:
export const Route = createFileRoute('/users/$id')({
loader: async ({ params }) => {
const user = await fetchUser(params.id);
return { user: userSchema.parse(user) };
},
component: UserDetail,
errorComponent: ({ error }) => (
<div className="text-red-600 p-4">Error: {error.message}</div>
),
pendingComponent: () => (
<div className="flex items-center justify-center p-4">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary" />
</div>
),
});
Always prefer Shadcn/ui components over custom ones:
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
<Card>
<CardHeader>
<CardTitle>User Details</CardTitle>
</CardHeader>
<CardContent>
<Button onClick={handleSave}>Save</Button>
</CardContent>
</Card>
Use Tailwind for styling with responsive design:
<div className="flex flex-col gap-4 p-6 md:flex-row md:gap-6">
<Button className="w-full md:w-auto">Action</Button>
</div>
Use semantic HTML first. Only add ARIA when no semantic equivalent exists:
// ✅ Good: Semantic HTML with minimal ARIA
<button onClick={toggleMenu}>
<MenuIcon aria-hidden="true" />
<span className="sr-only">Toggle Menu</span>
</button>
// ✅ Good: ARIA only when needed (for dynamic states)
<button
aria-expanded={isOpen}
aria-controls="menu"
onClick={toggleMenu}
>
Menu
</button>
// ✅ Good: Semantic form elements
<label htmlFor="email">Email Address</label>
<input id="email" type="email" />
{errors.email && (
<p role="alert">{errors.email}</p>
)}
src/
├── components/ui/ # Shadcn/ui components
├── lib/schemas.ts # Zod schemas
├── routes/ # File-based routes
└── routes/api/ # Server routes (.ts)
Use the project's configured path alias for internal imports; the examples below assume @/ is configured:
// ✅ Good
import { Button } from '@/components/ui/button'
import { userSchema } from '@/lib/schemas'
// ❌ Bad
import { Button } from '../components/ui/button'
Install Shadcn components when needed:
npx shadcn@latest add button card input dialog
© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Person Emerging From a Pencil Sketch
Makes a trompe l'oeil picture of a person tearing out of a pencil sketch on drawing paper, the upper body photoreal and the lower body still graphite, shot from above.
image-prompt, reference-image, face-reference, surreal, photorealistic, 3d-render, drawing, sketch, aerial-view, high-angle, dramatic-lighting, portrait, cinematic, photo-editing, nano-banana

Traveler boards boat and spots dolphins
Generates a realistic documentary-style travel clip of a woman boarding a sightseeing boat, spotting dolphins and speaking two lines, with a long realism and negative list.
video-prompt, hailuo, documentary, lip-sync, travel, animals, ocean, photorealistic, cinematic, negative-prompt, single-take, camera-movement, natural-light, handheld, woman, full-body, wide-shot, for-content-creators, long-form, structured-output, sports

Researches and validates a technical spike document through exhaustive searching and controlled experiments, asking permission before experiments and reporting findings.
sub-agent, deep-research, web-search, tool-use, mcp, technical-spec, for-developers, report, documentation, research-methods, human-in-the-loop, guardrails, plan-then-execute, task-decomposition, fact-checking, problem-solving, advanced, long-form, developer-tools, architecture
Loading reviews…
Loading comments…