skills/react-router-loader-performance/SKILL.md
React Router v7 loader performance optimization techniques. Use when optimizing TTFB, eliminating waterfalls, consolidating database queries, or streaming secondary data in loaders. Triggers on "slow loaders", "optimize TTFB", "speed up React Router", "loader performance", or when loaders exceed 500ms response time.
npx skillsauth add adrianbrowning/agent-skills react-router-loader-performanceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Critical optimization techniques for React Router v7 loaders. Contains 4 rules focused on eliminating waterfalls and maximizing parallel execution.
Impact: CRITICAL - Poor loader performance directly impacts Time To First Byte (TTFB) and perceived page speed.
Use these techniques when:
Use ORM includes/relations for single-query data fetching.
// Bad: 3 DB calls (~450ms on 150ms latency)
const product = await db.product.findUnique({ where: { id } });
const reviews = await db.review.findMany({ where: { productId: id } });
const variations = await db.variation.findMany({ where: { productId: id } });
// Good: 1 DB call (~200ms)
const product = await db.product.findUnique({
where: { id },
include: { reviews: true, variations: true },
});
Impact: Often the single biggest loader performance win, especially on high-latency DB connections.
Stream non-critical data without awaiting.
// Bad: blocks on slow operation (~3500ms TTFB)
const product = await getProduct(id); // 500ms
const recommendations = await getRecommendations(product); // 3000ms
return data({ product, recommendations }); // TTFB: 3500ms
// Good: streams secondary data (~500ms TTFB)
const product = await getProduct(id); // 500ms
const recommendations = getRecommendations(product); // Don't await
return data({ product, recommendations }); // TTFB: 500ms
Impact: Keeps slow operations off critical path. Recommendations stream while user views product.
Minimize geographic distance between servers and databases.
Key metrics:
Actions:
Use Promise.all for independent async operations (covered in frontend-async-best-practices).
// Bad: sequential (~900ms)
const product = await fetchProduct(); // 400ms
const reviews = await fetchReviews(); // 300ms
const variations = await fetchVariations(); // 200ms
// Good: parallel (~400ms)
const [product, reviews, variations] = await Promise.all([
fetchProduct(),
fetchReviews(),
fetchVariations(),
]);
Impact: Total time equals slowest operation, not sum of all operations.
Use Server-Timing headers to identify bottlenecks:
import { time } from "~/utils/timing.server";
export async function loader({ params }: Route.LoaderArgs) {
const product = await time("product", () => getProduct(params.id));
const recommendations = time("recommendations", () =>
getRecommendations(product)
);
return data({ product, recommendations });
}
Analyze Chrome DevTools Network tab for Server-Timing breakdown.
development
Best practices for TypeScript types, interfaces, assertions, and type safety. Use when writing or reviewing TypeScript code.
development
--- name: testing-best-practice description: A Skill for writing, reviewing, and refactoring tests using Artem-style principles: test intent over implementation, mock boundaries not internals, avoid flakiness, prefer integration tests, and use `using` for cleanup. --- # Testing Best Practice ## Instructions When the user asks for help with tests (writing new tests, improving existing ones, or defining testing standards), follow these rules: 1. **Test intent, not implementation** - Make te
development
Enforce Test-Driven Development with strict Red-Green-Refactor cycle using integration tests. Auto-triggers when implementing new features or functionality. Trigger phrases include "implement", "add feature", "build", "create functionality", or any request to add new behavior. Does NOT trigger for bug fixes, documentation, or configuration changes.
development
Convert project plans to JSONL format (issues + dependencies). Use when users ask "convert plan to jsonl", "create jsonl from plan", "export plan as json" or "convert plan to taks", "create tasks from plan", "export plan as tasks".