AgentSkillsCN

add-route

新增公开或受保护的路由。当您构建作品集页面(项目、博客、资源)或仪表盘路由时,可选用此方法。

SKILL.md
--- frontmatter
name: add-route
description: Add a new public or protected route. Use when creating portfolio pages (projects, blog, resources) or dashboard routes.
argument-hint: [route-path] [public|protected]
disable-model-invocation: false

Add a new route following TanStack Router conventions.

Arguments: $ARGUMENTS (e.g. /projects public, /settings protected)

Public routes (apps/client/src/routes/_public/):

  • SEO-critical; no auth required
  • Use BaseTemplate, BasePage, PageContainer
  • Optional useUser, useTest (MVT)

Protected routes (apps/client/src/routes/_protected/):

  • Auth required
  • FeatureGuardButton, PermissionGuardButton for conditional UI

Steps:

  1. Create route directory (e.g. projects/ or projects/$slug/)
  2. Add route.tsx with createFileRoute
  3. Add index.tsx with page component
  4. Update router if needed (file-based routing usually handles it)
  5. Add to Navigation or panel config if visible in nav