fec-route-protection

fec-route-protection is a skill for Claude Code from bovinphang/frontend-craft. It costs 67 tokens per session (1,162 once invoked), scanned A, original, MIT.

A guide for protecting front-end routes, meaning the pages and URLs of a web application, based on whether someone is signed in and what permissions they have. It covers login checks, role-based access, expired sessions, and redirects.

In plain words
What is it for?
Implementing and reviewing protected routes in React Router, Next.js, Vue Router, and Nuxt; sending signed-out users to login; handling forbidden pages; and managing organisation, tenant, or session changes.
Why use it?
Without consistent route checks, users may see pages they should not access or briefly see protected content while login information loads. This also clarifies that front-end checks improve navigation but cannot replace permission checks on the server.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the frontend-craft plugin — 56 skills, 11 commands, 14 agents, 5 hooks, 6 MCP servers shipped together

Good fit Implementing and reviewing protected routes in React Router, Next.js, Vue Router, and Nuxt; sending signed-out users to login; handling forbidden pages; and managing organisation, tenant, or session changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bovinphang/frontend-craft/fec-route-protection
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.

Any agent
npx skills add bovinphang/frontend-craft --skill fec-route-protection
Clone the repo
git clone --depth 1 https://github.com/bovinphang/frontend-craft

Made for: Claude Code.

Or install frontend-craft, the plugin that ships this one along with the rest of its 56 skills, 11 commands, 14 agents, 5 hooks, 6 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fec-route-protection

README.md
[![agentmods](https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-route-protection/github.svg)](https://agentmods.dev/skills/bovinphang/frontend-craft/fec-route-protection)
Your own site
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-route-protection"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-route-protection/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fec-route-protection

Your own site · 80×15
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-route-protection"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-route-protection.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,162 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Memory Poisoning · line 52
    Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
    Fix: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.
How audits are shown
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.1 $0.00067 $0.01162
Opus 5 $0.00034 $0.00581
Sonnet 5 $0.00013 $0.00232
Haiku 4.5 $0.00007 $0.00116

Measured 11d ago against content hash fee639ddd6af, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

fec-route-protection 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 11d ago.

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.

localized/zh-CN/skills/fec-route-protection/SKILL.md · 136 lines

How it starts

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

路由保护

用途

为前端应用建立清晰的认证、授权和重定向边界,避免越权访问与闪烁渲染。

适用场景

  • 页面需要登录后访问,或不同角色看到不同路由。
  • 需要实现 React Router、Next.js、Nuxt 或 Vue Router 的路由守卫。
  • 登录过期、权限不足、组织/租户切换需要统一处理。
  • 不用于替代服务端授权;前端路由保护只能改善体验,不能作为唯一安全边界。

流程

1. 定义认证与授权状态

export type AuthStatus = "loading" | "anonymous" | "authenticated";

export interface CurrentUser {
  id: string;
  roles: string[];
  permissions: string[];
}

export function canAccess(user: CurrentUser, required: string[]) {
  return required.every((permission) => user.permissions.includes(permission));
}

2. React Router 使用布局守卫

import { Navigate, Outlet, useLocation } from "react-router-dom";

interface ProtectedRouteProps {
  requiredPermissions?: string[];
}

export function ProtectedRoute({ requiredPermissions = [] }: ProtectedRouteProps) {
  const location = useLocation();
  const { status, user } = useAuth();

  if (status === "loading") return <RouteLoading />;
  if (status === "anonymous") {
    return <Navigate to="/login" replace state={{ from: location }} />;
  }
  if (requiredPermissions.length > 0 && !canAccess(user, requiredPermissions)) {
    return <Navigate to="/403" replace />;
  }

  return <Outlet />;
}
const router = createBrowserRouter([
  {
    element: <ProtectedRoute requiredPermissions={["orders:read"]} />,
    children: [{ path: "/orders", element: <OrdersPage /> }],
  },
]);

3. Next.js 优先在服务端边界处理

// middleware.ts
import { NextResponse, type NextRequest } from "next/server";

export function middleware(request: NextRequest) {
  const token = request.cookies.get("session")?.value;
  const isPrivateRoute = request.nextUrl.pathname.startsWith("/dashboard");

  if (isPrivateRoute && !token) {
    const loginUrl = new URL("/login", request.url);
    loginUrl.searchParams.set("redirect", request.nextUrl.pathname);
    return NextResponse.redirect(loginUrl);
  }

  return NextResponse.next();
}

export const config = {
  matcher: ["/dashboard/:path*"],
};

对需要精细权限的 App Router 页面,在 server component 或 server action 中重新校验权限,不依赖客户端状态。

Read the full file on GitHub · 136 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. 11d ago First seen · 136 lines · 67 tokens per session scan A fee639ddd6af

Subscribe to this mod's changes

fec-route-protection is a skill published in the GitHub repository bovinphang/frontend-craft (21 stars, last pushed 10d ago), licensed MIT. It adds 67 tokens to every session and 1,162 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories

brand-design

Brand-aware design system generator that acts as Head of Brand. Translates abstract brand language into a mathematically-validated, implementation-ready design system, writes creative-brief.md as the source of truth for all UI/UX in a project, and optionally compiles it to framework tokens (Tailwind v4 @theme, v3…

rfxlamia/pocketto · 146 tokens

mobile-flows-maestro

This skill should be used when Maestro is explicitly requested or already present and the task is to author, run, or debug iOS/Android Maestro flows; use Maestro MCP; or handle Maestro selectors, system UI, permissions, Keychain, JavaScript, waits, device state, flakiness, or CI. Evidence includes a .maestro directory…

johnkozaris/jko-claude-plugins · 102 tokens

ui-ux-pro-max

UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design…

avelikiy/great_cto · 238 tokens

genpage

Creates, updates, and deploys Power Apps generative pages for model-driven apps using React v17, TypeScript, and Fluent UI V9. Orchestrates specialist agents for planning, entity creation, and code generation. Use it when user asks to build, retrieve, or update a page in an existing Microsoft Power Apps model-driven…

microsoft/power-platform-skills · 140 tokens

recipe-front-review

Reviews completed frontend implementation for governing-source compliance, scope economy, repository quality, and security, then applies user-approved React corrections.

shinpr/claude-code-workflows · 29 tokens

boundaries

Analyze Phoenix context boundaries and module coupling via mix xref. Use when checking cross-context calls, validating dependencies, before splitting modules, or reviewing architecture.

oliver-kriska/claude-elixir-phoenix · 33 tokens