一键导入
page-route
Design and implement page routing — URL structure, navigation, layouts,
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design and implement page routing — URL structure, navigation, layouts,
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | page-route |
| description | Design and implement page routing — URL structure, navigation, layouts, |
| governance | Constitution ENG-004: Engineering Excellence & Software Craftsmanship Standard |
Design and implement page routing — URL structure, navigation, layouts, protected routes, and lazy loading — creating a coherent application navigation experience.
Ad-hoc routing leads to broken back buttons, unshareable URLs, and confused users. This skill designs a complete routing structure with nested layouts, guards, code splitting, and SEO-friendly URLs that make the application navigable, bookmarkable, and performant.
When setting up a new application. When adding new pages or restructuring navigation. When implementing authentication-gated sections.
Page inventory, authentication requirements, layout structure.
// src/router/index.tsx
import { createBrowserRouter, RouterProvider, Navigate, Outlet } from "react-router-dom";
import { Suspense, lazy } from "react";
import { useAuth } from "../hooks/useAuth";
import { MainLayout } from "../layouts/MainLayout";
import { AuthLayout } from "../layouts/AuthLayout";
import { LoadingPage } from "../components/LoadingPage";
// Lazy-loaded pages for code splitting
const Dashboard = lazy(() => import("../pages/Dashboard"));
const Users = lazy(() => import("../pages/Users"));
const UserDetail = lazy(() => import("../pages/UserDetail"));
const Login = lazy(() => import("../pages/Login"));
const NotFound = lazy(() => import("../pages/NotFound"));
// Route guard: redirect to login if not authenticated
function ProtectedRoute() {
const { user, loading } = useAuth();
if (loading) return <LoadingPage />;
if (!user) return <Navigate to="/login" replace />;
return <Outlet />;
}
const router = createBrowserRouter([
{
path: "/login",
element: <AuthLayout />,
children: [
{ index: true, element: <Login /> },
],
},
{
path: "/",
element: <ProtectedRoute />,
children: [
{
element: <MainLayout />,
children: [
{ index: true, element: <Navigate to="/dashboard" replace /> },
{ path: "dashboard", element: <Dashboard /> },
{
path: "users",
children: [
{ index: true, element: <Users /> },
{ path: ":userId", element: <UserDetail /> },
],
},
],
},
],
},
{ path: "*", element: <NotFound /> },
]);
export function AppRouter() {
return (
<Suspense fallback={<LoadingPage />}>
<RouterProvider router={router} />
</Suspense>
);
}
/users (list), /users/:id (detail), /users/new (create)/projects/:id/tasks/:taskId/users/abc-123 not /page?id=abc-123Consult and write the ARAYA postoffice — the operational-directive channel. Advisory, never a gate: read it at cycle start, append your entry at cycle end, consider its directives, never be blocked by it. Governance acts never travel the postoffice.
Audit and enforce brand compliance across all projects and platforms — logo,
Design REST and GraphQL APIs following OpenAPI 3.1 standards. Produce complete
Connect frontend to backend — type-safe API clients, request/response handling,
Implement authentication and authorization middleware — JWT validation, role-based
Design scalable component architectures — design systems, component libraries,