sergiodxa avatar

Frontend React Router Best Practices

This is a comprehensive ruleset for React Router applications, covering 55 patterns across data loading, middleware, security, and routing architecture. The core focus is eliminating request waterfalls by moving all data fetching into loaders instead of useEffect, with patterns for parallel fetching, per-request caching, and proper TypeScript typing. It includes practical middleware implementations for sessions, batching, request IDs, and security measures like CORS, honeypots, and safe redirects. Use this when you're building anything beyond basic routing, especially if you're dealing with forms, authentication flows, or need to optimize loading patterns. The examples are clear and show both bad and good approaches, which makes it easy to refactor existing code.

skills.sh installs
402
GitHub stars
92
last updated
Aug 21, 2026

Install

$ npx -y skills add sergiodxa/agent-skills --skill frontend-react-router-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

React Router Best Practices

Performance optimization and architecture patterns for React Router applications. Contains 55 rules across 11 categories focused on data loading, actions, forms, streaming, and route organization.

When to Apply

Reference these guidelines when:

  • Writing new React Router routes (loaders, actions)
  • Handling forms and mutations
  • Implementing streaming with Single Fetch
  • Organizing route files and colocating queries
  • Setting up authentication patterns
  • Adding SEO/meta tags

Rules Summary

Data Loading (CRITICAL)

loader-avoid-waterfalls - @rules/loader-avoid-waterfalls.md

All data fetching happens in loaders. Never fetch in components with useEffect.

// BAD: fetching in component
function Profile() {
  const [user, setUser] = useState(null);
  useEffect(() => {
    fetch("/api/user")
      .then((r) => r.json())
      .then(setUser);
  }, []);
  if (!user) return <Spinner />;
  return <div>{user.name}</div>;
}

// GOOD: fetch in loader
export async function loader({ request }: Route.LoaderArgs) {
  let user = await getUser(request);
  return data({ user });
}

Sponsors

Details

Repository
github.com/sergiodxa/agent-skills
Categories
Frontend Development, Documentation, Code Review & Quality, AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from sergiodxa/agent-skills

All 10
1martinholovsky avatarvue-nuxtmartinholovsky/claude-skills-generatorVue 3 and Nuxt 3 for JARVIS AI Assistant UI development with security-first patterns227skills.sh installs
2oguzhan18 avatarangular-pwaoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular PWA, service workers, offline support, manifest, or web app installation in Angular applications.190skills.sh installs
3oguzhan18 avatarangular-ssroguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular SSR, server-side rendering, hydration, prerendering, or Angular Universal in Angular applications.168skills.sh installs
4syncfusion avatarsyncfusion-react-rich-text-editorsyncfusion/react-ui-components-skillsImplements the Syncfusion React Rich Text Editor (RichTextEditorComponent) from ej2-react-richtexteditor, supporting HTML (WYSIWYG) and Markdown editing. Use th783skills.sh installs
5syncfusion avatarsyncfusion-react-themessyncfusion/react-ui-components-skillsUse this skill when users need to apply themes, customize appearance, switch dark mode, use CSS variables, configure icons, or modify visual styling for Syncfus755skills.sh installs
6syncfusion avatarsyncfusion-react-tabssyncfusion/react-ui-components-skillsImplement and customize Tab components in Syncfusion React applications. Use this skill whenever the user needs to create tabbed interfaces, manage tab content 740skills.sh installs