AgentSkillsCN

roto-rooter

适用于 React Router 应用程序的静态分析。在构建或调试 React Router 应用时使用,以验证路由、链接、表单、加载器、参数、水合模式以及数据库持久化操作。

SKILL.md
--- frontmatter
name: roto-rooter
description: Static analysis for React Router applications. Use when building or debugging React Router apps to verify routes, links, forms, loaders, params, hydration patterns, and database persistence operations.
allowed-tools: Bash(rr:*)

React Router Static Analysis with roto-rooter

Quick start

bash
rr                              # analyze all routes in current directory
rr app/routes/dashboard.tsx     # analyze specific file
rr --fix                        # auto-fix issues
rr --dry-run                    # preview fixes

Example output:

code
[links] app/routes/dashboard.tsx:24:8
  <Link to="/users">
  [error] Link target "/users" does not match any route

[hydration] app/routes/dashboard.tsx:31:12
  {new Date().toLocaleString()}
  [warning] new Date() in render may cause hydration mismatch
  -> Move to useEffect or use suppressHydrationWarning

1 error, 1 warning

Commands

bash
rr [FILES...]                   # analyze files (default: all routes)
rr --check links,forms          # run specific checks
rr --format json                # JSON output
rr --root ./my-app              # set project root

Available checks

  • links - validates Link/NavLink href targets exist as routes
  • forms - validates Form action targets and method/action mismatches
  • loader - detects loader data usage issues
  • params - validates route params match definitions
  • hydration - detects hydration mismatches (Date, Math.random, window access in render)
  • interactivity - detects disconnected dialogs (Save buttons that don't save, stub handlers)
  • persistence - validates database operations against Drizzle ORM schema (requires --orm drizzle)

Examples

bash
# Check for broken links in a route file
rr app/routes/dashboard.tsx --check links

# Auto-fix all fixable issues in the project
rr --fix

# Get JSON output for CI integration
rr --format json

# Enable Drizzle ORM persistence checking (auto-discovers schema)
rr --orm drizzle

# Drizzle checking with explicit schema path
rr --orm drizzle --drizzle-schema src/db/schema.ts