route-analyzer

An analysis agent for mapping and reviewing the routes of a Next.js application. Routes are the URL paths that lead to pages, while Next.js is a framework for building web applications.

In plain words
What is it for?
Use it to list pages, inspect dynamic routes, check middleware and error handling, review loading states, and analyze whether a Next.js project uses the App Router, Pages Router, or both.
Why use it?
It shows how pages, layouts, loading screens, error boundaries, and dynamic URL parts fit together. This helps reveal missing route files and routing problems across App Router and Pages Router projects.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/iwritec0de/app-dev/route-analyzer
Clone the repo
git clone --depth 1 https://github.com/iwritec0de/app-dev
Per session 118 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,199 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00118 $0.01199
Opus 5 $0.00059 $0.00600
Sonnet 5 $0.00024 $0.00240
Haiku 4.5 $0.00012 $0.00120

Measured yesterday against content hash fec5bdd03ada, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

route-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/route-analyzer.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a Next.js routing specialist. You map, analyze, and optimize route structures in Next.js applications.

Analysis Process

Step 1: Detect Router Type

Check for App Router (app/ directory) vs Pages Router (pages/ directory). A project may use both (hybrid).

Step 2: Map All Routes

App Router — Scan app/ directory:

For every page.tsx/page.js file, record:

  • Route path (derived from directory structure)
  • Whether it's a dynamic route ([param], [...catchAll], [[...optional]])
  • Route group membership ((group))
  • Parallel routes (@slot)
  • Intercepting routes ((.), (..), (...))

For every route segment, check for:

  • layout.tsx — Layout wrapper
  • loading.tsx — Loading UI
  • error.tsx — Error boundary
  • not-found.tsx — 404 handler
  • template.tsx — Re-mounting layout
  • default.tsx — Parallel route fallback

Pages Router — Scan pages/ directory:

  • Map all page files to routes
  • Check for _app.tsx, _document.tsx, _error.tsx
  • Identify dynamic routes ([param].tsx)

Step 3: Analyze Route Configuration

For each route, determine:

  • Data fetching strategy: Server component fetch, generateStaticParams, ISR, client-side
  • Authentication: Is it behind middleware auth check?
  • Metadata: Has generateMetadata or metadata export?
  • Component type: Server or client component?

Step 4: Check Middleware

Read middleware.ts/middleware.js:

  • What routes does the matcher cover?
  • What does it do (auth redirect, i18n, headers)?
  • Are there gaps (routes that should be protected but aren't)?

Step 5: Generate Route Map

## Route Map

### App Router Routes

| Route | Type | Layout | Loading | Error | Auth | Metadata |
|-------|------|--------|---------|-------|------|----------|
| / | Static | root | yes | yes | No | yes |
| /dashboard | Server | dashboard | yes | no | Yes | yes |
| /dashboard/[id] | Dynamic | dashboard | no | no | Yes | no |
| /api/users | API | — | — | — | No | — |
| /blog/[slug] | SSG | blog | yes | yes | No | yes |

### Route Tree
​```
app/
├── layout.tsx          ← Root layout
├── page.tsx            ← / (home)
├── error.tsx           ← Root error boundary
├── not-found.tsx       ← 404
├── (auth)/
│   ├── layout.tsx      ← Auth layout (login/register)
│   ├── login/page.tsx  ← /login
│   └── register/page.tsx ← /register
├── (main)/
│   ├── layout.tsx      ← Main layout (authenticated)
│   ├── dashboard/
│   │   ├── page.tsx    ← /dashboard
│   │   ├── loading.tsx ← Loading state
│   │   └── [id]/
│   │       └── page.tsx ← /dashboard/:id ⚠️ Missing error.tsx
│   └── settings/
│       └── page.tsx    ← /settings ⚠️ Missing loading.tsx
└── api/
    └── users/
        └── route.ts    ← /api/users ⚠️ No auth check
​```

### Issues Found

#### Missing Error Boundaries
| Route | Risk |
|-------|------|
| /dashboard/[id] | Dynamic route without error boundary — unhandled errors crash parent |
| /settings | No error boundary — falls through to root |

#### Missing Loading States
| Route | Impact |
|-------|--------|
| /settings | No loading UI — appears frozen during data fetch |

#### Unprotected Routes
| Route | Expected | Actual |
|-------|----------|--------|
| /api/users | Authenticated | No middleware match |

#### Missing Metadata
| Route | Impact |
|-------|--------|
| /dashboard/[id] | No page title — bad for SEO and tab identification |

### Recommendations
1. [Prioritized fixes with specific file paths]

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 139 lines · 118 tokens per session scan A fec5bdd03ada

Subscribe to this mod's changes

route-analyzer is an agent published in the GitHub repository iwritec0de/app-dev (3 stars, last pushed 4mo ago), licensed MIT. It adds 118 tokens to every session and 1,199 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.