remix-run/react-router · error · Error

React Router agent skill files were not found

Error message

React Router agent skill files were not found

What it means

When agent-skills are enabled, the CLI copies the skill bundled inside the installed create-react-router package from <package>/dist/agent-skills/react-router, and requires SKILL.md there. If that file is missing, the installed package is incomplete or corrupted (partial install, stale cache), or the running version does not bundle the skill files.

Solutions

  1. Reinstall in a clean state: remove node_modules, clear the cache (npm cache clean --force or pnpm store prune), reinstall
  2. Pin or upgrade to the latest create-react-router so the bundled skill files are present
  3. Or skip the step entirely with --no-agent-skills
  4. If a fresh install still lacks the files, report it to the react-router repo

Example fix

# before
npx create-react-router my-app

# after: clean reinstall, or opt out
npm cache clean --force && rm -rf node_modules && npm install
npx create-react-router my-app
# or simply:
npx create-react-router my-app --no-agent-skills
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from "node:fs";
import path from "node:path";
import { createRequire } from "node:module";

const require = createRequire(import.meta.url);

function agentSkillFilesInstalled(): boolean {
  try {
    const pkgRoot = path.dirname(require.resolve("create-react-router/package.json"));
    return existsSync(path.join(pkgRoot, "dist", "agent-skills", "react-router", "SKILL.md"));
  } catch {
    return false; // package not resolvable at all
  }
}

const args = agentSkillFilesInstalled() ? allArgs : [...allArgs, "--no-agent-skills"];

Try / catch

try {
  await createReactRouter(args);
} catch (e) {
  if ((e as Error).message === "React Router agent skill files were not found") {
    console.error("create-react-router install incomplete — clear cache and reinstall, or use --no-agent-skills");
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: An interrupted package install leaving partial package contents; a corrupted package-manager store (pnpm store, npm cache); running from a modified or partial checkout of the repo; an old create-react-router version that predates bundled agent skills.

Common situations: CI caches with partially extracted packages; local patched or linked versions of create-react-router; Windows installs where files were locked during extraction.

Related errors


AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18). Data as JSON: /api/errors/3b07a2b22119ace7. Report an issue: GitHub.

Appendix: source

Thrown at packages/create-react-router/index.ts:342

async function copyAgentSkillsToAppDirStep(ctx: Context) {
  if (!ctx.agentSkills) {
    await sleep(100);
    info("Skipping agent skill.", [
      "You can add it later from ",
      color.reset(
        "https://github.com/remix-run/react-router/tree/main/.agents/skills/react-router",
      ),
      ".",
    ]);
    return;
  }

  if (!existsSync(path.join(agentSkillPath, "SKILL.md"))) {
    error(
      "Oh no!",
      "React Router agent skill files were not found in this package.",
    );
    throw new Error("React Router agent skill files were not found");
  }

  let destPath = path.join(ctx.cwd, ".agents", "skills", "react-router");

  if (existsSync(destPath)) {
    info("Agent skill:", "React Router agent skill already included");
    return;
  }

  await ensureDirectory(path.dirname(destPath));
  await cp(agentSkillPath, destPath, {
    errorOnExist: true,
    force: false,
    recursive: true,
  });
  info("Agent skill:", "Included React Router agent skill");
}

View on GitHub (pinned to 6beaca3952)