Skip to content
sergiodxa avatar

Frontend React Router Best Practices

React Router data-loading, action, and route-organization rules with code examples for performance and architecture.

CCM score
52 of 100
skills.sh installs
406
GitHub stars
92
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers 55 rules across 11 categories: data loading, middleware, forms, streaming, and route organization
  • Includes loader patterns such as Promise.all parallel fetches, per-request API caching, and useRevalidator polling, each with before-and-after code
  • Enforces loader-only data fetching and validates URL params with zod before queries run
  • Designed for developers writing React Router loaders, actions, and forms in TypeScript applications

Install

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

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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 });
}

Details

Repository
github.com/sergiodxa/agent-skills
Category
Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the frontend-react-router-best-practices skill do?

frontend-react-router-best-practices gives performance and architecture patterns for React Router applications. It covers writing loaders and actions, handling forms, streaming with Single Fetch, and organizing route files and colocated queries.

How do I install the frontend-react-router-best-practices skill?

Run npx -y skills add sergiodxa/agent-skills --skill frontend-react-router-best-practices -y in your project. After that, frontend-react-router-best-practices lets the agent apply React Router loader, action and routing rules when you write data fetching code.

Where does frontend-react-router-best-practices stand in the Frontend & UI Code category?

frontend-react-router-best-practices sits in the Frontend & UI Code category on Claude Marketplaces, next to vercel-react-best-practices and web-design-guidelines. Unlike those, it focuses on React Router data loading, form handling and route organization.

When should I use frontend-react-router-best-practices?

Use frontend-react-router-best-practices when you write new React Router routes, loaders, actions or forms. It also helps when you set up authentication patterns or add SEO and meta tags in a React Router app.

More from sergiodxa/agent-skills

All 10

Similar to Frontend React Router Best Practices

More Frontend & UI Code